0.3.3 • Published 5 years ago
diagram-vue v0.3.3
diagram-vue
A SVG-based diagram component for Vue
Installation
npm i diagram-vue --saveUsage
Ready-to-use editor
1. Import
import { DiagramEditor } from "diagram-vue";
import "diagram-vue/dist/diagram.css";2. Template
<DiagramEditor v-model="graph"></DiagramEditor>See Data specification.
Customization
1. Import
import Diagram from 'diagram-vue';
import "diagram-vue/dist/diagram.css";2. Template
<Diagram
:width="2000"
:height="1000"
:fluid="false"
scale="1"
background="#fafafa"
:nodes="nodes"
:links="links"
:editable="editable"
:labels="{
edit: 'Edit',
remove: 'Remove',
link: 'Link',
select: 'Select',
cancel: 'Cancel'
}"
@editNode="editNode"
@editLink="editLink"
@nodeChanged="nodeChanged"
@linkChanged="linkChanged"
>
</Diagram>3. Props
props: {
width: Number,
height: Number,
background: String,
nodes: Array,
links: Array,
editable: Boolean,
labels: Object,
fluid: Boolean
}See Data specification.
4. Events
editNode(node /* selected node */) {
/* event handler */
},
editLink(link /* selected link */) {
/* event handler */
},
nodeChanged(obj /* array of nodes */) {
/* event handler */
const nodes = obj.nodes
},
linkChanged(obj /* array of links */) {
/* event handler */
const links = obj.links
}5. Get SVG as String
Use plain JavaScript.
document.getElementById('svg-diagram-show-area').innerHTML; // <svg ...>...</svg>Development
Development Environment
Project setup
yarn installCompiles and hot-reloads for development
yarn run serveCompiles and minifies for production
yarn run buildRun your tests
yarn run testLints and fixes files
yarn run lintRun your end-to-end tests
yarn run test:e2eRun your unit tests
yarn run test:unitCustomize configuration
0.3.3
5 years ago
0.3.2
5 years ago
0.3.0
6 years ago
0.2.3
6 years ago
0.2.2
6 years ago
0.2.1
6 years ago
0.2.0
6 years ago
0.1.11
6 years ago
0.1.10
6 years ago
0.1.9
7 years ago
0.1.8
7 years ago
0.1.7
7 years ago
0.1.6
7 years ago
0.1.5
7 years ago
0.1.4
7 years ago
0.1.3
7 years ago
0.1.2
7 years ago
0.1.1
7 years ago
0.1.0
7 years ago
0.0.11
7 years ago
0.0.10
7 years ago
0.0.9
7 years ago
0.0.8
7 years ago
0.0.7
7 years ago
0.0.6
7 years ago
0.0.5
7 years ago
0.0.4
7 years ago
0.0.3
7 years ago
0.0.2
7 years ago
0.0.1
7 years ago