Skip to content

Commit aea68c5

Browse files
authored
Merge pull request #8 from yWorks/dev
2.0.0 - yFiles for HTML 3.0
2 parents 929b0be + f2da723 commit aea68c5

25 files changed

+336
-338
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ You can learn how to work with the yFiles npm module in our [Developer’s Guide
3131
In addition to yFiles, the Supply Chain component requires React to be installed in your project.
3232
If you want to start your project from scratch, we recommend using vite:
3333
```
34-
npm create vite@latest my-supply-chain-app -- --template react-ts
34+
npm create vite@6.1.1 my-supply-chain-app -- --template react-ts
3535
```
3636

3737
Add the yFiles dependency:
3838
```
39-
npm install <yFiles package path>/lib-dev/yfiles-26.0.0+dev.tgz
39+
npm install <yFiles package path>/lib/yfiles-30.0.0+dev.tgz
4040
```
4141

4242
<details>
@@ -48,7 +48,7 @@ You can learn how to work with the yFiles npm module in our [Developer’s Guide
4848
"dependencies": {
4949
"react": "^18.2.0",
5050
"react-dom": "^18.2.0",
51-
"yfiles": "./lib-dev/yfiles-26.0.0.tgz"
51+
"yfiles": "./lib/yfiles-30.0.0+dev.tgz"
5252
}
5353
```
5454
</details>

docs/introduction/GettingStarted.mdx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ section: 1
44
tags: []
55
---
66
import TypeLink from '../../components/TypeLink.astro'
7+
import Video from '../../components/Video.astro'
8+
import videoImage from './yt-react-components_supply-chain.png'
79

810
# Getting Started
11+
<Video image={videoImage} url="https://youtu.be/NHF03g1tDWE"/>
912

1013
## Prerequisites
1114

@@ -23,12 +26,12 @@ You can learn how to work with the yFiles npm module in our [Developer’s Guide
2326
In addition to yFiles, the Supply Chain component requires React to be installed in your project.
2427
If you want to start your project from scratch, we recommend using vite:
2528
```
26-
npm create vite@latest my-supply-chain-app -- --template react-ts
29+
npm create vite@6.1.1 my-supply-chain-app -- --template react-ts
2730
```
2831

2932
Add the yFiles dependency:
3033
```
31-
npm install <yFiles package path>/lib-dev/yfiles-26.0.0+dev.tgz
34+
npm install <yFiles package path>/lib/yfiles-30.0.0+dev.tgz
3235
```
3336

3437
<details>
@@ -40,7 +43,7 @@ You can learn how to work with the yFiles npm module in our [Developer’s Guide
4043
"dependencies": {
4144
"react": "^18.2.0",
4245
"react-dom": "^18.2.0",
43-
"yfiles": "./lib-dev/yfiles-26.0.0.tgz"
46+
"yfiles": "./lib/yfiles-30.0.0+dev.tgz"
4447
}
4548
```
4649
</details>
415 KB
Loading

examples/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@yworks/react-yfiles-supply-chain-examples",
33
"private": true,
4-
"version": "0.1.0",
4+
"version": "1.0.0",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

examples/src/App/routes.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import ConnectionStyling from '../examples/connection-styling'
88
import GraphSearch from '../examples/search'
99
import SupplyChainProvider from '../examples/supply-chain-provider'
1010
import Export from '../examples/export'
11+
import SwitchData from '../examples/switch-data'
1112

1213
export interface IRoute {
1314
title: string
@@ -76,6 +77,12 @@ const routes: IRoute[] = [
7677
description: 'An example demonstrating the export to an image and printing.',
7778
path: 'graph-export',
7879
component: Export
80+
},
81+
{
82+
title: 'Switch Data',
83+
description: 'Switching to different input data with partially shared ids',
84+
path: 'switch-data',
85+
component: SwitchData
7986
}
8087
]
8188

examples/src/examples/custom-folder-style/index.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,19 @@ function RenderItem(props: RenderGroupProps<UserSupplyChainItem>) {
3737
}}
3838
>
3939
{isFolderNode && (
40-
<button onClick={() => supplyChainContext.toggleExpansionState(dataItem)}>
40+
<button
41+
onClick={() => supplyChainContext.toggleExpansionState(dataItem)}
42+
onPointerDown={event => event.preventDefault()}
43+
>
4144
Expand {dataItem.name}
4245
</button>
4346
)}
4447
{!isFolderNode && (
4548
<div style={{ display: 'flex', justifyItems: 'flex-start', alignItems: 'center' }}>
46-
<button onClick={() => supplyChainContext.toggleExpansionState(dataItem)}>
49+
<button
50+
onClick={() => supplyChainContext.toggleExpansionState(dataItem)}
51+
onPointerDown={event => event.preventDefault()}
52+
>
4753
Collapse {dataItem.name}
4854
</button>
4955
</div>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { useState } from 'react'
2+
3+
import { SupplyChain, Overview } from '@yworks/react-yfiles-supply-chain'
4+
import '@yworks/react-yfiles-supply-chain/dist/index.css'
5+
6+
import reactSample1 from './inputData/sample-simple1.json'
7+
import reactSample2 from './inputData/sample-simple2.json'
8+
9+
const SwitchData = () => {
10+
const [inputData, setInputData] = useState(reactSample2)
11+
12+
return (
13+
<div
14+
style={{
15+
display: 'flex',
16+
flexDirection: 'column',
17+
width: '1000px',
18+
height: '800px',
19+
marginTop: '50px'
20+
}}
21+
>
22+
<div style={{ textAlign: 'center', padding: 10 }}>
23+
<button
24+
onClick={() => setInputData(inputData === reactSample1 ? reactSample2 : reactSample1)}
25+
>
26+
Switch Data
27+
</button>
28+
</div>
29+
30+
<SupplyChain style={{ width: '100%' }} data={inputData}>
31+
<Overview />
32+
</SupplyChain>
33+
</div>
34+
)
35+
}
36+
37+
export default SwitchData
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"items": [
3+
{ "name": "Parent1", "id": 10 },
4+
{ "name": "Natural Resource", "id": 0, "parentId": 10 }
5+
],
6+
"connections": []
7+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"items": [
3+
{ "name": "More Natural Resource", "id": 0 }
4+
],
5+
"connections": []
6+
}

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@yworks/react-yfiles-supply-chain",
3-
"version": "1.1.0",
3+
"version": "2.0.0",
44
"author": {
55
"name": "yFiles for HTML team @ yWorks GmbH",
66
"email": "yfileshtml@yworks.com"
@@ -45,7 +45,7 @@
4545
"peerDependencies": {
4646
"react": "^18.2.0",
4747
"react-dom": "^18.2.0",
48-
"yfiles": "^26.0.0"
48+
"@yfiles/yfiles": ">=30"
4949
},
5050
"devDependencies": {
5151
"@microsoft/api-extractor": "^7.39.1",
@@ -55,7 +55,7 @@
5555
"typescript": "^5.3.2"
5656
},
5757
"dependencies": {
58-
"@yworks/react-yfiles-core": "^2.0.0"
58+
"@yworks/react-yfiles-core": "^3.0.0"
5959
},
6060
"files": [
6161
"LICENSE",

0 commit comments

Comments
 (0)