forked from gwenaelp/vue-diagrams
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add read-only mode for the componets
Added boolean props to components, depending on the prop value diagram nodes and links become immovable gwenaelp#8
- Loading branch information
Showing
5 changed files
with
98 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { storiesOf } from "@storybook/vue"; | ||
import Diagram from "../src/components/Diagram"; | ||
|
||
// Add more stories here to live develop your components | ||
storiesOf("Diagram", module).add("Readonly mode", () => ({ | ||
data() { | ||
const diagramModel = new Diagram.Model(); | ||
|
||
const node1 = diagramModel.addNode("test2", 300, 200); | ||
const inPort = node1.addInPort("test"); | ||
|
||
const node2 = diagramModel.addNode("test", 10, 300, 144, 80); | ||
const node2OutPort = node2.addOutPort("testOut"); | ||
node2.addOutPort("testOut2"); | ||
node2.color = "#00cc66"; | ||
|
||
const node3 = diagramModel.addNode("test3", 10, 100, 72, 100); | ||
const node3OutPort = node3.addOutPort("testOut3"); | ||
node3.color = "#cc6600"; | ||
node3.deletable = false; | ||
|
||
diagramModel.addLink(node2OutPort, inPort); | ||
diagramModel.addLink(node3OutPort, inPort); | ||
|
||
return { | ||
model: diagramModel | ||
}; | ||
}, | ||
template: `<diagram :model="model" gridSnap="16" :readonly-links="false" :readonly-nodes="true"></diagram>` | ||
})); |