Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
vue-flow-editor
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2024-02-22 15:16:50 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c9f790b3e7744b1f895c6e19c299678516e10a8e
c9f790b3
1 parent
4f8a886a
fix
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
48 deletions
doc/App.vue
src/editor/vue-flow-editor-canvas-form.tsx
doc/App.vue
View file @
c9f790b
...
...
@@ -501,7 +501,6 @@
</div>
<template #footer>
<span class="dialog-footer">
<!~~ <el-button @click="state.dialogPreviewVisible = false">取消</el-button> ~~>
<el-button color="#009688" @click="state.dialogPreviewVisible = false">关闭</el-button>
</span>
</template>
...
...
@@ -821,7 +820,7 @@ export default {
// 内部刷新graph数据
nextTick(() => {
editor.editorState.graph.read(flowData.value)
editor1?.editorState.graph.read(rawFlowData.value)
editor1?.editorState.graph
?
.read(rawFlowData.value)
});
}
...
...
@@ -2324,7 +2323,7 @@ export default {
$('.preview-container').find('.g6-grid').parent().css('zIndex', '0');
$('.preview-container').find('canvas').css('zIndex', '1').css('position', 'relative');
})
},
5
00);
},
10
00);
}
/**
...
...
@@ -2336,13 +2335,11 @@ export default {
console.warn('点击节点,如果预览状态,可以预览表单内容');
const model = G6.Util.clone(e.item.get('model')); // 节点的基本属性
console.log("🚀 ~ file: App.vue:2338 ~ onClickNodePreview ~ model.id:", model.id);
model.style = model.style || {}
model.labelCfg = model.labelCfg || { style: {} }
model.data = model.data ? model.data : {};
// state.detailModel = model;
console.warn(model);
if (model.id === 'end-node' || model.id === 'start-node') {
ElNotification.error('该节点无法预览');
state.preview_form_url = null;
...
...
src/editor/vue-flow-editor-canvas-form.tsx
View file @
c9f790b
...
...
@@ -29,51 +29,52 @@ export default {
editorState.graph.destroy()
}
const target = proxy.$refs.target as HTMLElement
const {offsetHeight: height, offsetWidth: width} = proxy.$refs.root as HTMLElement
const behaviors = useBehavior({
multipleSelect: editorState.props.multipleSelect,
dragEdge: {
disabled: editorState.props.disabledDragEdge,
beforeAdd: editorState.props.beforeAdd,
afterAdd: editorState.props.afterAdd,
if (proxy.$refs.root) {
const {offsetHeight: height, offsetWidth: width} = proxy.$refs.root as HTMLElement
const behaviors = useBehavior({
multipleSelect: editorState.props.multipleSelect,
dragEdge: {
disabled: editorState.props.disabledDragEdge,
beforeAdd: editorState.props.beforeAdd,
afterAdd: editorState.props.afterAdd,
}
})
const graph = new G6.Graph({
container: target as HTMLElement,
width,
height,
modes: {
edit: [
...behaviors,
],
},
...GraphStyle.default,
})
const $read = graph.read
graph.read = (data) => {
let {nodes, edges} = data || {}
nodes = nodes || []
edges = edges || []
// TAG: 自定义节点 更新Model
nodes.forEach(node => formatNodeModel(node, editorProps.activityConfig))
nodes.forEach(node => formatNodeModel_control(node, editorProps.controlConfig))
data = {nodes, edges}
$read.apply(graph, [data])
}
})
const graph = new G6.Graph({
container: target as HTMLElement,
width,
height,
modes: {
edit: [
...behaviors,
],
},
...GraphStyle.default,
})
const $read = graph.read
graph.read = (data) => {
let {nodes, edges} = data || {}
nodes = nodes || []
edges = edges || []
// TAG: 自定义节点 更新Model
nodes.forEach(node => formatNodeModel(node, editorProps.activityConfig))
nodes.forEach(node => formatNodeModel_control(node, editorProps.controlConfig))
data = {nodes, edges}
$read.apply(graph, [data])
graph.setMode('edit')
graph.read(props.data)
useEditorPlugins(props, graph)
editorState.setGraph(graph)
}
graph.setMode('edit')
graph.read(props.data)
useEditorPlugins(props, graph)
editorState.setGraph(graph)
})
// const target = proxy.$refs.target as HTMLElement
...
...
Please
register
or
login
to post a comment