@uipath/apollo-react 3.48.0 → 3.48.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/canvas/utils/NodeUtils.cjs +7 -4
- package/dist/canvas/utils/NodeUtils.d.ts +4 -1
- package/dist/canvas/utils/NodeUtils.d.ts.map +1 -1
- package/dist/canvas/utils/NodeUtils.js +7 -4
- package/dist/canvas/utils/createPreviewNode.cjs +5 -1
- package/dist/canvas/utils/createPreviewNode.d.ts.map +1 -1
- package/dist/canvas/utils/createPreviewNode.js +5 -1
- package/package.json +1 -1
|
@@ -48,12 +48,15 @@ const getAbsolutePosition = (node, nodes)=>{
|
|
|
48
48
|
y
|
|
49
49
|
};
|
|
50
50
|
};
|
|
51
|
-
function getNonOverlappingPositionForDirection(nodes, newNodePosition, newNodeStyle, direction, offset = 2 * external_constants_cjs_namespaceObject.GRID_SPACING, ignoredNodeTypes = []
|
|
51
|
+
function getNonOverlappingPositionForDirection(nodes, newNodePosition, newNodeStyle, direction, offset = 2 * external_constants_cjs_namespaceObject.GRID_SPACING, ignoredNodeTypes = [], overflowDirection = {
|
|
52
|
+
x: 'right',
|
|
53
|
+
y: 'down'
|
|
54
|
+
}) {
|
|
52
55
|
const isOverlapping = nodes.some((node)=>node.id !== external_constants_cjs_namespaceObject.PREVIEW_NODE_ID && !ignoredNodeTypes.includes(node.type ?? '') && node.position.x < newNodePosition.x + newNodeStyle.width && node.position.x + (node.measured?.width ?? 0) > newNodePosition.x && node.position.y < newNodePosition.y + newNodeStyle.height && node.position.y + (node.measured?.height ?? 0) > newNodePosition.y);
|
|
53
56
|
if (isOverlapping) {
|
|
54
|
-
if ('left' === direction || 'right' === direction) newNodePosition.y += offset;
|
|
55
|
-
else newNodePosition.x += offset;
|
|
56
|
-
return getNonOverlappingPositionForDirection(nodes, newNodePosition, newNodeStyle, direction, offset, ignoredNodeTypes);
|
|
57
|
+
if ('left' === direction || 'right' === direction) newNodePosition.y += 'down' === overflowDirection.y ? offset : -offset;
|
|
58
|
+
else newNodePosition.x += 'right' === overflowDirection.x ? offset : -offset;
|
|
59
|
+
return getNonOverlappingPositionForDirection(nodes, newNodePosition, newNodeStyle, direction, offset, ignoredNodeTypes, overflowDirection);
|
|
57
60
|
}
|
|
58
61
|
return newNodePosition;
|
|
59
62
|
}
|
|
@@ -6,7 +6,10 @@ export declare const getAbsolutePosition: (node: Node, nodes: Node[]) => {
|
|
|
6
6
|
export declare function getNonOverlappingPositionForDirection(nodes: Node[], newNodePosition: XYPosition, newNodeStyle: {
|
|
7
7
|
width: number;
|
|
8
8
|
height: number;
|
|
9
|
-
}, direction: 'left' | 'right' | 'top' | 'bottom', offset?: number, ignoredNodeTypes?: string[]
|
|
9
|
+
}, direction: 'left' | 'right' | 'top' | 'bottom', offset?: number, ignoredNodeTypes?: string[], overflowDirection?: {
|
|
10
|
+
x: 'left' | 'right';
|
|
11
|
+
y: 'up' | 'down';
|
|
12
|
+
}): XYPosition;
|
|
10
13
|
export declare const snapToGrid: (value: number) => number;
|
|
11
14
|
export type CollisionAlgorithmOptions = {
|
|
12
15
|
maxIterations?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeUtils.d.ts","sourceRoot":"","sources":["../../../src/canvas/utils/NodeUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,IAAI,EACT,QAAQ,EACR,KAAK,UAAU,EAChB,MAAM,0CAA0C,CAAC;AAUlD,eAAO,MAAM,mBAAmB,GAAI,MAAM,IAAI,EAAE,OAAO,IAAI,EAAE,KAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAWrF,CAAC;
|
|
1
|
+
{"version":3,"file":"NodeUtils.d.ts","sourceRoot":"","sources":["../../../src/canvas/utils/NodeUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EACX,KAAK,YAA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ACrB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAMF,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,QAAQ,GACvB,aAAa,GAAG,SAAS,CAgB3B;AAWD,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,MAAM,EAAE,GACnB,MAAM,GAAG,IAAI,CAQf"}
|
|
@@ -15,12 +15,15 @@ const getAbsolutePosition = (node, nodes)=>{
|
|
|
15
15
|
y
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
|
-
function getNonOverlappingPositionForDirection(nodes, newNodePosition, newNodeStyle, direction, offset = 2 * GRID_SPACING, ignoredNodeTypes = []
|
|
18
|
+
function getNonOverlappingPositionForDirection(nodes, newNodePosition, newNodeStyle, direction, offset = 2 * GRID_SPACING, ignoredNodeTypes = [], overflowDirection = {
|
|
19
|
+
x: 'right',
|
|
20
|
+
y: 'down'
|
|
21
|
+
}) {
|
|
19
22
|
const isOverlapping = nodes.some((node)=>node.id !== PREVIEW_NODE_ID && !ignoredNodeTypes.includes(node.type ?? '') && node.position.x < newNodePosition.x + newNodeStyle.width && node.position.x + (node.measured?.width ?? 0) > newNodePosition.x && node.position.y < newNodePosition.y + newNodeStyle.height && node.position.y + (node.measured?.height ?? 0) > newNodePosition.y);
|
|
20
23
|
if (isOverlapping) {
|
|
21
|
-
if ('left' === direction || 'right' === direction) newNodePosition.y += offset;
|
|
22
|
-
else newNodePosition.x += offset;
|
|
23
|
-
return getNonOverlappingPositionForDirection(nodes, newNodePosition, newNodeStyle, direction, offset, ignoredNodeTypes);
|
|
24
|
+
if ('left' === direction || 'right' === direction) newNodePosition.y += 'down' === overflowDirection.y ? offset : -offset;
|
|
25
|
+
else newNodePosition.x += 'right' === overflowDirection.x ? offset : -offset;
|
|
26
|
+
return getNonOverlappingPositionForDirection(nodes, newNodePosition, newNodeStyle, direction, offset, ignoredNodeTypes, overflowDirection);
|
|
24
27
|
}
|
|
25
28
|
return newNodePosition;
|
|
26
29
|
}
|
|
@@ -130,7 +130,11 @@ function calculateAutoPosition(sourceNode, handlePosition, previewNodeSize, exis
|
|
|
130
130
|
};
|
|
131
131
|
direction = 'right';
|
|
132
132
|
}
|
|
133
|
-
|
|
133
|
+
const overflowDirection = {
|
|
134
|
+
x: anchorX >= sourceAbsolutePosition.x + sourceWidth / 2 ? 'right' : 'left',
|
|
135
|
+
y: anchorY >= sourceAbsolutePosition.y + sourceHeight / 2 ? 'down' : 'up'
|
|
136
|
+
};
|
|
137
|
+
return (0, external_NodeUtils_cjs_namespaceObject.getNonOverlappingPositionForDirection)(nodesWithAbsolutePositions, initialPosition, previewNodeSize, direction, offset, ignoredNodeTypes, overflowDirection);
|
|
134
138
|
}
|
|
135
139
|
function createPreviewNode(sourceNodeId, sourceHandleId, reactFlowInstance, position, data, sourceHandleType = 'source', previewNodeSize = {
|
|
136
140
|
width: external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPreviewNode.d.ts","sourceRoot":"","sources":["../../../src/canvas/utils/createPreviewNode.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,IAAI,EACT,KAAK,IAAI,EACT,QAAQ,EACR,KAAK,iBAAiB,EACvB,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"createPreviewNode.d.ts","sourceRoot":"","sources":["../../../src/canvas/utils/createPreviewNode.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,IAAI,EACT,KAAK,IAAI,EACT,QAAQ,EACR,KAAK,iBAAiB,EACvB,MAAM,0CAA0C,CAAC;AAiMlD,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,MAAM,EACtB,iBAAiB,EAAE,iBAAiB,EACpC,QAAQ,CAAC,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EACnC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC1B,gBAAgB,GAAE,QAAQ,GAAG,QAAmB,EAChD,eAAe,GAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAG/C,EACD,cAAc,GAAE,QAAyB,EACzC,gBAAgB,GAAE,MAAM,EAAO,GAC9B;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,GAAG,IAAI,CA2FnC;AAMD,wBAAgB,uBAAuB,CACrC,OAAO,EAAE;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,EACnC,iBAAiB,EAAE,iBAAiB,GACnC,IAAI,CAcN;AAKD,wBAAgB,0BAA0B,CAAC,iBAAiB,EAAE,iBAAiB,GAAG,IAAI,CAGrF"}
|
|
@@ -100,7 +100,11 @@ function calculateAutoPosition(sourceNode, handlePosition, previewNodeSize, exis
|
|
|
100
100
|
};
|
|
101
101
|
direction = 'right';
|
|
102
102
|
}
|
|
103
|
-
|
|
103
|
+
const overflowDirection = {
|
|
104
|
+
x: anchorX >= sourceAbsolutePosition.x + sourceWidth / 2 ? 'right' : 'left',
|
|
105
|
+
y: anchorY >= sourceAbsolutePosition.y + sourceHeight / 2 ? 'down' : 'up'
|
|
106
|
+
};
|
|
107
|
+
return getNonOverlappingPositionForDirection(nodesWithAbsolutePositions, initialPosition, previewNodeSize, direction, offset, ignoredNodeTypes, overflowDirection);
|
|
104
108
|
}
|
|
105
109
|
function createPreviewNode(sourceNodeId, sourceHandleId, reactFlowInstance, position, data, sourceHandleType = 'source', previewNodeSize = {
|
|
106
110
|
width: DEFAULT_NODE_SIZE,
|