Skip to content

Commit 2f69845

Browse files
authored
Merge pull request #14 from yWorks/dev
2 parents 41aa45c + 9f14c90 commit 2f69845

File tree

4 files changed

+28
-15
lines changed

4 files changed

+28
-15
lines changed

doc/src/content/introduction/GettingStarted.mdx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ to yFiles is to use the [yFiles Dev Suite](https://www.npmjs.com/package/yfiles-
2424
from scratch, we recommend using vite:
2525

2626
```bash
27-
npm create vite@6.1.1 my-yfiles-layout-app -- --template react-ts
27+
npm create vite@latest my-yfiles-layout-app -- --template react-ts
2828
```
2929

3030
Install the `@xyflow/react` package:
@@ -34,7 +34,7 @@ to yFiles is to use the [yFiles Dev Suite](https://www.npmjs.com/package/yfiles-
3434

3535
Add the yFiles dependency:
3636
```bash
37-
npm install <yFiles package path>/lib/yfiles-30.0.0+dev.tgz
37+
npm install <yFiles package path>/lib-dev/yfiles-30.0.4+dev.tgz
3838
```
3939

4040
<details>
@@ -46,8 +46,8 @@ to yFiles is to use the [yFiles Dev Suite](https://www.npmjs.com/package/yfiles-
4646
dependencies: {
4747
"react": "^19.2.0",
4848
"react-dom": "^19.2.0",
49-
"@xyflow/react": "^12.9.3",
50-
"@yfiles/yfiles": "./lib/yfiles-30.0.0+dev.tgz"
49+
"@xyflow/react": "^12.10.0",
50+
"@yfiles/yfiles": "./lib-dev/yfiles-30.0.4+dev.tgz"
5151
}
5252
```
5353
</details>
@@ -102,8 +102,6 @@ to yFiles is to use the [yFiles Dev Suite](https://www.npmjs.com/package/yfiles-
102102
import { ReactFlow,
103103
addEdge,
104104
Connection,
105-
EdgeProps,
106-
NodeProps,
107105
Panel,
108106
ReactFlowProvider,
109107
useEdgesState,

doc/src/content/layouts/HierarchicalLayout.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ the (majority of) edges of the graph show the same overall orientation, for exam
1414
the ordering of the nodes within each layer is chosen in such a way that the number of edge crossings is small.
1515

1616
<div style={{display: 'flex', flexDirection: 'row', flexWrap: 'wrap', gap: '10px', justifyContent: 'center', margin: '40px 0'}}>
17-
<img src={`${import.meta.env.BASE_URL}/hierarchic-layout.png`} style={{maxWidth: "80%", objectFit: "cover"}} alt="Hierachic layout with groups"></img>
17+
<img src={`${import.meta.env.BASE_URL}/hierarchic-layout.png`} style={{maxWidth: "80%", objectFit: "cover"}} alt="Hierarchical layout with groups"></img>
1818
</div>
1919

2020
The hierarchical layout algorithm offers extensive customization options through a wide array of properties accessible
@@ -126,7 +126,8 @@ const nodeTypes = {
126126
useNodesMeasuredEffect(() =>
127127
runLayout({
128128
name: "HierarchicalLayout",
129-
layoutOptions
129+
layoutOptions,
130+
layoutData
130131
})
131132
)
132133

yfiles-layout-reactflow/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ to yFiles is to use the [yFiles Dev Suite](https://www.npmjs.com/package/yfiles-
3232
from scratch, we recommend using vite:
3333

3434
```bash
35-
npm create vite@6.1.1 my-yfiles-layout-app -- --template react-ts
35+
npm create vite@latest my-yfiles-layout-app -- --template react-ts
3636
```
3737

3838
Install the ReactFlow:
@@ -42,7 +42,7 @@ to yFiles is to use the [yFiles Dev Suite](https://www.npmjs.com/package/yfiles-
4242

4343
Add the yFiles dependency:
4444
```bash
45-
npm install <yFiles package path>/lib/yfiles-30.0.0+dev.tgz
45+
npm install <yFiles package path>/lib-dev/yfiles-30.0.4+dev.tgz
4646
```
4747

4848
<details>
@@ -52,10 +52,10 @@ to yFiles is to use the [yFiles Dev Suite](https://www.npmjs.com/package/yfiles-
5252

5353
```json
5454
dependencies: {
55-
"react": "^18.2.0",
56-
"react-dom": "^18.2.0",
57-
"reactflow": "^11.11.0",
58-
"@yfiles/yfiles": "./lib/yfiles-30.0.0+dev.tgz"
55+
"react": "^19.2.0",
56+
"react-dom": "^19.2.0",
57+
"@xyflow/react": "^12.10.0",
58+
"@yfiles/yfiles": "./lib-dev/yfiles-30.0.4+dev.tgz"
5959
}
6060
```
6161
</details>

yfiles-layout-reactflow/src/layout/layout-algorithms.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ function translateEdgeLabelPreferredPlacement(
284284
}
285285

286286
function getGroupNodePadding(node: INode, rootElement: HTMLElement): YFilesInsets {
287-
const nodeElement = rootElement.querySelector(`[data-id="${node.tag.id}"]`)
287+
const nodeElement = getNodeElementById(rootElement, node.tag.id)
288288
if (nodeElement) {
289289
const computedStyle = window.getComputedStyle(nodeElement)
290290
const paddingTop = parseInt(computedStyle.getPropertyValue('padding-top')) ?? 0
@@ -296,6 +296,20 @@ function getGroupNodePadding(node: INode, rootElement: HTMLElement): YFilesInset
296296
return new YFilesInsets(0, 0, 0, 0)
297297
}
298298

299+
function getNodeElementById(rootElement: HTMLElement, id: string): Element | null {
300+
const elements = rootElement.querySelectorAll(`[data-id="${id}"]`)
301+
if (elements.length > 1) {
302+
// distinguish between react-flow nodes and edges
303+
const element = elements
304+
.values()
305+
.find(element => element.classList.toString().includes('react-flow__node'))
306+
if (element) {
307+
return element
308+
}
309+
}
310+
return elements.item(0)
311+
}
312+
299313
export function getRootNode(
300314
reactFlowRef?: RefObject<HTMLElement>
301315
): Element | Document | DocumentFragment {

0 commit comments

Comments
 (0)