feat(svelte) added connectionMode prop
This commit is contained in:
@@ -14,6 +14,7 @@ import {
|
|||||||
Controls,
|
Controls,
|
||||||
Background,
|
Background,
|
||||||
MiniMap,
|
MiniMap,
|
||||||
|
ConnectionMode,
|
||||||
} from '@xyflow/react';
|
} from '@xyflow/react';
|
||||||
|
|
||||||
const onNodeDragStart = (_: ReactMouseEvent, node: Node, nodes: Node[]) => console.log('drag start', node, nodes);
|
const onNodeDragStart = (_: ReactMouseEvent, node: Node, nodes: Node[]) => console.log('drag start', node, nodes);
|
||||||
@@ -193,6 +194,7 @@ const OverviewFlow = () => {
|
|||||||
<ReactFlow
|
<ReactFlow
|
||||||
nodes={nodes}
|
nodes={nodes}
|
||||||
edges={edges}
|
edges={edges}
|
||||||
|
connectionMode={ConnectionMode.Loose}
|
||||||
onNodesChange={onNodesChange}
|
onNodesChange={onNodesChange}
|
||||||
onEdgesChange={onEdgesChange}
|
onEdgesChange={onEdgesChange}
|
||||||
onNodeClick={onNodeClick}
|
onNodeClick={onNodeClick}
|
||||||
|
|||||||
@@ -11,7 +11,8 @@
|
|||||||
type NodeTypes,
|
type NodeTypes,
|
||||||
type EdgeTypes,
|
type EdgeTypes,
|
||||||
type Node,
|
type Node,
|
||||||
type Edge
|
type Edge,
|
||||||
|
ConnectionMode
|
||||||
} from '@xyflow/svelte';
|
} from '@xyflow/svelte';
|
||||||
|
|
||||||
import CustomNode from './CustomNode.svelte';
|
import CustomNode from './CustomNode.svelte';
|
||||||
@@ -161,6 +162,7 @@
|
|||||||
}}
|
}}
|
||||||
autoPanOnConnect
|
autoPanOnConnect
|
||||||
autoPanOnNodeDrag
|
autoPanOnNodeDrag
|
||||||
|
connectionMode={ConnectionMode.Loose}
|
||||||
>
|
>
|
||||||
<Controls />
|
<Controls />
|
||||||
<Background variant={BackgroundVariant.Dots} />
|
<Background variant={BackgroundVariant.Dots} />
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount, hasContext } from 'svelte';
|
import { onMount, hasContext } from 'svelte';
|
||||||
import cc from 'classcat';
|
import cc from 'classcat';
|
||||||
import { PanOnScrollMode, type Viewport } from '@xyflow/system';
|
import { ConnectionMode, PanOnScrollMode, type Viewport } from '@xyflow/system';
|
||||||
|
|
||||||
import { Zoom } from '$lib/container/Zoom';
|
import { Zoom } from '$lib/container/Zoom';
|
||||||
import { Pane } from '$lib/container/Pane';
|
import { Pane } from '$lib/container/Pane';
|
||||||
@@ -38,6 +38,7 @@
|
|||||||
export let deleteKey: $$Props['deleteKey'] = undefined;
|
export let deleteKey: $$Props['deleteKey'] = undefined;
|
||||||
export let connectionRadius: $$Props['connectionRadius'] = undefined;
|
export let connectionRadius: $$Props['connectionRadius'] = undefined;
|
||||||
export let connectionLineType: $$Props['connectionLineType'] = undefined;
|
export let connectionLineType: $$Props['connectionLineType'] = undefined;
|
||||||
|
export let connectionMode: $$Props['connectionMode'] = ConnectionMode.Strict;
|
||||||
export let onMoveStart: $$Props['onMoveStart'] = undefined;
|
export let onMoveStart: $$Props['onMoveStart'] = undefined;
|
||||||
export let onMove: $$Props['onMove'] = undefined;
|
export let onMove: $$Props['onMove'] = undefined;
|
||||||
export let onMoveEnd: $$Props['onMoveEnd'] = undefined;
|
export let onMoveEnd: $$Props['onMoveEnd'] = undefined;
|
||||||
@@ -108,7 +109,8 @@
|
|||||||
isValidConnection,
|
isValidConnection,
|
||||||
autoPanOnConnect,
|
autoPanOnConnect,
|
||||||
autoPanOnNodeDrag,
|
autoPanOnNodeDrag,
|
||||||
onError
|
onError,
|
||||||
|
connectionMode
|
||||||
};
|
};
|
||||||
|
|
||||||
updateStoreByKeys(store, updatableProps);
|
updateStoreByKeys(store, updatableProps);
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ import type {
|
|||||||
IsValidConnection,
|
IsValidConnection,
|
||||||
HandleType,
|
HandleType,
|
||||||
NodeBase,
|
NodeBase,
|
||||||
OnError
|
OnError,
|
||||||
|
ConnectionMode
|
||||||
} from '@xyflow/system';
|
} from '@xyflow/system';
|
||||||
|
|
||||||
import type { Edge, Node, NodeTypes, KeyDefinition, EdgeTypes } from '$lib/types';
|
import type { Edge, Node, NodeTypes, KeyDefinition, EdgeTypes } from '$lib/types';
|
||||||
@@ -35,6 +36,7 @@ export type SvelteFlowProps = DOMAttributes<HTMLDivElement> & {
|
|||||||
maxZoom?: number;
|
maxZoom?: number;
|
||||||
initialViewport?: Viewport;
|
initialViewport?: Viewport;
|
||||||
connectionRadius?: number;
|
connectionRadius?: number;
|
||||||
|
connectionMode?: ConnectionMode;
|
||||||
selectionMode?: SelectionMode;
|
selectionMode?: SelectionMode;
|
||||||
snapGrid?: SnapGrid;
|
snapGrid?: SnapGrid;
|
||||||
defaultMarkerColor?: string;
|
defaultMarkerColor?: string;
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ export type UpdatableStoreProps = {
|
|||||||
isValidConnection?: UnwrapWritable<SvelteFlowStore['isValidConnection']>;
|
isValidConnection?: UnwrapWritable<SvelteFlowStore['isValidConnection']>;
|
||||||
autoPanOnConnect?: UnwrapWritable<SvelteFlowStore['autoPanOnConnect']>;
|
autoPanOnConnect?: UnwrapWritable<SvelteFlowStore['autoPanOnConnect']>;
|
||||||
autoPanOnNodeDrag?: UnwrapWritable<SvelteFlowStore['autoPanOnNodeDrag']>;
|
autoPanOnNodeDrag?: UnwrapWritable<SvelteFlowStore['autoPanOnNodeDrag']>;
|
||||||
|
connectionMode?: UnwrapWritable<SvelteFlowStore['connectionMode']>;
|
||||||
onError?: UnwrapWritable<SvelteFlowStore['onError']>;
|
onError?: UnwrapWritable<SvelteFlowStore['onError']>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user