Skip to content

Commit fc8ba89

Browse files
committed
Update for yFiles for HTML 2.4.0.0
1 parent e9c8881 commit fc8ba89

File tree

8 files changed

+61
-64
lines changed

8 files changed

+61
-64
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ license.json
1111
npm-debug.log*
1212
yarn-debug.log*
1313
yarn-error.log*
14+
pnpm-debug.log*
1415

1516
# Editor directories and files
1617
.idea

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ This sample application serves as a basic scaffold of how to integrate [yFiles f
88

99
## Version Information
1010

11-
- Vue CLI v4.4.1
12-
- yFiles for HTML 2.3
11+
- Vue CLI v4.5
12+
- yFiles for HTML 2.4
1313

1414
## Getting Started
1515

babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
presets: ['@vue/cli-plugin-babel/preset']
2+
presets: ['@vue/cli-plugin-babel/preset'],
33
}

integration-howto.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ TL;DR Add yFiles as a dependency in the `package.json` and start importing yFile
66

77
## Create a default Vue CLI application
88

9-
At first, create a default Vue CLI app by running `> vue create yfiles-vue-integration-basic` with the default option: `default (babel, eslint)`.
9+
At first, create a default Vue CLI app by running `> vue create yfiles-vue-integration-basic` with the default option: `default ([Vue 2] babel, eslint)`.
1010

1111
## Add yFiles as a dependency
1212

@@ -24,7 +24,7 @@ Adding yFiles as a dependency is as easy as installing an external library from
2424
```
2525
"dependencies": {
2626
...
27-
"yfiles": "../yFiles-for-HTML-Complete-2.3.0.3-Evaluation/lib-dev/es-modules/yfiles-23.0.2-eval-dev.tgz"
27+
"yfiles": "../yFiles-for-HTML-Complete-2.4.0.0-Evaluation/lib-dev/es-modules/yfiles-24.0.0-eval-dev.tgz"
2828
},
2929
```
3030
@@ -43,7 +43,6 @@ With the yFiles dependency, you can easily create a new Vue component with a yFi
4343
There are two things to look out for:
4444
4545
- Make sure to configure your `license.json` for the library. This project assumes that there is a yFiles package next to the project's root. Therefore, you may need to change the referenced path in `GraphComponent.vue`.
46-
- Make sure to include `yfiles.css` which is an integral part of the library. For example add `@import '~yfiles/yfiles.css';` as in `GraphComponent.vue`.
4746
4847
2. Add the new Vue component to the `App.vue` that was created by the Vue CLI.
4948

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,25 @@
44
"author": "yWorks GmbH <[email protected]>",
55
"private": true,
66
"scripts": {
7-
"preinstall": "cd ../yFiles-for-HTML-Complete-2.3.0.4-Evaluation && npm run prepare-package",
8-
"postinstall": "node -e \"require('fs').copyFileSync('../yFiles-for-HTML-Complete-2.3.0.4-Evaluation/lib/license.json','./src/license.json')\"",
7+
"preinstall": "cd ../yFiles-for-HTML-Complete-2.4.0.0-Evaluation && npm run prepare-package",
8+
"postinstall": "node -e \"require('fs').copyFileSync('../yFiles-for-HTML-Complete-2.4.0.0-Evaluation/lib/license.json','./src/license.json')\"",
99
"serve": "vue-cli-service serve",
1010
"build": "vue-cli-service build",
1111
"lint": "vue-cli-service lint"
1212
},
1313
"dependencies": {
14-
"core-js": "^3.8.1",
15-
"vue": "^2.6.12",
16-
"yfiles": "../yFiles-for-HTML-Complete-2.3.0.4-Evaluation/lib-dev/es-modules/yfiles-23.0.4-eval-dev.tgz"
14+
"core-js": "^3.15.1",
15+
"vue": "^2.6.14",
16+
"yfiles": "../yFiles-for-HTML-Complete-2.4.0.0-Evaluation/lib-dev/es-modules/yfiles-24.0.0-eval-dev.tgz"
1717
},
1818
"devDependencies": {
19-
"@vue/cli-plugin-babel": "^4.5.9",
20-
"@vue/cli-plugin-eslint": "^4.5.9",
21-
"@vue/cli-service": "^4.5.9",
19+
"@vue/cli-plugin-babel": "^4.5.13",
20+
"@vue/cli-plugin-eslint": "^4.5.13",
21+
"@vue/cli-service": "^4.5.13",
2222
"babel-eslint": "^10.1.0",
23-
"eslint": "^7.15.0",
24-
"eslint-plugin-vue": "^7.3.0",
25-
"vue-template-compiler": "^2.6.12"
23+
"eslint": "^7.29.0",
24+
"eslint-plugin-vue": "^7.12.1",
25+
"vue-template-compiler": "^2.6.14"
2626
},
2727
"eslintConfig": {
2828
"root": true,

src/App.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div id="app">
33
<div class="header">
4-
<img alt="yFiles logo" src="./assets/yfiles-logo.svg">
4+
<img alt="yFiles logo" src="./assets/yfiles-logo.svg" />
55
<h1>A Basic yFiles Integration in Vue.js</h1>
66
</div>
77
<graph-component></graph-component>
@@ -14,8 +14,8 @@ import GraphComponent from './components/GraphComponent.vue'
1414
export default {
1515
name: 'app',
1616
components: {
17-
GraphComponent
18-
}
17+
GraphComponent,
18+
},
1919
}
2020
</script>
2121

