feat(connection): add start and stop props closes #380

This commit is contained in:
moklick
2020-08-01 12:54:14 +02:00
parent 01271a1994
commit 5f91498d19
8 changed files with 105 additions and 11 deletions
+13 -3
View File
@@ -18,6 +18,8 @@ import {
Dimensions,
XYPosition,
OnConnectFunc,
OnConnectStartFunc,
OnConnectStopFunc,
SelectionRect,
HandleType,
SetConnectionId,
@@ -87,9 +89,13 @@ export interface StoreModel {
reactFlowVersion: string;
onConnect: OnConnectFunc;
onConnect?: OnConnectFunc;
onConnectStart?: OnConnectStartFunc;
onConnectStop?: OnConnectStopFunc;
setOnConnect: Action<StoreModel, OnConnectFunc>;
setOnConnectStart: Action<StoreModel, OnConnectStartFunc>;
setOnConnectStop: Action<StoreModel, OnConnectStopFunc>;
setElements: Action<StoreModel, Elements>;
@@ -177,11 +183,15 @@ export const storeModel: StoreModel = {
reactFlowVersion: typeof __REACT_FLOW_VERSION__ !== 'undefined' ? __REACT_FLOW_VERSION__ : '-',
onConnect: () => {},
setOnConnect: action((state, onConnect) => {
state.onConnect = onConnect;
}),
setOnConnectStart: action((state, onConnectStart) => {
state.onConnectStart = onConnectStart;
}),
setOnConnectStop: action((state, onConnectStop) => {
state.onConnectStop = onConnectStop;
}),
setElements: action((state, elements) => {
state.elements = elements;