feat(svelte) added connectionMode prop

This commit is contained in:
Peter
2023-09-25 15:58:12 +02:00
parent 1a935de3f9
commit 75434d059b
5 changed files with 13 additions and 4 deletions
@@ -1,7 +1,7 @@
<script lang="ts">
import { onMount, hasContext } from 'svelte';
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 { Pane } from '$lib/container/Pane';
@@ -38,6 +38,7 @@
export let deleteKey: $$Props['deleteKey'] = undefined;
export let connectionRadius: $$Props['connectionRadius'] = undefined;
export let connectionLineType: $$Props['connectionLineType'] = undefined;
export let connectionMode: $$Props['connectionMode'] = ConnectionMode.Strict;
export let onMoveStart: $$Props['onMoveStart'] = undefined;
export let onMove: $$Props['onMove'] = undefined;
export let onMoveEnd: $$Props['onMoveEnd'] = undefined;
@@ -108,7 +109,8 @@
isValidConnection,
autoPanOnConnect,
autoPanOnNodeDrag,
onError
onError,
connectionMode
};
updateStoreByKeys(store, updatableProps);
@@ -14,7 +14,8 @@ import type {
IsValidConnection,
HandleType,
NodeBase,
OnError
OnError,
ConnectionMode
} from '@xyflow/system';
import type { Edge, Node, NodeTypes, KeyDefinition, EdgeTypes } from '$lib/types';
@@ -35,6 +36,7 @@ export type SvelteFlowProps = DOMAttributes<HTMLDivElement> & {
maxZoom?: number;
initialViewport?: Viewport;
connectionRadius?: number;
connectionMode?: ConnectionMode;
selectionMode?: SelectionMode;
snapGrid?: SnapGrid;
defaultMarkerColor?: string;
@@ -61,6 +61,7 @@ export type UpdatableStoreProps = {
isValidConnection?: UnwrapWritable<SvelteFlowStore['isValidConnection']>;
autoPanOnConnect?: UnwrapWritable<SvelteFlowStore['autoPanOnConnect']>;
autoPanOnNodeDrag?: UnwrapWritable<SvelteFlowStore['autoPanOnNodeDrag']>;
connectionMode?: UnwrapWritable<SvelteFlowStore['connectionMode']>;
onError?: UnwrapWritable<SvelteFlowStore['onError']>;
};