fix: no use of fragments for nodes as it results in warning from vue and we got enough of those as is

* some typing issues
This commit is contained in:
Braks
2021-07-17 22:54:52 +02:00
parent e77797acc7
commit 7c7c31b46f
11 changed files with 36 additions and 52 deletions
+2 -2
View File
@@ -29,11 +29,11 @@ const DefaultNode = defineComponent({
},
setup(props) {
return () => (
<>
<div>
<Handle type="target" position={props.targetPosition} isConnectable={props.isConnectable} />
{props.data?.label}
<Handle type="source" position={props.sourcePosition} isConnectable={props.isConnectable} />
</>
</div>
);
}
});
+2 -2
View File
@@ -24,10 +24,10 @@ const InputNode = defineComponent({
},
setup(props) {
return () => (
<>
<div>
{props.data?.label}
<Handle type="source" position={props.sourcePosition} isConnectable={props.isConnectable} />
</>
</div>
);
}
});
+2 -2
View File
@@ -24,10 +24,10 @@ const OutputNode = defineComponent({
},
setup(props) {
return () => (
<>
<div>
{props.data?.label}
<Handle type="source" position={props.targetPosition} isConnectable={props.isConnectable} />
</>
</div>
);
}
});
+2 -2
View File
@@ -1,8 +1,8 @@
import { Node, RevueFlowStore, WrapNodeProps } from '../../types';
import { computed, CSSProperties, defineComponent, inject, onMounted, provide, ref } from 'vue';
import { computed, CSSProperties, DefineComponent, defineComponent, inject, onMounted, provide, ref } from 'vue';
import { DraggableCore, DraggableEventHandler } from '@braks/revue-draggable';
export default (NodeComponent: any) => {
export default (NodeComponent: DefineComponent<WrapNodeProps>) => {
return defineComponent({
props: WrapNodeProps,
setup(props) {
+2 -3
View File
@@ -71,9 +71,7 @@ const NodesSelection = defineComponent({
};
const onDrag: DraggableEventHandler = (event, data) => {
if (props.onSelectionDrag) {
props.onSelectionDrag(event, selectedNodes.value);
}
props.onSelectionDrag?.(event, selectedNodes.value);
store.updateNodePosDiff({
diff: {
@@ -111,6 +109,7 @@ const NodesSelection = defineComponent({
onStart={onStart}
onDrag={onDrag}
onStop={onStop}
nodeRef={nodeRef.value}
enableUserSelectHack={false}
nodeRef={nodeRef.value}
>
+6 -8
View File
@@ -56,11 +56,11 @@ export default defineComponent({
return;
}
store?.setUserSelection(mousePos);
store.setUserSelection(mousePos);
};
const onMouseMove = (event: MouseEvent): void => {
if (!store?.selectionActive) {
if (!store.selectionActive) {
return;
}
const mousePos = getMousePosition(event);
@@ -69,16 +69,14 @@ export default defineComponent({
return;
}
store?.updateUserSelection(mousePos);
store.updateUserSelection(mousePos);
};
const onMouseUp = () => {
store?.unsetUserSelection();
};
const onMouseUp = () => store.unsetUserSelection();
const onMouseLeave = () => {
store?.unsetUserSelection();
store?.unsetNodesSelection();
store.unsetUserSelection();
store.unsetNodesSelection();
};
return () => (