chore(docs): cleanup edges example
This commit is contained in:
@@ -3,7 +3,7 @@ import { h, ref } from 'vue'
|
|||||||
import { Background } from '@vue-flow/background'
|
import { Background } from '@vue-flow/background'
|
||||||
import { MarkerType, VueFlow } from '@vue-flow/core'
|
import { MarkerType, VueFlow } from '@vue-flow/core'
|
||||||
import EdgeWithButton from './EdgeWithButton.vue'
|
import EdgeWithButton from './EdgeWithButton.vue'
|
||||||
import CustomEdge2 from './CustomEdge2.vue'
|
import CustomEdge from './CustomEdge.vue'
|
||||||
import CustomEdgeLabel from './CustomEdgeLabel.vue'
|
import CustomEdgeLabel from './CustomEdgeLabel.vue'
|
||||||
|
|
||||||
const nodes = ref([
|
const nodes = ref([
|
||||||
@@ -49,7 +49,7 @@ const edges = ref([
|
|||||||
id: 'e5-8',
|
id: 'e5-8',
|
||||||
source: '5',
|
source: '5',
|
||||||
target: '8',
|
target: '8',
|
||||||
type: 'custom',
|
type: 'button',
|
||||||
data: { text: 'custom edge' },
|
data: { text: 'custom edge' },
|
||||||
markerEnd: MarkerType.ArrowClosed,
|
markerEnd: MarkerType.ArrowClosed,
|
||||||
},
|
},
|
||||||
@@ -57,7 +57,7 @@ const edges = ref([
|
|||||||
id: 'e4-9',
|
id: 'e4-9',
|
||||||
source: '4',
|
source: '4',
|
||||||
target: '9',
|
target: '9',
|
||||||
type: 'custom2',
|
type: 'custom',
|
||||||
data: { text: 'styled custom edge label' },
|
data: { text: 'styled custom edge label' },
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
@@ -65,12 +65,33 @@ const edges = ref([
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VueFlow :nodes="nodes" :edges="edges" fit-view-on-init>
|
<VueFlow :nodes="nodes" :edges="edges" fit-view-on-init>
|
||||||
<template #edge-custom="props">
|
<template #edge-button="buttonEdgeProps">
|
||||||
<EdgeWithButton v-bind="props" />
|
<EdgeWithButton
|
||||||
|
:id="buttonEdgeProps.id"
|
||||||
|
:source-x="buttonEdgeProps.sourceX"
|
||||||
|
:source-y="buttonEdgeProps.sourceY"
|
||||||
|
:target-x="buttonEdgeProps.targetX"
|
||||||
|
:target-y="buttonEdgeProps.targetY"
|
||||||
|
:source-position="buttonEdgeProps.sourcePosition"
|
||||||
|
:target-position="buttonEdgeProps.targetPosition"
|
||||||
|
:marker-end="buttonEdgeProps.markerEnd"
|
||||||
|
:style="buttonEdgeProps.style"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #edge-custom2="props">
|
<template #edge-custom="customEdgeProps">
|
||||||
<CustomEdge2 v-bind="props" />
|
<CustomEdge
|
||||||
|
:id="customEdgeProps.id"
|
||||||
|
:source-x="customEdgeProps.sourceX"
|
||||||
|
:source-y="customEdgeProps.sourceY"
|
||||||
|
:target-x="customEdgeProps.targetX"
|
||||||
|
:target-y="customEdgeProps.targetY"
|
||||||
|
:source-position="customEdgeProps.sourcePosition"
|
||||||
|
:target-position="customEdgeProps.targetPosition"
|
||||||
|
:data="customEdgeProps.data"
|
||||||
|
:marker-end="customEdgeProps.markerEnd"
|
||||||
|
:style="customEdgeProps.style"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<Background />
|
<Background />
|
||||||
|
|||||||
@@ -43,14 +43,6 @@ const props = defineProps({
|
|||||||
type: Object,
|
type: Object,
|
||||||
required: false,
|
required: false,
|
||||||
},
|
},
|
||||||
sourceHandleId: {
|
|
||||||
type: String,
|
|
||||||
required: false,
|
|
||||||
},
|
|
||||||
targetHandleId: {
|
|
||||||
type: String,
|
|
||||||
required: false,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const path = computed(() => getBezierPath(props))
|
const path = computed(() => getBezierPath(props))
|
||||||
@@ -31,10 +31,6 @@ const props = defineProps({
|
|||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
data: {
|
|
||||||
type: Object,
|
|
||||||
required: false,
|
|
||||||
},
|
|
||||||
markerEnd: {
|
markerEnd: {
|
||||||
type: String,
|
type: String,
|
||||||
required: false,
|
required: false,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
export { default as EdgesApp } from './App.vue?raw'
|
export { default as EdgesApp } from './App.vue?raw'
|
||||||
export { default as EdgeWithButton } from './EdgeWithButton.vue?raw'
|
export { default as EdgeWithButton } from './EdgeWithButton.vue?raw'
|
||||||
export { default as CustomEdge2 } from './CustomEdge2.vue?raw'
|
export { default as CustomEdge } from './CustomEdge.vue?raw'
|
||||||
export { default as CustomEdgeLabel } from './CustomEdgeLabel.vue?raw'
|
export { default as CustomEdgeLabel } from './CustomEdgeLabel.vue?raw'
|
||||||
export { default as EdgeCSS } from './style.css?inline'
|
export { default as EdgeCSS } from './style.css?inline'
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { BasicApp, BasicCSS, BasicElements, BasicIcon } from './basic'
|
import { BasicApp, BasicCSS, BasicElements, BasicIcon } from './basic'
|
||||||
import { ColorPresets, ColorSelectorNode, CustomNodeApp, CustomNodeCSS, OutputNode } from './custom-node'
|
import { ColorPresets, ColorSelectorNode, CustomNodeApp, CustomNodeCSS, OutputNode } from './custom-node'
|
||||||
import { CustomConnectionLine, CustomConnectionLineApp } from './connectionline'
|
import { CustomConnectionLine, CustomConnectionLineApp } from './connectionline'
|
||||||
import { CustomEdge2, CustomEdgeLabel, EdgeCSS, EdgeWithButton, EdgesApp } from './edges'
|
import { CustomEdge, CustomEdgeLabel, EdgeCSS, EdgeWithButton, EdgesApp } from './edges'
|
||||||
import { NestedApp } from './nested'
|
import { NestedApp } from './nested'
|
||||||
import { StressApp, StressCSS, StressUtils } from './stress'
|
import { StressApp, StressCSS, StressUtils } from './stress'
|
||||||
import { UpdateEdgeApp } from './update-edge'
|
import { UpdateEdgeApp } from './update-edge'
|
||||||
@@ -40,8 +40,8 @@ export const exampleImports = {
|
|||||||
},
|
},
|
||||||
edges: {
|
edges: {
|
||||||
'App.vue': EdgesApp,
|
'App.vue': EdgesApp,
|
||||||
'CustomEdge.vue': EdgeWithButton,
|
'EdgeWithButton.vue': EdgeWithButton,
|
||||||
'CustomEdge2.vue': CustomEdge2,
|
'CustomEdge.vue': CustomEdge,
|
||||||
'CustomEdgeLabel.vue': CustomEdgeLabel,
|
'CustomEdgeLabel.vue': CustomEdgeLabel,
|
||||||
'style.css': EdgeCSS,
|
'style.css': EdgeCSS,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<BaseEdge v-bind="$attrs" :id="id" ref="edgeRef" :path="path[0]" :style="{ stroke: edgeColor }" />
|
<BaseEdge :id="id" ref="edgeRef" :path="path[0]" :style="{ stroke: edgeColor }" />
|
||||||
|
|
||||||
<EdgeLabelRenderer v-if="isAnimating">
|
<EdgeLabelRenderer v-if="isAnimating">
|
||||||
<div
|
<div
|
||||||
|
|||||||
Reference in New Issue
Block a user