feat(example): Add edge types example (stress tests)

* Remove a lot of computed functions or merge them into existing ones
*
This commit is contained in:
Braks
2021-08-16 21:17:38 +02:00
parent 15f968c607
commit 384c05240f
13 changed files with 268 additions and 109 deletions
+11 -13
View File
@@ -1,6 +1,6 @@
import { ElementId, Position, RevueFlowStore } from '../../types';
import { onMouseDown, ValidConnectionFunc } from './handler';
import { computed, defineComponent, inject, PropType } from 'vue';
import { defineComponent, inject, PropType } from 'vue';
import { RevueFlowHooks } from '../../hooks/RevueFlowHooks';
const alwaysValid = () => true;
@@ -41,23 +41,21 @@ export default defineComponent({
const onMouseDownHandler = (event: MouseEvent) =>
onMouseDown(event, store, hooks, props.id as string, nodeId, props.type === 'target', props.isValidConnection);
const handleClasses = computed(() => [
'revue-flow__handle',
`revue-flow__handle-${props.position}`,
'nodrag',
{
source: props.type !== 'target',
target: props.type === 'target',
connectable: props.isConnectable
}
]);
return () => (
<div
data-handleid={props.id}
data-nodeid={nodeId}
data-handlepos={props.position}
class={handleClasses.value}
class={[
'revue-flow__handle',
`revue-flow__handle-${props.position}`,
'nodrag',
{
source: props.type !== 'target',
target: props.type === 'target',
connectable: props.isConnectable
}
]}
onMousedown={onMouseDownHandler}
>
{slots.default ? slots.default() : ''}