src/components/GraphComponent.vue

Lines changed: 40 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -4,53 +4,50 @@
44
</template>
55

66
<script>
7-
import { GraphComponent, GraphEditorInputMode, License, Point, Rect } from 'yfiles'
8-
import licenseData from '../license.json'
9-
10-
License.value = licenseData
11-
12-
export default {
13-
name: 'GraphComponent',
14-
mounted() {
15-
// instantiate a new GraphComponent
16-
this.graphComponent = new GraphComponent('#graph-component')
17-
18-
// configure an input mode for out of the box editing
19-
this.graphComponent.inputMode = new GraphEditorInputMode()
20-
21-
// create some graph elements
22-
this.createSampleGraph(this.graphComponent.graph)
23-
24-
// center the newly created graph
25-
this.graphComponent.fitGraphBounds()
7+
import { GraphComponent, GraphEditorInputMode, License, Point, Rect } from 'yfiles'
8+
import licenseData from '../license.json'
9+
10+
License.value = licenseData
11+
12+
export default {
13+
name: 'GraphComponent',
14+
mounted() {
15+
// instantiate a new GraphComponent
16+
this.graphComponent = new GraphComponent('#graph-component')
17+
18+
// configure an input mode for out of the box editing
19+
this.graphComponent.inputMode = new GraphEditorInputMode()
20+
21+
// create some graph elements
22+
this.createSampleGraph(this.graphComponent.graph)
23+
24+
// center the newly created graph
25+
this.graphComponent.fitGraphBounds()
26+
},
27+
methods: {
28+
createSampleGraph(graph) {
29+
// create some nodes
30+
const node1 = graph.createNodeAt(new Point(30, 30))
31+
const node2 = graph.createNodeAt(new Point(150, 30))
32+
const node3 = graph.createNode(new Rect(230, 200, 60, 30))
33+
34+
// create some edges between the nodes
35+
graph.createEdge(node1, node2)
36+
graph.createEdge(node1, node3)
37+
const edge = graph.createEdge(node2, node3)
38+
// Creates the first bend for edge at (260, 30)
39+
graph.addBend(edge, new Point(260, 30))
40+
41+
// add labels to some graph elements
42+
graph.addLabel(node1, 'n1')
43+
graph.addLabel(node2, 'n2')
44+
graph.addLabel(node3, 'n3')
2645
},
27-
methods: {
28-
createSampleGraph(graph) {
29-
// create some nodes
30-
const node1 = graph.createNodeAt(new Point(30, 30))
31-
const node2 = graph.createNodeAt(new Point(150, 30))
32-
const node3 = graph.createNode(new Rect(230, 200, 60, 30))
33-
34-
// create some edges between the nodes
35-
graph.createEdge(node1, node2)
36-
graph.createEdge(node1, node3)
37-
const edge = graph.createEdge(node2, node3)
38-
// Creates the first bend for edge at (260, 30)
39-
graph.addBend(edge, new Point(260, 30))
40-
41-
// add labels to some graph elements
42-
graph.addLabel(node1, 'n1')
43-
graph.addLabel(node2, 'n2')
44-
graph.addLabel(node3, 'n3')
45-
}
46-
}
47-
}
46+
},
47+
}
4848
</script>
4949

5050
<style scoped>
51-
/* yfiles.css is an integral part of the library and must be loaded wherever a yFiles GraphComponent is created */
52-
@import '~yfiles/yfiles.css';
53-
5451
#graph-component {
5552
width: 500px;
5653
height: 500px;

src/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ import App from './App.vue'
44
Vue.config.productionTip = false
55

66
new Vue({
7-
render: h => h(App)
7+
render: (h) => h(App),
88
}).$mount('#app')

0 commit comments

Comments
 (0)