import { computed, CSSProperties, defineComponent, inject, PropType } from 'vue'; import { ConnectionLineType, ConnectionLineComponent, ConnectionMode, RevueFlowStore } from '../../types'; import ConnectionLine from '../../components/ConnectionLine'; import MarkerDefinitions from './MarkerDefinitions'; import Edge from '../../components/Edges/Edge'; interface EdgeRendererProps { edgeTypes: any; connectionLineType: ConnectionLineType; connectionLineStyle?: CSSProperties; connectionLineComponent?: ConnectionLineComponent; connectionMode?: ConnectionMode; arrowHeadColor: string; markerEndId?: string; onlyRenderVisibleElements: boolean; edgeUpdaterRadius?: number; } export default defineComponent({ name: 'EdgeRenderer', components: { Edge, ConnectionLine, MarkerDefinitions }, props: { edgeTypes: { type: Object, required: true }, connectionLineType: { type: String as PropType, required: false, default: undefined }, connectionLineStyle: { type: Object as PropType, required: false, default: undefined }, connectionLineComponent: { type: Object as PropType, required: false, default: undefined }, connectionMode: { type: String as PropType, required: false, default: undefined }, arrowHeadColor: { type: String as PropType, required: false, default: undefined }, markerEndId: { type: String as PropType, required: false, default: undefined }, onlyRenderVisibleElements: { type: Boolean as PropType, required: false, default: undefined }, edgeUpdaterRadius: { type: Number as PropType, required: false, default: undefined } }, setup(props) { const store = inject('store'); const transform = computed(() => store?.transform); const transformStyle = computed(() => { return `translate(${transform.value?.[0]},${transform.value?.[1]}) scale(${transform.value?.[2]})`; }); const renderConnectionLine = computed(() => store?.connectionNodeId && store?.connectionHandleType); return () => ( {store?.edges.map((edge) => ( ))} {renderConnectionLine.value && ( )} ); } });