@xyflow/react 12.5.6 → 12.6.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/base.css +2 -2
- package/dist/esm/additional-components/NodeResizer/NodeResizeControl.d.ts +1 -1
- package/dist/esm/additional-components/NodeResizer/NodeResizeControl.d.ts.map +1 -1
- package/dist/esm/additional-components/NodeResizer/types.d.ts +7 -2
- package/dist/esm/additional-components/NodeResizer/types.d.ts.map +1 -1
- package/dist/esm/components/BatchProvider/index.d.ts.map +1 -1
- package/dist/esm/components/ReactFlowProvider/index.d.ts +33 -2
- package/dist/esm/components/ReactFlowProvider/index.d.ts.map +1 -1
- package/dist/esm/container/ReactFlow/Wrapper.d.ts +5 -2
- package/dist/esm/container/ReactFlow/Wrapper.d.ts.map +1 -1
- package/dist/esm/container/ReactFlow/index.d.ts.map +1 -1
- package/dist/esm/index.js +59 -37
- package/dist/esm/index.mjs +59 -37
- package/dist/esm/store/index.d.ts +5 -2
- package/dist/esm/store/index.d.ts.map +1 -1
- package/dist/esm/store/initialState.d.ts +5 -2
- package/dist/esm/store/initialState.d.ts.map +1 -1
- package/dist/esm/types/component-props.d.ts +3 -30
- package/dist/esm/types/component-props.d.ts.map +1 -1
- package/dist/esm/utils/changes.d.ts.map +1 -1
- package/dist/style.css +2 -2
- package/dist/umd/additional-components/NodeResizer/NodeResizeControl.d.ts +1 -1
- package/dist/umd/additional-components/NodeResizer/NodeResizeControl.d.ts.map +1 -1
- package/dist/umd/additional-components/NodeResizer/types.d.ts +7 -2
- package/dist/umd/additional-components/NodeResizer/types.d.ts.map +1 -1
- package/dist/umd/components/BatchProvider/index.d.ts.map +1 -1
- package/dist/umd/components/ReactFlowProvider/index.d.ts +33 -2
- package/dist/umd/components/ReactFlowProvider/index.d.ts.map +1 -1
- package/dist/umd/container/ReactFlow/Wrapper.d.ts +5 -2
- package/dist/umd/container/ReactFlow/Wrapper.d.ts.map +1 -1
- package/dist/umd/container/ReactFlow/index.d.ts.map +1 -1
- package/dist/umd/index.js +2 -2
- package/dist/umd/store/index.d.ts +5 -2
- package/dist/umd/store/index.d.ts.map +1 -1
- package/dist/umd/store/initialState.d.ts +5 -2
- package/dist/umd/store/initialState.d.ts.map +1 -1
- package/dist/umd/types/component-props.d.ts +3 -30
- package/dist/umd/types/component-props.d.ts.map +1 -1
- package/dist/umd/utils/changes.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/base.css
CHANGED
|
@@ -249,7 +249,7 @@ svg.react-flow__connectionline {
|
|
|
249
249
|
}
|
|
250
250
|
.react-flow__panel.top.center, .react-flow__panel.bottom.center {
|
|
251
251
|
left: 50%;
|
|
252
|
-
transform: translateX(-50%);
|
|
252
|
+
transform: translateX(-15px) translateX(-50%);
|
|
253
253
|
}
|
|
254
254
|
.react-flow__panel.left {
|
|
255
255
|
left: 0;
|
|
@@ -259,7 +259,7 @@ svg.react-flow__connectionline {
|
|
|
259
259
|
}
|
|
260
260
|
.react-flow__panel.left.center, .react-flow__panel.right.center {
|
|
261
261
|
top: 50%;
|
|
262
|
-
transform: translateY(-50%);
|
|
262
|
+
transform: translateY(-15px) translateY(-50%);
|
|
263
263
|
}
|
|
264
264
|
.react-flow__attribution {
|
|
265
265
|
font-size: 10px;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { ResizeControlProps, ResizeControlLineProps } from './types';
|
|
3
|
-
declare function ResizeControl({ nodeId, position, variant, className, style, children, color, minWidth, minHeight, maxWidth, maxHeight, keepAspectRatio, shouldResize, onResizeStart, onResize, onResizeEnd, }: ResizeControlProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare function ResizeControl({ nodeId, position, variant, className, style, children, color, minWidth, minHeight, maxWidth, maxHeight, keepAspectRatio, resizeDirection, shouldResize, onResizeStart, onResize, onResizeEnd, }: ResizeControlProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export declare function ResizeControlLine(props: ResizeControlLineProps): import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
/**
|
|
6
6
|
* To create your own resizing UI, you can use the `NodeResizeControl` component where you can pass children (such as icons).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeResizeControl.d.ts","sourceRoot":"","sources":["../../../src/additional-components/NodeResizer/NodeResizeControl.tsx"],"names":[],"mappings":";AAmBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAE1E,iBAAS,aAAa,CAAC,EACrB,MAAM,EACN,QAAQ,EACR,OAAqC,EACrC,SAAS,EACT,KAAU,EACV,QAAQ,EACR,KAAK,EACL,QAAa,EACb,SAAc,EACd,QAA2B,EAC3B,SAA4B,EAC5B,eAAuB,EACvB,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,WAAW,GACZ,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"NodeResizeControl.d.ts","sourceRoot":"","sources":["../../../src/additional-components/NodeResizer/NodeResizeControl.tsx"],"names":[],"mappings":";AAmBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAE1E,iBAAS,aAAa,CAAC,EACrB,MAAM,EACN,QAAQ,EACR,OAAqC,EACrC,SAAS,EACT,KAAU,EACV,QAAQ,EACR,KAAK,EACL,QAAa,EACb,SAAc,EACd,QAA2B,EAC3B,SAA4B,EAC5B,eAAuB,EACvB,eAAe,EACf,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,WAAW,GACZ,EAAE,kBAAkB,2CAuKpB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,2CAE9D;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,2DAAsB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties, ReactNode } from 'react';
|
|
2
|
-
import type { ControlPosition, ControlLinePosition, ResizeControlVariant, ShouldResize, OnResizeStart, OnResize, OnResizeEnd } from '@xyflow/system';
|
|
2
|
+
import type { ControlPosition, ControlLinePosition, ResizeControlVariant, ResizeControlDirection, ShouldResize, OnResizeStart, OnResize, OnResizeEnd } from '@xyflow/system';
|
|
3
3
|
/**
|
|
4
4
|
* @expand
|
|
5
5
|
*/
|
|
@@ -74,6 +74,11 @@ export type ResizeControlProps = Pick<NodeResizerProps, 'nodeId' | 'color' | 'mi
|
|
|
74
74
|
* @example ResizeControlVariant.Handle, ResizeControlVariant.Line
|
|
75
75
|
*/
|
|
76
76
|
variant?: ResizeControlVariant;
|
|
77
|
+
/**
|
|
78
|
+
* The direction the user can resize the node.
|
|
79
|
+
* If not provided, the user can resize in any direction.
|
|
80
|
+
*/
|
|
81
|
+
resizeDirection?: ResizeControlDirection;
|
|
77
82
|
className?: string;
|
|
78
83
|
style?: CSSProperties;
|
|
79
84
|
children?: ReactNode;
|
|
@@ -81,7 +86,7 @@ export type ResizeControlProps = Pick<NodeResizerProps, 'nodeId' | 'color' | 'mi
|
|
|
81
86
|
/**
|
|
82
87
|
* @expand
|
|
83
88
|
*/
|
|
84
|
-
export type ResizeControlLineProps = ResizeControlProps & {
|
|
89
|
+
export type ResizeControlLineProps = Omit<ResizeControlProps, 'resizeDirection'> & {
|
|
85
90
|
position?: ControlLinePosition;
|
|
86
91
|
};
|
|
87
92
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/additional-components/NodeResizer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAExB;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oCAAoC;IACpC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+BAA+B;IAC/B,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,kCAAkC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,mDAAmD;IACnD,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,4CAA4C;IAC5C,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,qCAAqC;IACrC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,gBAAgB,EACd,QAAQ,GACR,OAAO,GACP,UAAU,GACV,WAAW,GACX,UAAU,GACV,WAAW,GACX,iBAAiB,GACjB,cAAc,GACd,eAAe,GACf,UAAU,GACV,aAAa,CAChB,GAAG;IACF;;;;OAIG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B;;;;OAIG;IACH,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,kBAAkB,GAAG;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/additional-components/NodeResizer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAExB;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oCAAoC;IACpC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+BAA+B;IAC/B,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,kCAAkC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,mDAAmD;IACnD,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,4CAA4C;IAC5C,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,qCAAqC;IACrC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,gBAAgB,EACd,QAAQ,GACR,OAAO,GACP,UAAU,GACV,WAAW,GACX,UAAU,GACV,WAAW,GACX,iBAAiB,GACjB,cAAc,GACd,eAAe,GACf,UAAU,GACV,aAAa,CAChB,GAAG;IACF;;;;OAIG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B;;;;OAIG;IACH,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B;;;OAGG;IACH,eAAe,CAAC,EAAE,sBAAsB,CAAC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,GAAG;IACjF,QAAQ,CAAC,EAAE,mBAAmB,CAAC;CAChC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/BatchProvider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAoC,MAAM,OAAO,CAAC;AAKnF,OAAO,EAAE,KAAK,EAAa,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAU9C;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,EACxF,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/BatchProvider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAoC,MAAM,OAAO,CAAC;AAKnF,OAAO,EAAE,KAAK,EAAa,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAU9C;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,EACxF,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,2CAkEA;AAED,wBAAgB,eAAe;;;EAQ9B"}
|
|
@@ -1,15 +1,46 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
import type { Node, Edge } from '../../types';
|
|
2
|
+
import type { Node, Edge, FitViewOptions } from '../../types';
|
|
3
3
|
import { CoordinateExtent, NodeOrigin } from '@xyflow/system';
|
|
4
4
|
export type ReactFlowProviderProps = {
|
|
5
|
+
/** These nodes are used to initialize the flow. They are not dynamic. */
|
|
5
6
|
initialNodes?: Node[];
|
|
7
|
+
/** These edges are used to initialize the flow. They are not dynamic. */
|
|
6
8
|
initialEdges?: Edge[];
|
|
9
|
+
/** These nodes are used to initialize the flow. They are not dynamic. */
|
|
7
10
|
defaultNodes?: Node[];
|
|
11
|
+
/** These edges are used to initialize the flow. They are not dynamic. */
|
|
8
12
|
defaultEdges?: Edge[];
|
|
13
|
+
/** The initial width is necessary to be able to use fitView on the server */
|
|
9
14
|
initialWidth?: number;
|
|
15
|
+
/** The initial height is necessary to be able to use fitView on the server */
|
|
10
16
|
initialHeight?: number;
|
|
17
|
+
/** When `true`, the flow will be zoomed and panned to fit all the nodes initially provided. */
|
|
11
18
|
fitView?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* You can provide an object of options to customize the initial fitView behavior.
|
|
21
|
+
*/
|
|
22
|
+
initialFitViewOptions?: FitViewOptions;
|
|
23
|
+
/** Initial minimum zoom level */
|
|
24
|
+
initialMinZoom?: number;
|
|
25
|
+
/** Initial maximum zoom level */
|
|
26
|
+
initialMaxZoom?: number;
|
|
27
|
+
/**
|
|
28
|
+
* The origin of the node to use when placing it in the flow or looking up its `x` and `y`
|
|
29
|
+
* position. An origin of `[0, 0]` means that a node's top left corner will be placed at the `x`
|
|
30
|
+
* and `y` position.
|
|
31
|
+
* @default [0, 0]
|
|
32
|
+
* @example
|
|
33
|
+
* [0, 0] // default, top left
|
|
34
|
+
* [0.5, 0.5] // center
|
|
35
|
+
* [1, 1] // bottom right
|
|
36
|
+
*/
|
|
12
37
|
nodeOrigin?: NodeOrigin;
|
|
38
|
+
/**
|
|
39
|
+
* By default, nodes can be placed on an infinite flow. You can use this prop to set a boundary.
|
|
40
|
+
*
|
|
41
|
+
* The first pair of coordinates is the top left boundary and the second pair is the bottom right.
|
|
42
|
+
* @example [[-1000, -10000], [1000, 1000]]
|
|
43
|
+
*/
|
|
13
44
|
nodeExtent?: CoordinateExtent;
|
|
14
45
|
children: ReactNode;
|
|
15
46
|
};
|
|
@@ -47,5 +78,5 @@ export type ReactFlowProviderProps = {
|
|
|
47
78
|
* your router. If you have multiple flows on the same page you will need to use a separate
|
|
48
79
|
* `<ReactFlowProvider />` for each flow.
|
|
49
80
|
*/
|
|
50
|
-
export declare function ReactFlowProvider({ initialNodes: nodes, initialEdges: edges, defaultNodes, defaultEdges, initialWidth: width, initialHeight: height, fitView, nodeOrigin, nodeExtent, children, }: ReactFlowProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
81
|
+
export declare function ReactFlowProvider({ initialNodes: nodes, initialEdges: edges, defaultNodes, defaultEdges, initialWidth: width, initialHeight: height, initialMinZoom: minZoom, initialMaxZoom: maxZoom, initialFitViewOptions: fitViewOptions, fitView, nodeOrigin, nodeExtent, children, }: ReactFlowProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
51
82
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ReactFlowProvider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAKjD,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ReactFlowProvider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAKjD,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE9D,MAAM,MAAM,sBAAsB,GAAG;IACnC,yEAAyE;IACzE,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC;IACtB,yEAAyE;IACzE,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC;IACtB,yEAAyE;IACzE,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC;IACtB,yEAAyE;IACzE,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC;IACtB,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8EAA8E;IAC9E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,+FAA+F;IAC/F,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,qBAAqB,CAAC,EAAE,cAAc,CAAC;IACvC,iCAAiC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iCAAiC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,YAAY,EAAE,KAAK,EACnB,YAAY,EAAE,KAAK,EACnB,YAAY,EACZ,YAAY,EACZ,YAAY,EAAE,KAAK,EACnB,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,OAAO,EACvB,cAAc,EAAE,OAAO,EACvB,qBAAqB,EAAE,cAAc,EACrC,OAAO,EACP,UAAU,EACV,UAAU,EACV,QAAQ,GACT,EAAE,sBAAsB,2CAuBxB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
import type { Node, Edge } from '../../types';
|
|
2
|
+
import type { Node, Edge, FitViewOptions } from '../../types';
|
|
3
3
|
import { CoordinateExtent, NodeOrigin } from '@xyflow/system';
|
|
4
|
-
export declare function Wrapper({ children, nodes, edges, defaultNodes, defaultEdges, width, height, fitView, nodeOrigin, nodeExtent, }: {
|
|
4
|
+
export declare function Wrapper({ children, nodes, edges, defaultNodes, defaultEdges, width, height, fitView, fitViewOptions, minZoom, maxZoom, nodeOrigin, nodeExtent, }: {
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
nodes?: Node[];
|
|
7
7
|
edges?: Edge[];
|
|
@@ -10,6 +10,9 @@ export declare function Wrapper({ children, nodes, edges, defaultNodes, defaultE
|
|
|
10
10
|
width?: number;
|
|
11
11
|
height?: number;
|
|
12
12
|
fitView?: boolean;
|
|
13
|
+
fitViewOptions?: FitViewOptions;
|
|
14
|
+
minZoom?: number;
|
|
15
|
+
maxZoom?: number;
|
|
13
16
|
nodeOrigin?: NodeOrigin;
|
|
14
17
|
nodeExtent?: CoordinateExtent;
|
|
15
18
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Wrapper.d.ts","sourceRoot":"","sources":["../../../src/container/ReactFlow/Wrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAInD,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"Wrapper.d.ts","sourceRoot":"","sources":["../../../src/container/ReactFlow/Wrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAInD,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE9D,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,KAAK,EACL,KAAK,EACL,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,MAAM,EACN,OAAO,EACP,cAAc,EACd,OAAO,EACP,OAAO,EACP,UAAU,EACV,UAAU,GACX,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B,2CA6BA"}
|
|
@@ -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;AAkT9D;;;;;;;;;;;;;;;;;;;GAmBG;;AACH,wBAA0C"}
|
package/dist/esm/index.js
CHANGED
|
@@ -135,12 +135,12 @@ const selector$m = (s) => {
|
|
|
135
135
|
const selectedNodes = [];
|
|
136
136
|
const selectedEdges = [];
|
|
137
137
|
for (const [, node] of s.nodeLookup) {
|
|
138
|
-
if (node.selected
|
|
138
|
+
if (node.selected) {
|
|
139
139
|
selectedNodes.push(node.internals.userNode);
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
for (const [, edge] of s.edgeLookup) {
|
|
143
|
-
if (edge.selected
|
|
143
|
+
if (edge.selected) {
|
|
144
144
|
selectedEdges.push(edge);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
@@ -685,8 +685,12 @@ function applyChange(change, element) {
|
|
|
685
685
|
element.measured.width = change.dimensions.width;
|
|
686
686
|
element.measured.height = change.dimensions.height;
|
|
687
687
|
if (change.setAttributes) {
|
|
688
|
-
|
|
689
|
-
|
|
688
|
+
if (change.setAttributes === true || change.setAttributes === 'width') {
|
|
689
|
+
element.width = change.dimensions.width;
|
|
690
|
+
}
|
|
691
|
+
if (change.setAttributes === true || change.setAttributes === 'height') {
|
|
692
|
+
element.height = change.dimensions.height;
|
|
693
|
+
}
|
|
690
694
|
}
|
|
691
695
|
}
|
|
692
696
|
if (typeof change.resizing === 'boolean') {
|
|
@@ -942,29 +946,26 @@ function BatchProvider({ children, }) {
|
|
|
942
946
|
for (const payload of queueItems) {
|
|
943
947
|
next = typeof payload === 'function' ? payload(next) : payload;
|
|
944
948
|
}
|
|
949
|
+
const changes = getElementsDiffChanges({
|
|
950
|
+
items: next,
|
|
951
|
+
lookup: nodeLookup,
|
|
952
|
+
});
|
|
945
953
|
if (hasDefaultNodes) {
|
|
946
954
|
setNodes(next);
|
|
947
955
|
}
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
956
|
+
// We only want to fire onNodesChange if there are changes to the nodes
|
|
957
|
+
if (changes.length > 0) {
|
|
958
|
+
onNodesChange?.(changes);
|
|
959
|
+
}
|
|
960
|
+
else if (fitViewQueued) {
|
|
961
|
+
// If there are no changes to the nodes, we still need to call setNodes
|
|
962
|
+
// to trigger a re-render and fitView.
|
|
963
|
+
window.requestAnimationFrame(() => {
|
|
964
|
+
const { fitViewQueued, nodes, setNodes } = store.getState();
|
|
965
|
+
if (fitViewQueued) {
|
|
966
|
+
setNodes(nodes);
|
|
967
|
+
}
|
|
953
968
|
});
|
|
954
|
-
// We only want to fire onNodesChange if there are changes to the nodes
|
|
955
|
-
if (changes.length > 0) {
|
|
956
|
-
onNodesChange?.(changes);
|
|
957
|
-
}
|
|
958
|
-
else if (fitViewQueued) {
|
|
959
|
-
// If there are no changes to the nodes, we still need to call setNodes
|
|
960
|
-
// to trigger a re-render and fitView.
|
|
961
|
-
window.requestAnimationFrame(() => {
|
|
962
|
-
const { fitViewQueued, nodes, setNodes } = store.getState();
|
|
963
|
-
if (fitViewQueued) {
|
|
964
|
-
setNodes(nodes);
|
|
965
|
-
}
|
|
966
|
-
});
|
|
967
|
-
}
|
|
968
969
|
}
|
|
969
970
|
}, []);
|
|
970
971
|
const nodeQueue = useQueue(nodeQueueHandler);
|
|
@@ -3066,7 +3067,7 @@ function GraphViewComponent({ nodeTypes, edgeTypes, onInit, onNodeClick, onEdgeC
|
|
|
3066
3067
|
GraphViewComponent.displayName = 'GraphView';
|
|
3067
3068
|
const GraphView = memo(GraphViewComponent);
|
|
3068
3069
|
|
|
3069
|
-
const getInitialState = ({ nodes, edges, defaultNodes, defaultEdges, width, height, fitView, nodeOrigin, nodeExtent, } = {}) => {
|
|
3070
|
+
const getInitialState = ({ nodes, edges, defaultNodes, defaultEdges, width, height, fitView, fitViewOptions, minZoom = 0.5, maxZoom = 2, nodeOrigin, nodeExtent, } = {}) => {
|
|
3070
3071
|
const nodeLookup = new Map();
|
|
3071
3072
|
const parentLookup = new Map();
|
|
3072
3073
|
const connectionLookup = new Map();
|
|
@@ -3086,7 +3087,7 @@ const getInitialState = ({ nodes, edges, defaultNodes, defaultEdges, width, heig
|
|
|
3086
3087
|
const bounds = getInternalNodesBounds(nodeLookup, {
|
|
3087
3088
|
filter: (node) => !!((node.width || node.initialWidth) && (node.height || node.initialHeight)),
|
|
3088
3089
|
});
|
|
3089
|
-
const { x, y, zoom } = getViewportForBounds(bounds, width, height,
|
|
3090
|
+
const { x, y, zoom } = getViewportForBounds(bounds, width, height, minZoom, maxZoom, fitViewOptions?.padding ?? 0.1);
|
|
3090
3091
|
transform = [x, y, zoom];
|
|
3091
3092
|
}
|
|
3092
3093
|
return {
|
|
@@ -3106,8 +3107,8 @@ const getInitialState = ({ nodes, edges, defaultNodes, defaultEdges, width, heig
|
|
|
3106
3107
|
hasDefaultNodes: defaultNodes !== undefined,
|
|
3107
3108
|
hasDefaultEdges: defaultEdges !== undefined,
|
|
3108
3109
|
panZoom: null,
|
|
3109
|
-
minZoom
|
|
3110
|
-
maxZoom
|
|
3110
|
+
minZoom,
|
|
3111
|
+
maxZoom,
|
|
3111
3112
|
translateExtent: infiniteExtent,
|
|
3112
3113
|
nodeExtent: storeNodeExtent,
|
|
3113
3114
|
nodesSelectionActive: false,
|
|
@@ -3132,7 +3133,7 @@ const getInitialState = ({ nodes, edges, defaultNodes, defaultEdges, width, heig
|
|
|
3132
3133
|
selectNodesOnDrag: true,
|
|
3133
3134
|
multiSelectionActive: false,
|
|
3134
3135
|
fitViewQueued: fitView ?? false,
|
|
3135
|
-
fitViewOptions
|
|
3136
|
+
fitViewOptions,
|
|
3136
3137
|
fitViewResolver: null,
|
|
3137
3138
|
connection: { ...initialConnection },
|
|
3138
3139
|
connectionClickStartHandle: null,
|
|
@@ -3150,7 +3151,7 @@ const getInitialState = ({ nodes, edges, defaultNodes, defaultEdges, width, heig
|
|
|
3150
3151
|
};
|
|
3151
3152
|
};
|
|
3152
3153
|
|
|
3153
|
-
const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height, fitView, nodeOrigin, nodeExtent, }) => createWithEqualityFn((set, get) => {
|
|
3154
|
+
const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height, fitView, fitViewOptions, minZoom, maxZoom, nodeOrigin, nodeExtent, }) => createWithEqualityFn((set, get) => {
|
|
3154
3155
|
async function resolveFitView() {
|
|
3155
3156
|
const { nodeLookup, panZoom, fitViewOptions, fitViewResolver, width, height, minZoom, maxZoom } = get();
|
|
3156
3157
|
if (!panZoom) {
|
|
@@ -3172,7 +3173,20 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
|
|
|
3172
3173
|
set({ fitViewResolver: null });
|
|
3173
3174
|
}
|
|
3174
3175
|
return {
|
|
3175
|
-
...getInitialState({
|
|
3176
|
+
...getInitialState({
|
|
3177
|
+
nodes,
|
|
3178
|
+
edges,
|
|
3179
|
+
width,
|
|
3180
|
+
height,
|
|
3181
|
+
fitView,
|
|
3182
|
+
fitViewOptions,
|
|
3183
|
+
minZoom,
|
|
3184
|
+
maxZoom,
|
|
3185
|
+
nodeOrigin,
|
|
3186
|
+
nodeExtent,
|
|
3187
|
+
defaultNodes,
|
|
3188
|
+
defaultEdges,
|
|
3189
|
+
}),
|
|
3176
3190
|
setNodes: (nodes) => {
|
|
3177
3191
|
const { nodeLookup, parentLookup, nodeOrigin, elevateNodesOnSelect, fitViewQueued } = get();
|
|
3178
3192
|
/*
|
|
@@ -3363,7 +3377,10 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
|
|
|
3363
3377
|
get().panZoom?.setClickDistance(clickDistance);
|
|
3364
3378
|
},
|
|
3365
3379
|
resetSelectedElements: () => {
|
|
3366
|
-
const { edges, nodes, triggerNodeChanges, triggerEdgeChanges } = get();
|
|
3380
|
+
const { edges, nodes, triggerNodeChanges, triggerEdgeChanges, elementsSelectable } = get();
|
|
3381
|
+
if (!elementsSelectable) {
|
|
3382
|
+
return;
|
|
3383
|
+
}
|
|
3367
3384
|
const nodeChanges = nodes.reduce((res, node) => (node.selected ? [...res, createSelectionChange(node.id, false)] : res), []);
|
|
3368
3385
|
const edgeChanges = edges.reduce((res, edge) => (edge.selected ? [...res, createSelectionChange(edge.id, false)] : res), []);
|
|
3369
3386
|
triggerNodeChanges(nodeChanges);
|
|
@@ -3435,7 +3452,7 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
|
|
|
3435
3452
|
* your router. If you have multiple flows on the same page you will need to use a separate
|
|
3436
3453
|
* `<ReactFlowProvider />` for each flow.
|
|
3437
3454
|
*/
|
|
3438
|
-
function ReactFlowProvider({ initialNodes: nodes, initialEdges: edges, defaultNodes, defaultEdges, initialWidth: width, initialHeight: height, fitView, nodeOrigin, nodeExtent, children, }) {
|
|
3455
|
+
function ReactFlowProvider({ initialNodes: nodes, initialEdges: edges, defaultNodes, defaultEdges, initialWidth: width, initialHeight: height, initialMinZoom: minZoom, initialMaxZoom: maxZoom, initialFitViewOptions: fitViewOptions, fitView, nodeOrigin, nodeExtent, children, }) {
|
|
3439
3456
|
const [store] = useState(() => createStore({
|
|
3440
3457
|
nodes,
|
|
3441
3458
|
edges,
|
|
@@ -3444,13 +3461,16 @@ function ReactFlowProvider({ initialNodes: nodes, initialEdges: edges, defaultNo
|
|
|
3444
3461
|
width,
|
|
3445
3462
|
height,
|
|
3446
3463
|
fitView,
|
|
3464
|
+
minZoom,
|
|
3465
|
+
maxZoom,
|
|
3466
|
+
fitViewOptions,
|
|
3447
3467
|
nodeOrigin,
|
|
3448
3468
|
nodeExtent,
|
|
3449
3469
|
}));
|
|
3450
3470
|
return (jsx(Provider$1, { value: store, children: jsx(BatchProvider, { children: children }) }));
|
|
3451
3471
|
}
|
|
3452
3472
|
|
|
3453
|
-
function Wrapper({ children, nodes, edges, defaultNodes, defaultEdges, width, height, fitView, nodeOrigin, nodeExtent, }) {
|
|
3473
|
+
function Wrapper({ children, nodes, edges, defaultNodes, defaultEdges, width, height, fitView, fitViewOptions, minZoom, maxZoom, nodeOrigin, nodeExtent, }) {
|
|
3454
3474
|
const isWrapped = useContext(StoreContext);
|
|
3455
3475
|
if (isWrapped) {
|
|
3456
3476
|
/*
|
|
@@ -3459,7 +3479,7 @@ function Wrapper({ children, nodes, edges, defaultNodes, defaultEdges, width, he
|
|
|
3459
3479
|
*/
|
|
3460
3480
|
return jsx(Fragment, { children: children });
|
|
3461
3481
|
}
|
|
3462
|
-
return (jsx(ReactFlowProvider, { initialNodes: nodes, initialEdges: edges, defaultNodes: defaultNodes, defaultEdges: defaultEdges, initialWidth: width, initialHeight: height, fitView: fitView, nodeOrigin: nodeOrigin, nodeExtent: nodeExtent, children: children }));
|
|
3482
|
+
return (jsx(ReactFlowProvider, { initialNodes: nodes, initialEdges: edges, defaultNodes: defaultNodes, defaultEdges: defaultEdges, initialWidth: width, initialHeight: height, fitView: fitView, initialFitViewOptions: fitViewOptions, initialMinZoom: minZoom, initialMaxZoom: maxZoom, nodeOrigin: nodeOrigin, nodeExtent: nodeExtent, children: children }));
|
|
3463
3483
|
}
|
|
3464
3484
|
|
|
3465
3485
|
const wrapperStyle = {
|
|
@@ -3477,7 +3497,7 @@ function ReactFlow({ nodes, edges, defaultNodes, defaultEdges, className, nodeTy
|
|
|
3477
3497
|
e.currentTarget.scrollTo({ top: 0, left: 0, behavior: 'instant' });
|
|
3478
3498
|
onScroll?.(e);
|
|
3479
3499
|
}, [onScroll]);
|
|
3480
|
-
return (jsx("div", { "data-testid": "rf__wrapper", ...rest, onScroll: wrapperOnScroll, style: { ...style, ...wrapperStyle }, ref: ref, className: cc(['react-flow', className, colorModeClassName]), id: id, children: jsxs(Wrapper, { nodes: nodes, edges: edges, width: width, height: height, fitView: fitView, 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, 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, onBeforeDelete: onBeforeDelete, paneClickDistance: paneClickDistance, debug: debug }), jsx(SelectionListener, { onSelectionChange: onSelectionChange }), children, jsx(Attribution, { proOptions: proOptions, position: attributionPosition }), jsx(A11yDescriptions, { rfId: rfId, disableKeyboardA11y: disableKeyboardA11y })] }) }));
|
|
3500
|
+
return (jsx("div", { "data-testid": "rf__wrapper", ...rest, onScroll: wrapperOnScroll, style: { ...style, ...wrapperStyle }, ref: ref, className: cc(['react-flow', className, colorModeClassName]), id: id, 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, 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, onBeforeDelete: onBeforeDelete, paneClickDistance: paneClickDistance, debug: debug }), jsx(SelectionListener, { onSelectionChange: onSelectionChange }), children, jsx(Attribution, { proOptions: proOptions, position: attributionPosition }), jsx(A11yDescriptions, { rfId: rfId, disableKeyboardA11y: disableKeyboardA11y })] }) }));
|
|
3481
3501
|
}
|
|
3482
3502
|
/**
|
|
3483
3503
|
* The `<ReactFlow />` component is the heart of your React Flow application.
|
|
@@ -4482,7 +4502,7 @@ MiniMapComponent.displayName = 'MiniMap';
|
|
|
4482
4502
|
*/
|
|
4483
4503
|
const MiniMap = memo(MiniMapComponent);
|
|
4484
4504
|
|
|
4485
|
-
function ResizeControl({ nodeId, position, variant = ResizeControlVariant.Handle, className, style = {}, children, color, minWidth = 10, minHeight = 10, maxWidth = Number.MAX_VALUE, maxHeight = Number.MAX_VALUE, keepAspectRatio = false, shouldResize, onResizeStart, onResize, onResizeEnd, }) {
|
|
4505
|
+
function ResizeControl({ nodeId, position, variant = ResizeControlVariant.Handle, className, style = {}, children, color, minWidth = 10, minHeight = 10, maxWidth = Number.MAX_VALUE, maxHeight = Number.MAX_VALUE, keepAspectRatio = false, resizeDirection, shouldResize, onResizeStart, onResize, onResizeEnd, }) {
|
|
4486
4506
|
const contextNodeId = useNodeId();
|
|
4487
4507
|
const id = typeof nodeId === 'string' ? nodeId : contextNodeId;
|
|
4488
4508
|
const store = useStoreApi();
|
|
@@ -4548,11 +4568,12 @@ function ResizeControl({ nodeId, position, variant = ResizeControlVariant.Handle
|
|
|
4548
4568
|
changes.push(positionChange);
|
|
4549
4569
|
}
|
|
4550
4570
|
if (change.width !== undefined && change.height !== undefined) {
|
|
4571
|
+
const setAttributes = !resizeDirection ? true : resizeDirection === 'horizontal' ? 'width' : 'height';
|
|
4551
4572
|
const dimensionChange = {
|
|
4552
4573
|
id,
|
|
4553
4574
|
type: 'dimensions',
|
|
4554
4575
|
resizing: true,
|
|
4555
|
-
setAttributes
|
|
4576
|
+
setAttributes,
|
|
4556
4577
|
dimensions: {
|
|
4557
4578
|
width: change.width,
|
|
4558
4579
|
height: change.height,
|
|
@@ -4592,6 +4613,7 @@ function ResizeControl({ nodeId, position, variant = ResizeControlVariant.Handle
|
|
|
4592
4613
|
maxHeight,
|
|
4593
4614
|
},
|
|
4594
4615
|
keepAspectRatio,
|
|
4616
|
+
resizeDirection,
|
|
4595
4617
|
onResizeStart,
|
|
4596
4618
|
onResize,
|
|
4597
4619
|
onResizeEnd,
|