forked from didi/LogicFlow
-
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.
Merge pull request didi#1037 from towersxu/master
release 1.2.0
- Loading branch information
Showing
12 changed files
with
187 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<script> | ||
window.location.href="https://docs.logic-flow.cn" | ||
</script> |
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
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,36 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="format-detection" content="telephone=no, email=no"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<title>LOGIC FLOW</title> | ||
<link rel="stylesheet" href="/core/dist/style/index.css"> | ||
<!-- <link rel="stylesheet" href="http://0.0.0.0:9099/src/style/index.css"> --> | ||
<link rel="stylesheet" href="/extension/src/style/index.css"> | ||
<style> | ||
html,body { | ||
padding: 0; | ||
margin: 0; | ||
} | ||
body { | ||
background-color: #FFF; | ||
} | ||
#app { | ||
width: 1000px; | ||
height: 1000px; | ||
border: 1px solid #efefef; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="rules-graph"> | ||
<div id="app"></div> | ||
</div> | ||
<!-- <script src="/core/dist/logic-flow.js"></script> --> | ||
<script src="http://localhost:9093/logic-flow.js"></script> | ||
<script src="/Menu.js"></script> | ||
<script src="./index.js"></script> | ||
|
||
</body> | ||
</html> |
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,95 @@ | ||
window.addEventListener('DOMContentLoaded', () => { | ||
const lf = new LogicFlow({ | ||
container: document.querySelector('#app'), | ||
edgeTextDraggable: true, | ||
nodeTextDraggable: true, | ||
grid: { | ||
type: 'dot', | ||
size: 20, | ||
}, | ||
keyboard: { | ||
enabled: true, | ||
}, | ||
plugins: [Menu], | ||
pluginsOptions: { | ||
MiniMap: { | ||
width: 200, | ||
height: 170, | ||
headerTitle: '缩略图', | ||
topPosition: 20, | ||
rightPosition: 20, | ||
bottomPosition: 100, | ||
} | ||
}, | ||
snapline: true, | ||
}); | ||
lf.register({ | ||
type: 'x-node', | ||
view: RectNode, | ||
model: RectNodeModel, | ||
}) | ||
lf.extension.menu.addMenuConfig({ | ||
nodeMenu: [ | ||
{ | ||
text: "分享", | ||
callback() { | ||
alert("分享成功!"); | ||
} | ||
}, | ||
{ | ||
text: "属性", | ||
callback(node) { | ||
alert(` | ||
节点id:${node.id} | ||
节点类型:${node.type} | ||
节点坐标:(x: ${node.x}, y: ${node.y})`); | ||
} | ||
} | ||
], | ||
edgeMenu: [ | ||
{ | ||
text: "属性", | ||
callback(edge) { | ||
alert(` | ||
边id:${edge.id} | ||
边类型:${edge.type} | ||
边坐标:(x: ${edge.x}, y: ${edge.y}) | ||
源节点id:${edge.sourceNodeId} | ||
目标节点id:${edge.targetNodeId}`); | ||
} | ||
} | ||
], | ||
graphMenu: [ | ||
{ | ||
text: "分享", | ||
callback() { | ||
alert("分享成功!"); | ||
} | ||
} | ||
] | ||
}); | ||
|
||
lf.render({ | ||
nodes: [ | ||
{ | ||
id: '1', | ||
x: 100, | ||
y: 100, | ||
type: 'rect', | ||
}, | ||
{ | ||
id: '2', | ||
x: 300, | ||
y: 200, | ||
type: 'rect', | ||
}, | ||
], | ||
edges: [ | ||
{ | ||
sourceNodeId: '1', | ||
targetNodeId: '2', | ||
type: 'polyline', | ||
} | ||
] | ||
}); | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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