@xyflow/react 12.9.0 → 12.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/additional-components/EdgeToolbar/types.d.ts +4 -0
- package/dist/esm/additional-components/EdgeToolbar/types.d.ts.map +1 -1
- package/dist/esm/components/StoreUpdater/index.d.ts +1 -1
- package/dist/esm/components/StoreUpdater/index.d.ts.map +1 -1
- package/dist/esm/container/FlowRenderer/index.d.ts.map +1 -1
- package/dist/esm/container/Pane/index.d.ts +2 -1
- package/dist/esm/container/Pane/index.d.ts.map +1 -1
- package/dist/esm/container/ReactFlow/index.d.ts.map +1 -1
- package/dist/esm/container/ZoomPane/index.d.ts +2 -2
- package/dist/esm/container/ZoomPane/index.d.ts.map +1 -1
- package/dist/esm/index.js +47 -48
- package/dist/esm/index.mjs +47 -48
- package/dist/esm/store/index.d.ts.map +1 -1
- package/dist/esm/types/instance.d.ts +10 -0
- package/dist/esm/types/instance.d.ts.map +1 -1
- package/dist/esm/types/store.d.ts +0 -1
- package/dist/esm/types/store.d.ts.map +1 -1
- package/dist/umd/additional-components/EdgeToolbar/types.d.ts +4 -0
- package/dist/umd/additional-components/EdgeToolbar/types.d.ts.map +1 -1
- package/dist/umd/components/StoreUpdater/index.d.ts +1 -1
- package/dist/umd/components/StoreUpdater/index.d.ts.map +1 -1
- package/dist/umd/container/FlowRenderer/index.d.ts.map +1 -1
- package/dist/umd/container/Pane/index.d.ts +2 -1
- package/dist/umd/container/Pane/index.d.ts.map +1 -1
- package/dist/umd/container/ReactFlow/index.d.ts.map +1 -1
- package/dist/umd/container/ZoomPane/index.d.ts +2 -2
- package/dist/umd/container/ZoomPane/index.d.ts.map +1 -1
- package/dist/umd/index.js +2 -2
- package/dist/umd/store/index.d.ts.map +1 -1
- package/dist/umd/types/instance.d.ts +10 -0
- package/dist/umd/types/instance.d.ts.map +1 -1
- package/dist/umd/types/store.d.ts +0 -1
- package/dist/umd/types/store.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -4,6 +4,10 @@ import type { EdgeToolbarBaseProps } from '@xyflow/system';
|
|
|
4
4
|
* @inline
|
|
5
5
|
*/
|
|
6
6
|
export type EdgeToolbarProps = EdgeToolbarBaseProps & HTMLAttributes<HTMLDivElement> & {
|
|
7
|
+
/**
|
|
8
|
+
* An edge toolbar must be attached to an edge.
|
|
9
|
+
*/
|
|
10
|
+
edgeId: string;
|
|
7
11
|
children?: ReactNode;
|
|
8
12
|
};
|
|
9
13
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/additional-components/EdgeToolbar/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GACjD,cAAc,CAAC,cAAc,CAAC,GAAG;IAC/B,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/additional-components/EdgeToolbar/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GACjD,cAAc,CAAC,cAAc,CAAC,GAAG;IAC/B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Node, Edge, ReactFlowProps } from '../../types';
|
|
2
|
-
declare const reactFlowFieldsToTrack: readonly ["nodes", "edges", "defaultNodes", "defaultEdges", "onConnect", "onConnectStart", "onConnectEnd", "onClickConnectStart", "onClickConnectEnd", "nodesDraggable", "autoPanOnNodeFocus", "nodesConnectable", "nodesFocusable", "edgesFocusable", "edgesReconnectable", "elevateNodesOnSelect", "elevateEdgesOnSelect", "minZoom", "maxZoom", "nodeExtent", "onNodesChange", "onEdgesChange", "elementsSelectable", "connectionMode", "snapGrid", "snapToGrid", "translateExtent", "connectOnClick", "defaultEdgeOptions", "fitView", "fitViewOptions", "onNodesDelete", "onEdgesDelete", "onDelete", "onNodeDrag", "onNodeDragStart", "onNodeDragStop", "onSelectionDrag", "onSelectionDragStart", "onSelectionDragStop", "onMoveStart", "onMove", "onMoveEnd", "noPanClassName", "nodeOrigin", "autoPanOnConnect", "autoPanOnNodeDrag", "onError", "connectionRadius", "isValidConnection", "selectNodesOnDrag", "nodeDragThreshold", "connectionDragThreshold", "onBeforeDelete", "debug", "autoPanSpeed", "
|
|
2
|
+
declare const reactFlowFieldsToTrack: readonly ["nodes", "edges", "defaultNodes", "defaultEdges", "onConnect", "onConnectStart", "onConnectEnd", "onClickConnectStart", "onClickConnectEnd", "nodesDraggable", "autoPanOnNodeFocus", "nodesConnectable", "nodesFocusable", "edgesFocusable", "edgesReconnectable", "elevateNodesOnSelect", "elevateEdgesOnSelect", "minZoom", "maxZoom", "nodeExtent", "onNodesChange", "onEdgesChange", "elementsSelectable", "connectionMode", "snapGrid", "snapToGrid", "translateExtent", "connectOnClick", "defaultEdgeOptions", "fitView", "fitViewOptions", "onNodesDelete", "onEdgesDelete", "onDelete", "onNodeDrag", "onNodeDragStart", "onNodeDragStop", "onSelectionDrag", "onSelectionDragStart", "onSelectionDragStop", "onMoveStart", "onMove", "onMoveEnd", "noPanClassName", "nodeOrigin", "autoPanOnConnect", "autoPanOnNodeDrag", "onError", "connectionRadius", "isValidConnection", "selectNodesOnDrag", "nodeDragThreshold", "connectionDragThreshold", "onBeforeDelete", "debug", "autoPanSpeed", "ariaLabelConfig"];
|
|
3
3
|
type ReactFlowFieldsToTrack = (typeof reactFlowFieldsToTrack)[number];
|
|
4
4
|
type StoreUpdaterProps<NodeType extends Node = Node, EdgeType extends Edge = Edge> = Pick<ReactFlowProps<NodeType, EdgeType>, ReactFlowFieldsToTrack> & {
|
|
5
5
|
rfId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/StoreUpdater/index.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAkB,cAAc,EAAkB,MAAM,aAAa,CAAC;AAI9F,QAAA,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/StoreUpdater/index.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAkB,cAAc,EAAkB,MAAM,aAAa,CAAC;AAI9F,QAAA,MAAM,sBAAsB,u+BA0DlB,CAAC;AAEX,KAAK,sBAAsB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AACtE,KAAK,iBAAiB,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI,IAAI,CACvF,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAClC,sBAAsB,CACvB,GAAG;IACF,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AA+BF,wBAAgB,YAAY,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,EACrF,KAAK,EAAE,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAyD7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/container/FlowRenderer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAK7C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAI9C,OAAO,KAAK,EAAkB,IAAI,EAAE,MAAM,aAAa,CAAC;AAExD,MAAM,MAAM,iBAAiB,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI,IAAI,CAChE,cAAc,CAAC,QAAQ,CAAC,EACtB,YAAY,GACZ,WAAW,GACX,WAAW,GACX,UAAU,GACV,oBAAoB,GACpB,8BAA8B,GAC9B,gBAAgB,GAChB,2BAA2B,GAC3B,mBAAmB,GACnB,oBAAoB,GACpB,MAAM,GACN,mBAAmB,CACtB,GAAG;IACF,oBAAoB,EAAE,OAAO,CAAC;IAC9B,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAQF,iBAAS,qBAAqB,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,EAC3D,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,WAAW,EAAE,YAAY,EACzB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,SAAS,EAAE,UAAU,EACrB,eAAe,EACf,eAAe,EACf,OAAO,EACP,OAAO,EACP,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,GACrB,EAAE,iBAAiB,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/container/FlowRenderer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAK7C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAI9C,OAAO,KAAK,EAAkB,IAAI,EAAE,MAAM,aAAa,CAAC;AAExD,MAAM,MAAM,iBAAiB,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI,IAAI,CAChE,cAAc,CAAC,QAAQ,CAAC,EACtB,YAAY,GACZ,WAAW,GACX,WAAW,GACX,UAAU,GACV,oBAAoB,GACpB,8BAA8B,GAC9B,gBAAgB,GAChB,2BAA2B,GAC3B,mBAAmB,GACnB,oBAAoB,GACpB,MAAM,GACN,mBAAmB,CACtB,GAAG;IACF,oBAAoB,EAAE,OAAO,CAAC;IAC9B,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAQF,iBAAS,qBAAqB,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,EAC3D,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,WAAW,EAAE,YAAY,EACzB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,SAAS,EAAE,UAAU,EACrB,eAAe,EACf,eAAe,EACf,OAAO,EACP,OAAO,EACP,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,GACrB,EAAE,iBAAiB,CAAC,QAAQ,CAAC,2CA+D7B;kBApGQ,qBAAqB;;;AAwG9B,eAAO,MAAM,YAAY,EAAkC,OAAO,qBAAqB,CAAC"}
|
|
@@ -4,7 +4,8 @@ type PaneProps = {
|
|
|
4
4
|
isSelecting: boolean;
|
|
5
5
|
selectionKeyPressed: boolean;
|
|
6
6
|
children: ReactNode;
|
|
7
|
+
paneClickDistance: number;
|
|
7
8
|
} & Partial<Pick<ReactFlowProps, 'selectionMode' | 'panOnDrag' | 'onSelectionStart' | 'onSelectionEnd' | 'onPaneClick' | 'onPaneContextMenu' | 'onPaneScroll' | 'onPaneMouseEnter' | 'onPaneMouseMove' | 'onPaneMouseLeave' | 'selectionOnDrag'>>;
|
|
8
|
-
export declare function Pane({ isSelecting, selectionKeyPressed, selectionMode, panOnDrag, selectionOnDrag, onSelectionStart, onSelectionEnd, onPaneClick, onPaneContextMenu, onPaneScroll, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, children, }: PaneProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function Pane({ isSelecting, selectionKeyPressed, selectionMode, panOnDrag, paneClickDistance, selectionOnDrag, onSelectionStart, onSelectionEnd, onPaneClick, onPaneContextMenu, onPaneScroll, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, children, }: PaneProps): import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
export {};
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/container/Pane/index.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/container/Pane/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AASf,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,aAAa,CAAC;AAElE,KAAK,SAAS,GAAG;IACf,WAAW,EAAE,OAAO,CAAC;IACrB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,QAAQ,EAAE,SAAS,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,GAAG,OAAO,CACT,IAAI,CACF,cAAc,EACZ,eAAe,GACf,WAAW,GACX,kBAAkB,GAClB,gBAAgB,GAChB,aAAa,GACb,mBAAmB,GACnB,cAAc,GACd,kBAAkB,GAClB,iBAAiB,GACjB,kBAAkB,GAClB,iBAAiB,CACpB,CACF,CAAC;AAqBF,wBAAgB,IAAI,CAAC,EACnB,WAAW,EACX,mBAAmB,EACnB,aAAkC,EAClC,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,QAAQ,GACT,EAAE,SAAS,2CA+NX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/container/ReactFlow/index.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/container/ReactFlow/index.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAwT9D;;;;;;;;;;;;;;;;;;;GAmBG;yBA/TgB,QAAQ,SAAS,IAAI,SAAS,QAAQ,SAAS,IAAI;AAgUtE,wBAA0C"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FlowRendererProps } from '../FlowRenderer';
|
|
2
|
-
type ZoomPaneProps = Omit<FlowRendererProps, 'deleteKeyCode' | 'selectionKeyCode' | 'multiSelectionKeyCode' | 'noDragClassName' | 'disableKeyboardA11y'
|
|
2
|
+
type ZoomPaneProps = Omit<FlowRendererProps, 'deleteKeyCode' | 'selectionKeyCode' | 'multiSelectionKeyCode' | 'noDragClassName' | 'disableKeyboardA11y'> & {
|
|
3
3
|
isControlledViewport: boolean;
|
|
4
4
|
};
|
|
5
|
-
export declare function ZoomPane({ onPaneContextMenu, zoomOnScroll, zoomOnPinch, panOnScroll, panOnScrollSpeed, panOnScrollMode, zoomOnDoubleClick, panOnDrag, defaultViewport, translateExtent, minZoom, maxZoom, zoomActivationKeyCode, preventScrolling, children, noWheelClassName, noPanClassName, onViewportChange, isControlledViewport, paneClickDistance, }: ZoomPaneProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function ZoomPane({ onPaneContextMenu, zoomOnScroll, zoomOnPinch, panOnScroll, panOnScrollSpeed, panOnScrollMode, zoomOnDoubleClick, panOnDrag, defaultViewport, translateExtent, minZoom, maxZoom, zoomActivationKeyCode, preventScrolling, children, noWheelClassName, noPanClassName, onViewportChange, isControlledViewport, paneClickDistance, selectionOnDrag, }: ZoomPaneProps): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export {};
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/container/ZoomPane/index.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGzD,KAAK,aAAa,GAAG,IAAI,CACvB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/container/ZoomPane/index.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGzD,KAAK,aAAa,GAAG,IAAI,CACvB,iBAAiB,EACjB,eAAe,GAAG,kBAAkB,GAAG,uBAAuB,GAAG,iBAAiB,GAAG,qBAAqB,CAC3G,GAAG;IACF,oBAAoB,EAAE,OAAO,CAAC;CAC/B,CAAC;AAQF,wBAAgB,QAAQ,CAAC,EACvB,iBAAiB,EACjB,YAAmB,EACnB,WAAkB,EAClB,WAAmB,EACnB,gBAAsB,EACtB,eAAsC,EACtC,iBAAwB,EACxB,SAAgB,EAChB,eAAe,EACf,eAAe,EACf,OAAO,EACP,OAAO,EACP,qBAAqB,EACrB,gBAAuB,EACvB,QAAQ,EACR,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,GAChB,EAAE,aAAa,2CA2Gf"}
|
package/dist/esm/index.js
CHANGED
|
@@ -238,7 +238,6 @@ const reactFlowFieldsToTrack = [
|
|
|
238
238
|
'onBeforeDelete',
|
|
239
239
|
'debug',
|
|
240
240
|
'autoPanSpeed',
|
|
241
|
-
'paneClickDistance',
|
|
242
241
|
'ariaLabelConfig',
|
|
243
242
|
];
|
|
244
243
|
// rfId doesn't exist in ReactFlowProps, but it's one of the fields we want to update
|
|
@@ -252,7 +251,6 @@ const selector$l = (s) => ({
|
|
|
252
251
|
setNodeExtent: s.setNodeExtent,
|
|
253
252
|
reset: s.reset,
|
|
254
253
|
setDefaultNodesAndEdges: s.setDefaultNodesAndEdges,
|
|
255
|
-
setPaneClickDistance: s.setPaneClickDistance,
|
|
256
254
|
});
|
|
257
255
|
const initPrevValues = {
|
|
258
256
|
/*
|
|
@@ -267,10 +265,9 @@ const initPrevValues = {
|
|
|
267
265
|
elementsSelectable: true,
|
|
268
266
|
noPanClassName: 'nopan',
|
|
269
267
|
rfId: '1',
|
|
270
|
-
paneClickDistance: 0,
|
|
271
268
|
};
|
|
272
269
|
function StoreUpdater(props) {
|
|
273
|
-
const { setNodes, setEdges, setMinZoom, setMaxZoom, setTranslateExtent, setNodeExtent, reset, setDefaultNodesAndEdges,
|
|
270
|
+
const { setNodes, setEdges, setMinZoom, setMaxZoom, setTranslateExtent, setNodeExtent, reset, setDefaultNodesAndEdges, } = useStore(selector$l, shallow);
|
|
274
271
|
const store = useStoreApi();
|
|
275
272
|
useEffect(() => {
|
|
276
273
|
setDefaultNodesAndEdges(props.defaultNodes, props.defaultEdges);
|
|
@@ -302,8 +299,6 @@ function StoreUpdater(props) {
|
|
|
302
299
|
setTranslateExtent(fieldValue);
|
|
303
300
|
else if (fieldName === 'nodeExtent')
|
|
304
301
|
setNodeExtent(fieldValue);
|
|
305
|
-
else if (fieldName === 'paneClickDistance')
|
|
306
|
-
setPaneClickDistance(fieldValue);
|
|
307
302
|
else if (fieldName === 'ariaLabelConfig')
|
|
308
303
|
store.setState({ ariaLabelConfig: mergeAriaLabelConfig(fieldValue) });
|
|
309
304
|
// Renamed fields
|
|
@@ -1281,7 +1276,7 @@ const selector$j = (s) => ({
|
|
|
1281
1276
|
lib: s.lib,
|
|
1282
1277
|
connectionInProgress: s.connection.inProgress,
|
|
1283
1278
|
});
|
|
1284
|
-
function ZoomPane({ onPaneContextMenu, zoomOnScroll = true, zoomOnPinch = true, panOnScroll = false, panOnScrollSpeed = 0.5, panOnScrollMode = PanOnScrollMode.Free, zoomOnDoubleClick = true, panOnDrag = true, defaultViewport, translateExtent, minZoom, maxZoom, zoomActivationKeyCode, preventScrolling = true, children, noWheelClassName, noPanClassName, onViewportChange, isControlledViewport, paneClickDistance, }) {
|
|
1279
|
+
function ZoomPane({ onPaneContextMenu, zoomOnScroll = true, zoomOnPinch = true, panOnScroll = false, panOnScrollSpeed = 0.5, panOnScrollMode = PanOnScrollMode.Free, zoomOnDoubleClick = true, panOnDrag = true, defaultViewport, translateExtent, minZoom, maxZoom, zoomActivationKeyCode, preventScrolling = true, children, noWheelClassName, noPanClassName, onViewportChange, isControlledViewport, paneClickDistance, selectionOnDrag, }) {
|
|
1285
1280
|
const store = useStoreApi();
|
|
1286
1281
|
const zoomPane = useRef(null);
|
|
1287
1282
|
const { userSelectionActive, lib, connectionInProgress } = useStore(selector$j, shallow);
|
|
@@ -1302,7 +1297,6 @@ function ZoomPane({ onPaneContextMenu, zoomOnScroll = true, zoomOnPinch = true,
|
|
|
1302
1297
|
maxZoom,
|
|
1303
1298
|
translateExtent,
|
|
1304
1299
|
viewport: defaultViewport,
|
|
1305
|
-
paneClickDistance,
|
|
1306
1300
|
onDraggingChange: (paneDragging) => store.setState({ paneDragging }),
|
|
1307
1301
|
onPanZoomStart: (event, vp) => {
|
|
1308
1302
|
const { onViewportChangeStart, onMoveStart } = store.getState();
|
|
@@ -1349,6 +1343,8 @@ function ZoomPane({ onPaneContextMenu, zoomOnScroll = true, zoomOnPinch = true,
|
|
|
1349
1343
|
lib,
|
|
1350
1344
|
onTransformChange,
|
|
1351
1345
|
connectionInProgress,
|
|
1346
|
+
selectionOnDrag,
|
|
1347
|
+
paneClickDistance,
|
|
1352
1348
|
});
|
|
1353
1349
|
}, [
|
|
1354
1350
|
onPaneContextMenu,
|
|
@@ -1367,6 +1363,8 @@ function ZoomPane({ onPaneContextMenu, zoomOnScroll = true, zoomOnPinch = true,
|
|
|
1367
1363
|
lib,
|
|
1368
1364
|
onTransformChange,
|
|
1369
1365
|
connectionInProgress,
|
|
1366
|
+
selectionOnDrag,
|
|
1367
|
+
paneClickDistance,
|
|
1370
1368
|
]);
|
|
1371
1369
|
return (jsx("div", { className: "react-flow__renderer", ref: zoomPane, style: containerStyle, children: children }));
|
|
1372
1370
|
}
|
|
@@ -1402,17 +1400,16 @@ const selector$h = (s) => ({
|
|
|
1402
1400
|
connectionInProgress: s.connection.inProgress,
|
|
1403
1401
|
dragging: s.paneDragging,
|
|
1404
1402
|
});
|
|
1405
|
-
function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.Full, panOnDrag, selectionOnDrag, onSelectionStart, onSelectionEnd, onPaneClick, onPaneContextMenu, onPaneScroll, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, children, }) {
|
|
1403
|
+
function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.Full, panOnDrag, paneClickDistance, selectionOnDrag, onSelectionStart, onSelectionEnd, onPaneClick, onPaneContextMenu, onPaneScroll, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, children, }) {
|
|
1406
1404
|
const store = useStoreApi();
|
|
1407
1405
|
const { userSelectionActive, elementsSelectable, dragging, connectionInProgress } = useStore(selector$h, shallow);
|
|
1408
|
-
const
|
|
1406
|
+
const isSelectionEnabled = elementsSelectable && (isSelecting || userSelectionActive);
|
|
1409
1407
|
const container = useRef(null);
|
|
1410
1408
|
const containerBounds = useRef();
|
|
1411
1409
|
const selectedNodeIds = useRef(new Set());
|
|
1412
1410
|
const selectedEdgeIds = useRef(new Set());
|
|
1413
1411
|
// Used to prevent click events when the user lets go of the selectionKey during a selection
|
|
1414
1412
|
const selectionInProgress = useRef(false);
|
|
1415
|
-
const selectionStarted = useRef(false);
|
|
1416
1413
|
const onClick = (event) => {
|
|
1417
1414
|
// We prevent click events when the user let go of the selectionKey during a selection
|
|
1418
1415
|
// We also prevent click events when a connection is in progress
|
|
@@ -1433,35 +1430,28 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
1433
1430
|
};
|
|
1434
1431
|
const onWheel = onPaneScroll ? (event) => onPaneScroll(event) : undefined;
|
|
1435
1432
|
const onClickCapture = (event) => {
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1433
|
+
if (selectionInProgress.current) {
|
|
1434
|
+
event.stopPropagation();
|
|
1435
|
+
selectionInProgress.current = false;
|
|
1439
1436
|
}
|
|
1440
|
-
event.stopPropagation();
|
|
1441
1437
|
};
|
|
1442
1438
|
// We are using capture here in order to prevent other pointer events
|
|
1443
1439
|
// to be able to create a selection above a node or an edge
|
|
1444
1440
|
const onPointerDownCapture = (event) => {
|
|
1445
1441
|
const { resetSelectedElements, domNode } = store.getState();
|
|
1446
1442
|
containerBounds.current = domNode?.getBoundingClientRect();
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
!isSelectionActive ||
|
|
1455
|
-
!event.isPrimary) {
|
|
1443
|
+
if (!containerBounds.current)
|
|
1444
|
+
return;
|
|
1445
|
+
const eventTargetIsContainer = event.target === container.current;
|
|
1446
|
+
// if a child element has the 'nokey' class, we don't want to swallow the event and don't start a selection
|
|
1447
|
+
const isNoKeyEvent = !eventTargetIsContainer && !!event.target.closest('.nokey');
|
|
1448
|
+
const isSelectionActive = (selectionOnDrag && eventTargetIsContainer) || selectionKeyPressed;
|
|
1449
|
+
if (isNoKeyEvent || !isSelecting || !isSelectionActive || event.button !== 0 || !event.isPrimary) {
|
|
1456
1450
|
return;
|
|
1457
1451
|
}
|
|
1458
|
-
event.stopPropagation();
|
|
1459
|
-
event.preventDefault();
|
|
1460
1452
|
event.target?.setPointerCapture?.(event.pointerId);
|
|
1461
|
-
selectionStarted.current = true;
|
|
1462
1453
|
selectionInProgress.current = false;
|
|
1463
1454
|
const { x, y } = getEventPosition(event.nativeEvent, containerBounds.current);
|
|
1464
|
-
resetSelectedElements();
|
|
1465
1455
|
store.setState({
|
|
1466
1456
|
userSelectionRect: {
|
|
1467
1457
|
width: 0,
|
|
@@ -1472,16 +1462,35 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
1472
1462
|
y,
|
|
1473
1463
|
},
|
|
1474
1464
|
});
|
|
1475
|
-
|
|
1465
|
+
if (!eventTargetIsContainer) {
|
|
1466
|
+
event.stopPropagation();
|
|
1467
|
+
event.preventDefault();
|
|
1468
|
+
}
|
|
1469
|
+
if (paneClickDistance === 0 || selectionKeyPressed) {
|
|
1470
|
+
resetSelectedElements();
|
|
1471
|
+
onSelectionStart?.(event);
|
|
1472
|
+
selectionInProgress.current = true;
|
|
1473
|
+
}
|
|
1476
1474
|
};
|
|
1477
1475
|
const onPointerMove = (event) => {
|
|
1478
|
-
const { userSelectionRect, transform, nodeLookup, edgeLookup, connectionLookup, triggerNodeChanges, triggerEdgeChanges, defaultEdgeOptions, } = store.getState();
|
|
1476
|
+
const { userSelectionRect, transform, nodeLookup, edgeLookup, connectionLookup, triggerNodeChanges, triggerEdgeChanges, defaultEdgeOptions, resetSelectedElements, } = store.getState();
|
|
1479
1477
|
if (!containerBounds.current || !userSelectionRect) {
|
|
1480
1478
|
return;
|
|
1481
1479
|
}
|
|
1482
|
-
selectionInProgress.current = true;
|
|
1483
1480
|
const { x: mouseX, y: mouseY } = getEventPosition(event.nativeEvent, containerBounds.current);
|
|
1484
1481
|
const { startX, startY } = userSelectionRect;
|
|
1482
|
+
if (!selectionInProgress.current &&
|
|
1483
|
+
event.target === container.current &&
|
|
1484
|
+
!selectionKeyPressed &&
|
|
1485
|
+
paneClickDistance > 0) {
|
|
1486
|
+
const distance = Math.hypot(mouseX - startX, mouseY - startY);
|
|
1487
|
+
if (distance <= paneClickDistance) {
|
|
1488
|
+
return;
|
|
1489
|
+
}
|
|
1490
|
+
resetSelectedElements();
|
|
1491
|
+
onSelectionStart?.(event);
|
|
1492
|
+
}
|
|
1493
|
+
selectionInProgress.current = true;
|
|
1485
1494
|
const nextUserSelectRect = {
|
|
1486
1495
|
startX,
|
|
1487
1496
|
startY,
|
|
@@ -1522,16 +1531,15 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
1522
1531
|
});
|
|
1523
1532
|
};
|
|
1524
1533
|
const onPointerUp = (event) => {
|
|
1525
|
-
if (event.button !== 0
|
|
1534
|
+
if (event.button !== 0) {
|
|
1526
1535
|
return;
|
|
1527
1536
|
}
|
|
1528
1537
|
event.target?.releasePointerCapture?.(event.pointerId);
|
|
1529
|
-
const { userSelectionRect } = store.getState();
|
|
1530
1538
|
/*
|
|
1531
1539
|
* We only want to trigger click functions when in selection mode if
|
|
1532
1540
|
* the user did not move the mouse.
|
|
1533
1541
|
*/
|
|
1534
|
-
if (!userSelectionActive &&
|
|
1542
|
+
if (!userSelectionActive && event.target === container.current && store.getState().userSelectionRect) {
|
|
1535
1543
|
onClick?.(event);
|
|
1536
1544
|
}
|
|
1537
1545
|
store.setState({
|
|
@@ -1539,18 +1547,12 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
1539
1547
|
userSelectionRect: null,
|
|
1540
1548
|
nodesSelectionActive: selectedNodeIds.current.size > 0,
|
|
1541
1549
|
});
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
* If the user kept holding the selectionKey during the selection,
|
|
1545
|
-
* we need to reset the selectionInProgress, so the next click event is not prevented
|
|
1546
|
-
*/
|
|
1547
|
-
if (selectionKeyPressed || selectionOnDrag) {
|
|
1548
|
-
selectionInProgress.current = false;
|
|
1550
|
+
if (selectionInProgress.current) {
|
|
1551
|
+
onSelectionEnd?.(event);
|
|
1549
1552
|
}
|
|
1550
|
-
selectionStarted.current = false;
|
|
1551
1553
|
};
|
|
1552
1554
|
const draggable = panOnDrag === true || (Array.isArray(panOnDrag) && panOnDrag.includes(0));
|
|
1553
|
-
return (jsxs("div", { className: cc(['react-flow__pane', { draggable, dragging, selection: isSelecting }]), onClick:
|
|
1555
|
+
return (jsxs("div", { className: cc(['react-flow__pane', { draggable, dragging, selection: isSelecting }]), onClick: isSelectionEnabled ? undefined : wrapHandler(onClick, container), onContextMenu: wrapHandler(onContextMenu, container), onWheel: wrapHandler(onWheel, container), onPointerEnter: isSelectionEnabled ? undefined : onPaneMouseEnter, onPointerMove: isSelectionEnabled ? onPointerMove : onPaneMouseMove, onPointerUp: isSelectionEnabled ? onPointerUp : undefined, onPointerDownCapture: isSelectionEnabled ? onPointerDownCapture : undefined, onClickCapture: isSelectionEnabled ? onClickCapture : undefined, onPointerLeave: onPaneMouseLeave, ref: container, style: containerStyle, children: [children, jsx(UserSelection, {})] }));
|
|
1554
1556
|
}
|
|
1555
1557
|
|
|
1556
1558
|
/*
|
|
@@ -1989,7 +1991,7 @@ function FlowRendererComponent({ children, onPaneClick, onPaneMouseEnter, onPane
|
|
|
1989
1991
|
const _selectionOnDrag = selectionOnDrag && panOnDrag !== true;
|
|
1990
1992
|
const isSelecting = selectionKeyPressed || userSelectionActive || _selectionOnDrag;
|
|
1991
1993
|
useGlobalKeyHandler({ deleteKeyCode, multiSelectionKeyCode });
|
|
1992
|
-
return (jsx(ZoomPane, { onPaneContextMenu: onPaneContextMenu, elementsSelectable: elementsSelectable, zoomOnScroll: zoomOnScroll, zoomOnPinch: zoomOnPinch, panOnScroll: panOnScroll, panOnScrollSpeed: panOnScrollSpeed, panOnScrollMode: panOnScrollMode, zoomOnDoubleClick: zoomOnDoubleClick, panOnDrag: !selectionKeyPressed && panOnDrag, defaultViewport: defaultViewport, translateExtent: translateExtent, minZoom: minZoom, maxZoom: maxZoom, zoomActivationKeyCode: zoomActivationKeyCode, preventScrolling: preventScrolling, noWheelClassName: noWheelClassName, noPanClassName: noPanClassName, onViewportChange: onViewportChange, isControlledViewport: isControlledViewport, paneClickDistance: paneClickDistance, children: jsxs(Pane, { onSelectionStart: onSelectionStart, onSelectionEnd: onSelectionEnd, onPaneClick: onPaneClick, onPaneMouseEnter: onPaneMouseEnter, onPaneMouseMove: onPaneMouseMove, onPaneMouseLeave: onPaneMouseLeave, onPaneContextMenu: onPaneContextMenu, onPaneScroll: onPaneScroll, panOnDrag: panOnDrag, isSelecting: !!isSelecting, selectionMode: selectionMode, selectionKeyPressed: selectionKeyPressed, selectionOnDrag: _selectionOnDrag, children: [children, nodesSelectionActive && (jsx(NodesSelection, { onSelectionContextMenu: onSelectionContextMenu, noPanClassName: noPanClassName, disableKeyboardA11y: disableKeyboardA11y }))] }) }));
|
|
1994
|
+
return (jsx(ZoomPane, { onPaneContextMenu: onPaneContextMenu, elementsSelectable: elementsSelectable, zoomOnScroll: zoomOnScroll, zoomOnPinch: zoomOnPinch, panOnScroll: panOnScroll, panOnScrollSpeed: panOnScrollSpeed, panOnScrollMode: panOnScrollMode, zoomOnDoubleClick: zoomOnDoubleClick, panOnDrag: !selectionKeyPressed && panOnDrag, defaultViewport: defaultViewport, translateExtent: translateExtent, minZoom: minZoom, maxZoom: maxZoom, zoomActivationKeyCode: zoomActivationKeyCode, preventScrolling: preventScrolling, noWheelClassName: noWheelClassName, noPanClassName: noPanClassName, onViewportChange: onViewportChange, isControlledViewport: isControlledViewport, paneClickDistance: paneClickDistance, selectionOnDrag: _selectionOnDrag, children: jsxs(Pane, { onSelectionStart: onSelectionStart, onSelectionEnd: onSelectionEnd, onPaneClick: onPaneClick, onPaneMouseEnter: onPaneMouseEnter, onPaneMouseMove: onPaneMouseMove, onPaneMouseLeave: onPaneMouseLeave, onPaneContextMenu: onPaneContextMenu, onPaneScroll: onPaneScroll, panOnDrag: panOnDrag, isSelecting: !!isSelecting, selectionMode: selectionMode, selectionKeyPressed: selectionKeyPressed, paneClickDistance: paneClickDistance, selectionOnDrag: _selectionOnDrag, children: [children, nodesSelectionActive && (jsx(NodesSelection, { onSelectionContextMenu: onSelectionContextMenu, noPanClassName: noPanClassName, disableKeyboardA11y: disableKeyboardA11y }))] }) }));
|
|
1993
1995
|
}
|
|
1994
1996
|
FlowRendererComponent.displayName = 'FlowRenderer';
|
|
1995
1997
|
const FlowRenderer = memo(FlowRendererComponent);
|
|
@@ -3431,9 +3433,6 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
|
|
|
3431
3433
|
get().panZoom?.setTranslateExtent(translateExtent);
|
|
3432
3434
|
set({ translateExtent });
|
|
3433
3435
|
},
|
|
3434
|
-
setPaneClickDistance: (clickDistance) => {
|
|
3435
|
-
get().panZoom?.setClickDistance(clickDistance);
|
|
3436
|
-
},
|
|
3437
3436
|
resetSelectedElements: () => {
|
|
3438
3437
|
const { edges, nodes, triggerNodeChanges, triggerEdgeChanges, elementsSelectable } = get();
|
|
3439
3438
|
if (!elementsSelectable) {
|
|
@@ -3568,7 +3567,7 @@ function ReactFlow({ nodes, edges, defaultNodes, defaultEdges, className, nodeTy
|
|
|
3568
3567
|
e.currentTarget.scrollTo({ top: 0, left: 0, behavior: 'instant' });
|
|
3569
3568
|
onScroll?.(e);
|
|
3570
3569
|
}, [onScroll]);
|
|
3571
|
-
return (jsx("div", { "data-testid": "rf__wrapper", ...rest, onScroll: wrapperOnScroll, style: { ...style, ...wrapperStyle }, ref: ref, className: cc(['react-flow', className, colorModeClassName]), id: id, role: "application", children: jsxs(Wrapper, { nodes: nodes, edges: edges, width: width, height: height, fitView: fitView, fitViewOptions: fitViewOptions, minZoom: minZoom, maxZoom: maxZoom, nodeOrigin: nodeOrigin, nodeExtent: nodeExtent, children: [jsx(GraphView, { onInit: onInit, onNodeClick: onNodeClick, onEdgeClick: onEdgeClick, onNodeMouseEnter: onNodeMouseEnter, onNodeMouseMove: onNodeMouseMove, onNodeMouseLeave: onNodeMouseLeave, onNodeContextMenu: onNodeContextMenu, onNodeDoubleClick: onNodeDoubleClick, nodeTypes: nodeTypes, edgeTypes: edgeTypes, connectionLineType: connectionLineType, connectionLineStyle: connectionLineStyle, connectionLineComponent: connectionLineComponent, connectionLineContainerStyle: connectionLineContainerStyle, selectionKeyCode: selectionKeyCode, selectionOnDrag: selectionOnDrag, selectionMode: selectionMode, deleteKeyCode: deleteKeyCode, multiSelectionKeyCode: multiSelectionKeyCode, panActivationKeyCode: panActivationKeyCode, zoomActivationKeyCode: zoomActivationKeyCode, onlyRenderVisibleElements: onlyRenderVisibleElements, defaultViewport: defaultViewport$1, translateExtent: translateExtent, minZoom: minZoom, maxZoom: maxZoom, preventScrolling: preventScrolling, zoomOnScroll: zoomOnScroll, zoomOnPinch: zoomOnPinch, zoomOnDoubleClick: zoomOnDoubleClick, panOnScroll: panOnScroll, panOnScrollSpeed: panOnScrollSpeed, panOnScrollMode: panOnScrollMode, panOnDrag: panOnDrag, onPaneClick: onPaneClick, onPaneMouseEnter: onPaneMouseEnter, onPaneMouseMove: onPaneMouseMove, onPaneMouseLeave: onPaneMouseLeave, onPaneScroll: onPaneScroll, onPaneContextMenu: onPaneContextMenu, paneClickDistance: paneClickDistance, nodeClickDistance: nodeClickDistance, onSelectionContextMenu: onSelectionContextMenu, onSelectionStart: onSelectionStart, onSelectionEnd: onSelectionEnd, onReconnect: onReconnect, onReconnectStart: onReconnectStart, onReconnectEnd: onReconnectEnd, onEdgeContextMenu: onEdgeContextMenu, onEdgeDoubleClick: onEdgeDoubleClick, onEdgeMouseEnter: onEdgeMouseEnter, onEdgeMouseMove: onEdgeMouseMove, onEdgeMouseLeave: onEdgeMouseLeave, reconnectRadius: reconnectRadius, defaultMarkerColor: defaultMarkerColor, noDragClassName: noDragClassName, noWheelClassName: noWheelClassName, noPanClassName: noPanClassName, rfId: rfId, disableKeyboardA11y: disableKeyboardA11y, nodeExtent: nodeExtent, viewport: viewport, onViewportChange: onViewportChange }), jsx(StoreUpdater, { nodes: nodes, edges: edges, defaultNodes: defaultNodes, defaultEdges: defaultEdges, onConnect: onConnect, onConnectStart: onConnectStart, onConnectEnd: onConnectEnd, onClickConnectStart: onClickConnectStart, onClickConnectEnd: onClickConnectEnd, nodesDraggable: nodesDraggable, autoPanOnNodeFocus: autoPanOnNodeFocus, nodesConnectable: nodesConnectable, nodesFocusable: nodesFocusable, edgesFocusable: edgesFocusable, edgesReconnectable: edgesReconnectable, elementsSelectable: elementsSelectable, elevateNodesOnSelect: elevateNodesOnSelect, elevateEdgesOnSelect: elevateEdgesOnSelect, minZoom: minZoom, maxZoom: maxZoom, nodeExtent: nodeExtent, onNodesChange: onNodesChange, onEdgesChange: onEdgesChange, snapToGrid: snapToGrid, snapGrid: snapGrid, connectionMode: connectionMode, translateExtent: translateExtent, connectOnClick: connectOnClick, defaultEdgeOptions: defaultEdgeOptions, fitView: fitView, fitViewOptions: fitViewOptions, onNodesDelete: onNodesDelete, onEdgesDelete: onEdgesDelete, onDelete: onDelete, onNodeDragStart: onNodeDragStart, onNodeDrag: onNodeDrag, onNodeDragStop: onNodeDragStop, onSelectionDrag: onSelectionDrag, onSelectionDragStart: onSelectionDragStart, onSelectionDragStop: onSelectionDragStop, onMove: onMove, onMoveStart: onMoveStart, onMoveEnd: onMoveEnd, noPanClassName: noPanClassName, nodeOrigin: nodeOrigin, rfId: rfId, autoPanOnConnect: autoPanOnConnect, autoPanOnNodeDrag: autoPanOnNodeDrag, autoPanSpeed: autoPanSpeed, onError: onError, connectionRadius: connectionRadius, isValidConnection: isValidConnection, selectNodesOnDrag: selectNodesOnDrag, nodeDragThreshold: nodeDragThreshold, connectionDragThreshold: connectionDragThreshold, onBeforeDelete: onBeforeDelete,
|
|
3570
|
+
return (jsx("div", { "data-testid": "rf__wrapper", ...rest, onScroll: wrapperOnScroll, style: { ...style, ...wrapperStyle }, ref: ref, className: cc(['react-flow', className, colorModeClassName]), id: id, role: "application", children: jsxs(Wrapper, { nodes: nodes, edges: edges, width: width, height: height, fitView: fitView, fitViewOptions: fitViewOptions, minZoom: minZoom, maxZoom: maxZoom, nodeOrigin: nodeOrigin, nodeExtent: nodeExtent, children: [jsx(GraphView, { onInit: onInit, onNodeClick: onNodeClick, onEdgeClick: onEdgeClick, onNodeMouseEnter: onNodeMouseEnter, onNodeMouseMove: onNodeMouseMove, onNodeMouseLeave: onNodeMouseLeave, onNodeContextMenu: onNodeContextMenu, onNodeDoubleClick: onNodeDoubleClick, nodeTypes: nodeTypes, edgeTypes: edgeTypes, connectionLineType: connectionLineType, connectionLineStyle: connectionLineStyle, connectionLineComponent: connectionLineComponent, connectionLineContainerStyle: connectionLineContainerStyle, selectionKeyCode: selectionKeyCode, selectionOnDrag: selectionOnDrag, selectionMode: selectionMode, deleteKeyCode: deleteKeyCode, multiSelectionKeyCode: multiSelectionKeyCode, panActivationKeyCode: panActivationKeyCode, zoomActivationKeyCode: zoomActivationKeyCode, onlyRenderVisibleElements: onlyRenderVisibleElements, defaultViewport: defaultViewport$1, translateExtent: translateExtent, minZoom: minZoom, maxZoom: maxZoom, preventScrolling: preventScrolling, zoomOnScroll: zoomOnScroll, zoomOnPinch: zoomOnPinch, zoomOnDoubleClick: zoomOnDoubleClick, panOnScroll: panOnScroll, panOnScrollSpeed: panOnScrollSpeed, panOnScrollMode: panOnScrollMode, panOnDrag: panOnDrag, onPaneClick: onPaneClick, onPaneMouseEnter: onPaneMouseEnter, onPaneMouseMove: onPaneMouseMove, onPaneMouseLeave: onPaneMouseLeave, onPaneScroll: onPaneScroll, onPaneContextMenu: onPaneContextMenu, paneClickDistance: paneClickDistance, nodeClickDistance: nodeClickDistance, onSelectionContextMenu: onSelectionContextMenu, onSelectionStart: onSelectionStart, onSelectionEnd: onSelectionEnd, onReconnect: onReconnect, onReconnectStart: onReconnectStart, onReconnectEnd: onReconnectEnd, onEdgeContextMenu: onEdgeContextMenu, onEdgeDoubleClick: onEdgeDoubleClick, onEdgeMouseEnter: onEdgeMouseEnter, onEdgeMouseMove: onEdgeMouseMove, onEdgeMouseLeave: onEdgeMouseLeave, reconnectRadius: reconnectRadius, defaultMarkerColor: defaultMarkerColor, noDragClassName: noDragClassName, noWheelClassName: noWheelClassName, noPanClassName: noPanClassName, rfId: rfId, disableKeyboardA11y: disableKeyboardA11y, nodeExtent: nodeExtent, viewport: viewport, onViewportChange: onViewportChange }), jsx(StoreUpdater, { nodes: nodes, edges: edges, defaultNodes: defaultNodes, defaultEdges: defaultEdges, onConnect: onConnect, onConnectStart: onConnectStart, onConnectEnd: onConnectEnd, onClickConnectStart: onClickConnectStart, onClickConnectEnd: onClickConnectEnd, nodesDraggable: nodesDraggable, autoPanOnNodeFocus: autoPanOnNodeFocus, nodesConnectable: nodesConnectable, nodesFocusable: nodesFocusable, edgesFocusable: edgesFocusable, edgesReconnectable: edgesReconnectable, elementsSelectable: elementsSelectable, elevateNodesOnSelect: elevateNodesOnSelect, elevateEdgesOnSelect: elevateEdgesOnSelect, minZoom: minZoom, maxZoom: maxZoom, nodeExtent: nodeExtent, onNodesChange: onNodesChange, onEdgesChange: onEdgesChange, snapToGrid: snapToGrid, snapGrid: snapGrid, connectionMode: connectionMode, translateExtent: translateExtent, connectOnClick: connectOnClick, defaultEdgeOptions: defaultEdgeOptions, fitView: fitView, fitViewOptions: fitViewOptions, onNodesDelete: onNodesDelete, onEdgesDelete: onEdgesDelete, onDelete: onDelete, onNodeDragStart: onNodeDragStart, onNodeDrag: onNodeDrag, onNodeDragStop: onNodeDragStop, onSelectionDrag: onSelectionDrag, onSelectionDragStart: onSelectionDragStart, onSelectionDragStop: onSelectionDragStop, onMove: onMove, onMoveStart: onMoveStart, onMoveEnd: onMoveEnd, noPanClassName: noPanClassName, nodeOrigin: nodeOrigin, rfId: rfId, autoPanOnConnect: autoPanOnConnect, autoPanOnNodeDrag: autoPanOnNodeDrag, autoPanSpeed: autoPanSpeed, onError: onError, connectionRadius: connectionRadius, isValidConnection: isValidConnection, selectNodesOnDrag: selectNodesOnDrag, nodeDragThreshold: nodeDragThreshold, connectionDragThreshold: connectionDragThreshold, onBeforeDelete: onBeforeDelete, debug: debug, ariaLabelConfig: ariaLabelConfig }), jsx(SelectionListener, { onSelectionChange: onSelectionChange }), children, jsx(Attribution, { proOptions: proOptions, position: attributionPosition }), jsx(A11yDescriptions, { rfId: rfId, disableKeyboardA11y: disableKeyboardA11y })] }) }));
|
|
3572
3571
|
}
|
|
3573
3572
|
/**
|
|
3574
3573
|
* The `<ReactFlow />` component is the heart of your React Flow application.
|
package/dist/esm/index.mjs
CHANGED
|
@@ -238,7 +238,6 @@ const reactFlowFieldsToTrack = [
|
|
|
238
238
|
'onBeforeDelete',
|
|
239
239
|
'debug',
|
|
240
240
|
'autoPanSpeed',
|
|
241
|
-
'paneClickDistance',
|
|
242
241
|
'ariaLabelConfig',
|
|
243
242
|
];
|
|
244
243
|
// rfId doesn't exist in ReactFlowProps, but it's one of the fields we want to update
|
|
@@ -252,7 +251,6 @@ const selector$l = (s) => ({
|
|
|
252
251
|
setNodeExtent: s.setNodeExtent,
|
|
253
252
|
reset: s.reset,
|
|
254
253
|
setDefaultNodesAndEdges: s.setDefaultNodesAndEdges,
|
|
255
|
-
setPaneClickDistance: s.setPaneClickDistance,
|
|
256
254
|
});
|
|
257
255
|
const initPrevValues = {
|
|
258
256
|
/*
|
|
@@ -267,10 +265,9 @@ const initPrevValues = {
|
|
|
267
265
|
elementsSelectable: true,
|
|
268
266
|
noPanClassName: 'nopan',
|
|
269
267
|
rfId: '1',
|
|
270
|
-
paneClickDistance: 0,
|
|
271
268
|
};
|
|
272
269
|
function StoreUpdater(props) {
|
|
273
|
-
const { setNodes, setEdges, setMinZoom, setMaxZoom, setTranslateExtent, setNodeExtent, reset, setDefaultNodesAndEdges,
|
|
270
|
+
const { setNodes, setEdges, setMinZoom, setMaxZoom, setTranslateExtent, setNodeExtent, reset, setDefaultNodesAndEdges, } = useStore(selector$l, shallow);
|
|
274
271
|
const store = useStoreApi();
|
|
275
272
|
useEffect(() => {
|
|
276
273
|
setDefaultNodesAndEdges(props.defaultNodes, props.defaultEdges);
|
|
@@ -302,8 +299,6 @@ function StoreUpdater(props) {
|
|
|
302
299
|
setTranslateExtent(fieldValue);
|
|
303
300
|
else if (fieldName === 'nodeExtent')
|
|
304
301
|
setNodeExtent(fieldValue);
|
|
305
|
-
else if (fieldName === 'paneClickDistance')
|
|
306
|
-
setPaneClickDistance(fieldValue);
|
|
307
302
|
else if (fieldName === 'ariaLabelConfig')
|
|
308
303
|
store.setState({ ariaLabelConfig: mergeAriaLabelConfig(fieldValue) });
|
|
309
304
|
// Renamed fields
|
|
@@ -1281,7 +1276,7 @@ const selector$j = (s) => ({
|
|
|
1281
1276
|
lib: s.lib,
|
|
1282
1277
|
connectionInProgress: s.connection.inProgress,
|
|
1283
1278
|
});
|
|
1284
|
-
function ZoomPane({ onPaneContextMenu, zoomOnScroll = true, zoomOnPinch = true, panOnScroll = false, panOnScrollSpeed = 0.5, panOnScrollMode = PanOnScrollMode.Free, zoomOnDoubleClick = true, panOnDrag = true, defaultViewport, translateExtent, minZoom, maxZoom, zoomActivationKeyCode, preventScrolling = true, children, noWheelClassName, noPanClassName, onViewportChange, isControlledViewport, paneClickDistance, }) {
|
|
1279
|
+
function ZoomPane({ onPaneContextMenu, zoomOnScroll = true, zoomOnPinch = true, panOnScroll = false, panOnScrollSpeed = 0.5, panOnScrollMode = PanOnScrollMode.Free, zoomOnDoubleClick = true, panOnDrag = true, defaultViewport, translateExtent, minZoom, maxZoom, zoomActivationKeyCode, preventScrolling = true, children, noWheelClassName, noPanClassName, onViewportChange, isControlledViewport, paneClickDistance, selectionOnDrag, }) {
|
|
1285
1280
|
const store = useStoreApi();
|
|
1286
1281
|
const zoomPane = useRef(null);
|
|
1287
1282
|
const { userSelectionActive, lib, connectionInProgress } = useStore(selector$j, shallow);
|
|
@@ -1302,7 +1297,6 @@ function ZoomPane({ onPaneContextMenu, zoomOnScroll = true, zoomOnPinch = true,
|
|
|
1302
1297
|
maxZoom,
|
|
1303
1298
|
translateExtent,
|
|
1304
1299
|
viewport: defaultViewport,
|
|
1305
|
-
paneClickDistance,
|
|
1306
1300
|
onDraggingChange: (paneDragging) => store.setState({ paneDragging }),
|
|
1307
1301
|
onPanZoomStart: (event, vp) => {
|
|
1308
1302
|
const { onViewportChangeStart, onMoveStart } = store.getState();
|
|
@@ -1349,6 +1343,8 @@ function ZoomPane({ onPaneContextMenu, zoomOnScroll = true, zoomOnPinch = true,
|
|
|
1349
1343
|
lib,
|
|
1350
1344
|
onTransformChange,
|
|
1351
1345
|
connectionInProgress,
|
|
1346
|
+
selectionOnDrag,
|
|
1347
|
+
paneClickDistance,
|
|
1352
1348
|
});
|
|
1353
1349
|
}, [
|
|
1354
1350
|
onPaneContextMenu,
|
|
@@ -1367,6 +1363,8 @@ function ZoomPane({ onPaneContextMenu, zoomOnScroll = true, zoomOnPinch = true,
|
|
|
1367
1363
|
lib,
|
|
1368
1364
|
onTransformChange,
|
|
1369
1365
|
connectionInProgress,
|
|
1366
|
+
selectionOnDrag,
|
|
1367
|
+
paneClickDistance,
|
|
1370
1368
|
]);
|
|
1371
1369
|
return (jsx("div", { className: "react-flow__renderer", ref: zoomPane, style: containerStyle, children: children }));
|
|
1372
1370
|
}
|
|
@@ -1402,17 +1400,16 @@ const selector$h = (s) => ({
|
|
|
1402
1400
|
connectionInProgress: s.connection.inProgress,
|
|
1403
1401
|
dragging: s.paneDragging,
|
|
1404
1402
|
});
|
|
1405
|
-
function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.Full, panOnDrag, selectionOnDrag, onSelectionStart, onSelectionEnd, onPaneClick, onPaneContextMenu, onPaneScroll, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, children, }) {
|
|
1403
|
+
function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.Full, panOnDrag, paneClickDistance, selectionOnDrag, onSelectionStart, onSelectionEnd, onPaneClick, onPaneContextMenu, onPaneScroll, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, children, }) {
|
|
1406
1404
|
const store = useStoreApi();
|
|
1407
1405
|
const { userSelectionActive, elementsSelectable, dragging, connectionInProgress } = useStore(selector$h, shallow);
|
|
1408
|
-
const
|
|
1406
|
+
const isSelectionEnabled = elementsSelectable && (isSelecting || userSelectionActive);
|
|
1409
1407
|
const container = useRef(null);
|
|
1410
1408
|
const containerBounds = useRef();
|
|
1411
1409
|
const selectedNodeIds = useRef(new Set());
|
|
1412
1410
|
const selectedEdgeIds = useRef(new Set());
|
|
1413
1411
|
// Used to prevent click events when the user lets go of the selectionKey during a selection
|
|
1414
1412
|
const selectionInProgress = useRef(false);
|
|
1415
|
-
const selectionStarted = useRef(false);
|
|
1416
1413
|
const onClick = (event) => {
|
|
1417
1414
|
// We prevent click events when the user let go of the selectionKey during a selection
|
|
1418
1415
|
// We also prevent click events when a connection is in progress
|
|
@@ -1433,35 +1430,28 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
1433
1430
|
};
|
|
1434
1431
|
const onWheel = onPaneScroll ? (event) => onPaneScroll(event) : undefined;
|
|
1435
1432
|
const onClickCapture = (event) => {
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1433
|
+
if (selectionInProgress.current) {
|
|
1434
|
+
event.stopPropagation();
|
|
1435
|
+
selectionInProgress.current = false;
|
|
1439
1436
|
}
|
|
1440
|
-
event.stopPropagation();
|
|
1441
1437
|
};
|
|
1442
1438
|
// We are using capture here in order to prevent other pointer events
|
|
1443
1439
|
// to be able to create a selection above a node or an edge
|
|
1444
1440
|
const onPointerDownCapture = (event) => {
|
|
1445
1441
|
const { resetSelectedElements, domNode } = store.getState();
|
|
1446
1442
|
containerBounds.current = domNode?.getBoundingClientRect();
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
!isSelectionActive ||
|
|
1455
|
-
!event.isPrimary) {
|
|
1443
|
+
if (!containerBounds.current)
|
|
1444
|
+
return;
|
|
1445
|
+
const eventTargetIsContainer = event.target === container.current;
|
|
1446
|
+
// if a child element has the 'nokey' class, we don't want to swallow the event and don't start a selection
|
|
1447
|
+
const isNoKeyEvent = !eventTargetIsContainer && !!event.target.closest('.nokey');
|
|
1448
|
+
const isSelectionActive = (selectionOnDrag && eventTargetIsContainer) || selectionKeyPressed;
|
|
1449
|
+
if (isNoKeyEvent || !isSelecting || !isSelectionActive || event.button !== 0 || !event.isPrimary) {
|
|
1456
1450
|
return;
|
|
1457
1451
|
}
|
|
1458
|
-
event.stopPropagation();
|
|
1459
|
-
event.preventDefault();
|
|
1460
1452
|
event.target?.setPointerCapture?.(event.pointerId);
|
|
1461
|
-
selectionStarted.current = true;
|
|
1462
1453
|
selectionInProgress.current = false;
|
|
1463
1454
|
const { x, y } = getEventPosition(event.nativeEvent, containerBounds.current);
|
|
1464
|
-
resetSelectedElements();
|
|
1465
1455
|
store.setState({
|
|
1466
1456
|
userSelectionRect: {
|
|
1467
1457
|
width: 0,
|
|
@@ -1472,16 +1462,35 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
1472
1462
|
y,
|
|
1473
1463
|
},
|
|
1474
1464
|
});
|
|
1475
|
-
|
|
1465
|
+
if (!eventTargetIsContainer) {
|
|
1466
|
+
event.stopPropagation();
|
|
1467
|
+
event.preventDefault();
|
|
1468
|
+
}
|
|
1469
|
+
if (paneClickDistance === 0 || selectionKeyPressed) {
|
|
1470
|
+
resetSelectedElements();
|
|
1471
|
+
onSelectionStart?.(event);
|
|
1472
|
+
selectionInProgress.current = true;
|
|
1473
|
+
}
|
|
1476
1474
|
};
|
|
1477
1475
|
const onPointerMove = (event) => {
|
|
1478
|
-
const { userSelectionRect, transform, nodeLookup, edgeLookup, connectionLookup, triggerNodeChanges, triggerEdgeChanges, defaultEdgeOptions, } = store.getState();
|
|
1476
|
+
const { userSelectionRect, transform, nodeLookup, edgeLookup, connectionLookup, triggerNodeChanges, triggerEdgeChanges, defaultEdgeOptions, resetSelectedElements, } = store.getState();
|
|
1479
1477
|
if (!containerBounds.current || !userSelectionRect) {
|
|
1480
1478
|
return;
|
|
1481
1479
|
}
|
|
1482
|
-
selectionInProgress.current = true;
|
|
1483
1480
|
const { x: mouseX, y: mouseY } = getEventPosition(event.nativeEvent, containerBounds.current);
|
|
1484
1481
|
const { startX, startY } = userSelectionRect;
|
|
1482
|
+
if (!selectionInProgress.current &&
|
|
1483
|
+
event.target === container.current &&
|
|
1484
|
+
!selectionKeyPressed &&
|
|
1485
|
+
paneClickDistance > 0) {
|
|
1486
|
+
const distance = Math.hypot(mouseX - startX, mouseY - startY);
|
|
1487
|
+
if (distance <= paneClickDistance) {
|
|
1488
|
+
return;
|
|
1489
|
+
}
|
|
1490
|
+
resetSelectedElements();
|
|
1491
|
+
onSelectionStart?.(event);
|
|
1492
|
+
}
|
|
1493
|
+
selectionInProgress.current = true;
|
|
1485
1494
|
const nextUserSelectRect = {
|
|
1486
1495
|
startX,
|
|
1487
1496
|
startY,
|
|
@@ -1522,16 +1531,15 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
1522
1531
|
});
|
|
1523
1532
|
};
|
|
1524
1533
|
const onPointerUp = (event) => {
|
|
1525
|
-
if (event.button !== 0
|
|
1534
|
+
if (event.button !== 0) {
|
|
1526
1535
|
return;
|
|
1527
1536
|
}
|
|
1528
1537
|
event.target?.releasePointerCapture?.(event.pointerId);
|
|
1529
|
-
const { userSelectionRect } = store.getState();
|
|
1530
1538
|
/*
|
|
1531
1539
|
* We only want to trigger click functions when in selection mode if
|
|
1532
1540
|
* the user did not move the mouse.
|
|
1533
1541
|
*/
|
|
1534
|
-
if (!userSelectionActive &&
|
|
1542
|
+
if (!userSelectionActive && event.target === container.current && store.getState().userSelectionRect) {
|
|
1535
1543
|
onClick?.(event);
|
|
1536
1544
|
}
|
|
1537
1545
|
store.setState({
|
|
@@ -1539,18 +1547,12 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
1539
1547
|
userSelectionRect: null,
|
|
1540
1548
|
nodesSelectionActive: selectedNodeIds.current.size > 0,
|
|
1541
1549
|
});
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
* If the user kept holding the selectionKey during the selection,
|
|
1545
|
-
* we need to reset the selectionInProgress, so the next click event is not prevented
|
|
1546
|
-
*/
|
|
1547
|
-
if (selectionKeyPressed || selectionOnDrag) {
|
|
1548
|
-
selectionInProgress.current = false;
|
|
1550
|
+
if (selectionInProgress.current) {
|
|
1551
|
+
onSelectionEnd?.(event);
|
|
1549
1552
|
}
|
|
1550
|
-
selectionStarted.current = false;
|
|
1551
1553
|
};
|
|
1552
1554
|
const draggable = panOnDrag === true || (Array.isArray(panOnDrag) && panOnDrag.includes(0));
|
|
1553
|
-
return (jsxs("div", { className: cc(['react-flow__pane', { draggable, dragging, selection: isSelecting }]), onClick:
|
|
1555
|
+
return (jsxs("div", { className: cc(['react-flow__pane', { draggable, dragging, selection: isSelecting }]), onClick: isSelectionEnabled ? undefined : wrapHandler(onClick, container), onContextMenu: wrapHandler(onContextMenu, container), onWheel: wrapHandler(onWheel, container), onPointerEnter: isSelectionEnabled ? undefined : onPaneMouseEnter, onPointerMove: isSelectionEnabled ? onPointerMove : onPaneMouseMove, onPointerUp: isSelectionEnabled ? onPointerUp : undefined, onPointerDownCapture: isSelectionEnabled ? onPointerDownCapture : undefined, onClickCapture: isSelectionEnabled ? onClickCapture : undefined, onPointerLeave: onPaneMouseLeave, ref: container, style: containerStyle, children: [children, jsx(UserSelection, {})] }));
|
|
1554
1556
|
}
|
|
1555
1557
|
|
|
1556
1558
|
/*
|
|
@@ -1989,7 +1991,7 @@ function FlowRendererComponent({ children, onPaneClick, onPaneMouseEnter, onPane
|
|
|
1989
1991
|
const _selectionOnDrag = selectionOnDrag && panOnDrag !== true;
|
|
1990
1992
|
const isSelecting = selectionKeyPressed || userSelectionActive || _selectionOnDrag;
|
|
1991
1993
|
useGlobalKeyHandler({ deleteKeyCode, multiSelectionKeyCode });
|
|
1992
|
-
return (jsx(ZoomPane, { onPaneContextMenu: onPaneContextMenu, elementsSelectable: elementsSelectable, zoomOnScroll: zoomOnScroll, zoomOnPinch: zoomOnPinch, panOnScroll: panOnScroll, panOnScrollSpeed: panOnScrollSpeed, panOnScrollMode: panOnScrollMode, zoomOnDoubleClick: zoomOnDoubleClick, panOnDrag: !selectionKeyPressed && panOnDrag, defaultViewport: defaultViewport, translateExtent: translateExtent, minZoom: minZoom, maxZoom: maxZoom, zoomActivationKeyCode: zoomActivationKeyCode, preventScrolling: preventScrolling, noWheelClassName: noWheelClassName, noPanClassName: noPanClassName, onViewportChange: onViewportChange, isControlledViewport: isControlledViewport, paneClickDistance: paneClickDistance, children: jsxs(Pane, { onSelectionStart: onSelectionStart, onSelectionEnd: onSelectionEnd, onPaneClick: onPaneClick, onPaneMouseEnter: onPaneMouseEnter, onPaneMouseMove: onPaneMouseMove, onPaneMouseLeave: onPaneMouseLeave, onPaneContextMenu: onPaneContextMenu, onPaneScroll: onPaneScroll, panOnDrag: panOnDrag, isSelecting: !!isSelecting, selectionMode: selectionMode, selectionKeyPressed: selectionKeyPressed, selectionOnDrag: _selectionOnDrag, children: [children, nodesSelectionActive && (jsx(NodesSelection, { onSelectionContextMenu: onSelectionContextMenu, noPanClassName: noPanClassName, disableKeyboardA11y: disableKeyboardA11y }))] }) }));
|
|
1994
|
+
return (jsx(ZoomPane, { onPaneContextMenu: onPaneContextMenu, elementsSelectable: elementsSelectable, zoomOnScroll: zoomOnScroll, zoomOnPinch: zoomOnPinch, panOnScroll: panOnScroll, panOnScrollSpeed: panOnScrollSpeed, panOnScrollMode: panOnScrollMode, zoomOnDoubleClick: zoomOnDoubleClick, panOnDrag: !selectionKeyPressed && panOnDrag, defaultViewport: defaultViewport, translateExtent: translateExtent, minZoom: minZoom, maxZoom: maxZoom, zoomActivationKeyCode: zoomActivationKeyCode, preventScrolling: preventScrolling, noWheelClassName: noWheelClassName, noPanClassName: noPanClassName, onViewportChange: onViewportChange, isControlledViewport: isControlledViewport, paneClickDistance: paneClickDistance, selectionOnDrag: _selectionOnDrag, children: jsxs(Pane, { onSelectionStart: onSelectionStart, onSelectionEnd: onSelectionEnd, onPaneClick: onPaneClick, onPaneMouseEnter: onPaneMouseEnter, onPaneMouseMove: onPaneMouseMove, onPaneMouseLeave: onPaneMouseLeave, onPaneContextMenu: onPaneContextMenu, onPaneScroll: onPaneScroll, panOnDrag: panOnDrag, isSelecting: !!isSelecting, selectionMode: selectionMode, selectionKeyPressed: selectionKeyPressed, paneClickDistance: paneClickDistance, selectionOnDrag: _selectionOnDrag, children: [children, nodesSelectionActive && (jsx(NodesSelection, { onSelectionContextMenu: onSelectionContextMenu, noPanClassName: noPanClassName, disableKeyboardA11y: disableKeyboardA11y }))] }) }));
|
|
1993
1995
|
}
|
|
1994
1996
|
FlowRendererComponent.displayName = 'FlowRenderer';
|
|
1995
1997
|
const FlowRenderer = memo(FlowRendererComponent);
|
|
@@ -3431,9 +3433,6 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
|
|
|
3431
3433
|
get().panZoom?.setTranslateExtent(translateExtent);
|
|
3432
3434
|
set({ translateExtent });
|
|
3433
3435
|
},
|
|
3434
|
-
setPaneClickDistance: (clickDistance) => {
|
|
3435
|
-
get().panZoom?.setClickDistance(clickDistance);
|
|
3436
|
-
},
|
|
3437
3436
|
resetSelectedElements: () => {
|
|
3438
3437
|
const { edges, nodes, triggerNodeChanges, triggerEdgeChanges, elementsSelectable } = get();
|
|
3439
3438
|
if (!elementsSelectable) {
|
|
@@ -3568,7 +3567,7 @@ function ReactFlow({ nodes, edges, defaultNodes, defaultEdges, className, nodeTy
|
|
|
3568
3567
|
e.currentTarget.scrollTo({ top: 0, left: 0, behavior: 'instant' });
|
|
3569
3568
|
onScroll?.(e);
|
|
3570
3569
|
}, [onScroll]);
|
|
3571
|
-
return (jsx("div", { "data-testid": "rf__wrapper", ...rest, onScroll: wrapperOnScroll, style: { ...style, ...wrapperStyle }, ref: ref, className: cc(['react-flow', className, colorModeClassName]), id: id, role: "application", children: jsxs(Wrapper, { nodes: nodes, edges: edges, width: width, height: height, fitView: fitView, fitViewOptions: fitViewOptions, minZoom: minZoom, maxZoom: maxZoom, nodeOrigin: nodeOrigin, nodeExtent: nodeExtent, children: [jsx(GraphView, { onInit: onInit, onNodeClick: onNodeClick, onEdgeClick: onEdgeClick, onNodeMouseEnter: onNodeMouseEnter, onNodeMouseMove: onNodeMouseMove, onNodeMouseLeave: onNodeMouseLeave, onNodeContextMenu: onNodeContextMenu, onNodeDoubleClick: onNodeDoubleClick, nodeTypes: nodeTypes, edgeTypes: edgeTypes, connectionLineType: connectionLineType, connectionLineStyle: connectionLineStyle, connectionLineComponent: connectionLineComponent, connectionLineContainerStyle: connectionLineContainerStyle, selectionKeyCode: selectionKeyCode, selectionOnDrag: selectionOnDrag, selectionMode: selectionMode, deleteKeyCode: deleteKeyCode, multiSelectionKeyCode: multiSelectionKeyCode, panActivationKeyCode: panActivationKeyCode, zoomActivationKeyCode: zoomActivationKeyCode, onlyRenderVisibleElements: onlyRenderVisibleElements, defaultViewport: defaultViewport$1, translateExtent: translateExtent, minZoom: minZoom, maxZoom: maxZoom, preventScrolling: preventScrolling, zoomOnScroll: zoomOnScroll, zoomOnPinch: zoomOnPinch, zoomOnDoubleClick: zoomOnDoubleClick, panOnScroll: panOnScroll, panOnScrollSpeed: panOnScrollSpeed, panOnScrollMode: panOnScrollMode, panOnDrag: panOnDrag, onPaneClick: onPaneClick, onPaneMouseEnter: onPaneMouseEnter, onPaneMouseMove: onPaneMouseMove, onPaneMouseLeave: onPaneMouseLeave, onPaneScroll: onPaneScroll, onPaneContextMenu: onPaneContextMenu, paneClickDistance: paneClickDistance, nodeClickDistance: nodeClickDistance, onSelectionContextMenu: onSelectionContextMenu, onSelectionStart: onSelectionStart, onSelectionEnd: onSelectionEnd, onReconnect: onReconnect, onReconnectStart: onReconnectStart, onReconnectEnd: onReconnectEnd, onEdgeContextMenu: onEdgeContextMenu, onEdgeDoubleClick: onEdgeDoubleClick, onEdgeMouseEnter: onEdgeMouseEnter, onEdgeMouseMove: onEdgeMouseMove, onEdgeMouseLeave: onEdgeMouseLeave, reconnectRadius: reconnectRadius, defaultMarkerColor: defaultMarkerColor, noDragClassName: noDragClassName, noWheelClassName: noWheelClassName, noPanClassName: noPanClassName, rfId: rfId, disableKeyboardA11y: disableKeyboardA11y, nodeExtent: nodeExtent, viewport: viewport, onViewportChange: onViewportChange }), jsx(StoreUpdater, { nodes: nodes, edges: edges, defaultNodes: defaultNodes, defaultEdges: defaultEdges, onConnect: onConnect, onConnectStart: onConnectStart, onConnectEnd: onConnectEnd, onClickConnectStart: onClickConnectStart, onClickConnectEnd: onClickConnectEnd, nodesDraggable: nodesDraggable, autoPanOnNodeFocus: autoPanOnNodeFocus, nodesConnectable: nodesConnectable, nodesFocusable: nodesFocusable, edgesFocusable: edgesFocusable, edgesReconnectable: edgesReconnectable, elementsSelectable: elementsSelectable, elevateNodesOnSelect: elevateNodesOnSelect, elevateEdgesOnSelect: elevateEdgesOnSelect, minZoom: minZoom, maxZoom: maxZoom, nodeExtent: nodeExtent, onNodesChange: onNodesChange, onEdgesChange: onEdgesChange, snapToGrid: snapToGrid, snapGrid: snapGrid, connectionMode: connectionMode, translateExtent: translateExtent, connectOnClick: connectOnClick, defaultEdgeOptions: defaultEdgeOptions, fitView: fitView, fitViewOptions: fitViewOptions, onNodesDelete: onNodesDelete, onEdgesDelete: onEdgesDelete, onDelete: onDelete, onNodeDragStart: onNodeDragStart, onNodeDrag: onNodeDrag, onNodeDragStop: onNodeDragStop, onSelectionDrag: onSelectionDrag, onSelectionDragStart: onSelectionDragStart, onSelectionDragStop: onSelectionDragStop, onMove: onMove, onMoveStart: onMoveStart, onMoveEnd: onMoveEnd, noPanClassName: noPanClassName, nodeOrigin: nodeOrigin, rfId: rfId, autoPanOnConnect: autoPanOnConnect, autoPanOnNodeDrag: autoPanOnNodeDrag, autoPanSpeed: autoPanSpeed, onError: onError, connectionRadius: connectionRadius, isValidConnection: isValidConnection, selectNodesOnDrag: selectNodesOnDrag, nodeDragThreshold: nodeDragThreshold, connectionDragThreshold: connectionDragThreshold, onBeforeDelete: onBeforeDelete,
|
|
3570
|
+
return (jsx("div", { "data-testid": "rf__wrapper", ...rest, onScroll: wrapperOnScroll, style: { ...style, ...wrapperStyle }, ref: ref, className: cc(['react-flow', className, colorModeClassName]), id: id, role: "application", children: jsxs(Wrapper, { nodes: nodes, edges: edges, width: width, height: height, fitView: fitView, fitViewOptions: fitViewOptions, minZoom: minZoom, maxZoom: maxZoom, nodeOrigin: nodeOrigin, nodeExtent: nodeExtent, children: [jsx(GraphView, { onInit: onInit, onNodeClick: onNodeClick, onEdgeClick: onEdgeClick, onNodeMouseEnter: onNodeMouseEnter, onNodeMouseMove: onNodeMouseMove, onNodeMouseLeave: onNodeMouseLeave, onNodeContextMenu: onNodeContextMenu, onNodeDoubleClick: onNodeDoubleClick, nodeTypes: nodeTypes, edgeTypes: edgeTypes, connectionLineType: connectionLineType, connectionLineStyle: connectionLineStyle, connectionLineComponent: connectionLineComponent, connectionLineContainerStyle: connectionLineContainerStyle, selectionKeyCode: selectionKeyCode, selectionOnDrag: selectionOnDrag, selectionMode: selectionMode, deleteKeyCode: deleteKeyCode, multiSelectionKeyCode: multiSelectionKeyCode, panActivationKeyCode: panActivationKeyCode, zoomActivationKeyCode: zoomActivationKeyCode, onlyRenderVisibleElements: onlyRenderVisibleElements, defaultViewport: defaultViewport$1, translateExtent: translateExtent, minZoom: minZoom, maxZoom: maxZoom, preventScrolling: preventScrolling, zoomOnScroll: zoomOnScroll, zoomOnPinch: zoomOnPinch, zoomOnDoubleClick: zoomOnDoubleClick, panOnScroll: panOnScroll, panOnScrollSpeed: panOnScrollSpeed, panOnScrollMode: panOnScrollMode, panOnDrag: panOnDrag, onPaneClick: onPaneClick, onPaneMouseEnter: onPaneMouseEnter, onPaneMouseMove: onPaneMouseMove, onPaneMouseLeave: onPaneMouseLeave, onPaneScroll: onPaneScroll, onPaneContextMenu: onPaneContextMenu, paneClickDistance: paneClickDistance, nodeClickDistance: nodeClickDistance, onSelectionContextMenu: onSelectionContextMenu, onSelectionStart: onSelectionStart, onSelectionEnd: onSelectionEnd, onReconnect: onReconnect, onReconnectStart: onReconnectStart, onReconnectEnd: onReconnectEnd, onEdgeContextMenu: onEdgeContextMenu, onEdgeDoubleClick: onEdgeDoubleClick, onEdgeMouseEnter: onEdgeMouseEnter, onEdgeMouseMove: onEdgeMouseMove, onEdgeMouseLeave: onEdgeMouseLeave, reconnectRadius: reconnectRadius, defaultMarkerColor: defaultMarkerColor, noDragClassName: noDragClassName, noWheelClassName: noWheelClassName, noPanClassName: noPanClassName, rfId: rfId, disableKeyboardA11y: disableKeyboardA11y, nodeExtent: nodeExtent, viewport: viewport, onViewportChange: onViewportChange }), jsx(StoreUpdater, { nodes: nodes, edges: edges, defaultNodes: defaultNodes, defaultEdges: defaultEdges, onConnect: onConnect, onConnectStart: onConnectStart, onConnectEnd: onConnectEnd, onClickConnectStart: onClickConnectStart, onClickConnectEnd: onClickConnectEnd, nodesDraggable: nodesDraggable, autoPanOnNodeFocus: autoPanOnNodeFocus, nodesConnectable: nodesConnectable, nodesFocusable: nodesFocusable, edgesFocusable: edgesFocusable, edgesReconnectable: edgesReconnectable, elementsSelectable: elementsSelectable, elevateNodesOnSelect: elevateNodesOnSelect, elevateEdgesOnSelect: elevateEdgesOnSelect, minZoom: minZoom, maxZoom: maxZoom, nodeExtent: nodeExtent, onNodesChange: onNodesChange, onEdgesChange: onEdgesChange, snapToGrid: snapToGrid, snapGrid: snapGrid, connectionMode: connectionMode, translateExtent: translateExtent, connectOnClick: connectOnClick, defaultEdgeOptions: defaultEdgeOptions, fitView: fitView, fitViewOptions: fitViewOptions, onNodesDelete: onNodesDelete, onEdgesDelete: onEdgesDelete, onDelete: onDelete, onNodeDragStart: onNodeDragStart, onNodeDrag: onNodeDrag, onNodeDragStop: onNodeDragStop, onSelectionDrag: onSelectionDrag, onSelectionDragStart: onSelectionDragStart, onSelectionDragStop: onSelectionDragStop, onMove: onMove, onMoveStart: onMoveStart, onMoveEnd: onMoveEnd, noPanClassName: noPanClassName, nodeOrigin: nodeOrigin, rfId: rfId, autoPanOnConnect: autoPanOnConnect, autoPanOnNodeDrag: autoPanOnNodeDrag, autoPanSpeed: autoPanSpeed, onError: onError, connectionRadius: connectionRadius, isValidConnection: isValidConnection, selectNodesOnDrag: selectNodesOnDrag, nodeDragThreshold: nodeDragThreshold, connectionDragThreshold: connectionDragThreshold, onBeforeDelete: onBeforeDelete, debug: debug, ariaLabelConfig: ariaLabelConfig }), jsx(SelectionListener, { onSelectionChange: onSelectionChange }), children, jsx(Attribution, { proOptions: proOptions, position: attributionPosition }), jsx(A11yDescriptions, { rfId: rfId, disableKeyboardA11y: disableKeyboardA11y })] }) }));
|
|
3572
3571
|
}
|
|
3573
3572
|
/**
|
|
3574
3573
|
* The `<ReactFlow />` component is the heart of your React Flow application.
|