@@ -435,16 +435,57 @@ const lf = new LogicFlow({
435435``` js
436436// 渲染数据
437437lf .render ({
438- nodes: [
439- { id: ' Event_1234567' , type: ' bpmn:startEvent' , x: 100 , y: 100 , },
440- { id: ' Task_123ac56' , type: ' bpmn:userTask' , x: 300 , y: 100 , },
441- { id: ' Event_fa4c699' , type: ' bpmn:endEvent' , x: 500 , y: 100 , },
442- ],
443- edges: [
444- { id: ' Flow_12ac567' , sourceNodeId: ' Event_123ac56' , targetNodeId: ' Task_123ac56' , type: ' bpmn:sequenceFlow' , },
445- { id: ' Flow_fa4c689' , sourceNodeId: ' Task_123ac56' , targetNodeId: ' Event_fa4c699' , type: ' bpmn:sequenceFlow' , },
446- ],
447- })
438+ " bpmn:definitions" : {
439+ " -id" : " Definitions_09b7413" ,
440+ " -xmlns:xsi" : " http://www.w3.org/2001/XMLSchema-instance" ,
441+ " -xmlns:bpmn" : " http://www.omg.org/spec/BPMN/20100524/MODEL" ,
442+ " -xmlns:bpmndi" : " http://www.omg.org/spec/BPMN/20100524/DI" ,
443+ " -xmlns:dc" : " http://www.omg.org/spec/DD/20100524/DC" ,
444+ " -xmlns:di" : " http://www.omg.org/spec/DD/20100524/DI" ,
445+ " -targetNamespace" : " http://logic-flow.org" ,
446+ " -exporter" : " logicflow" ,
447+ " -exporterVersion" : " 1.2.0" ,
448+ " bpmn:process" : {
449+ " -isExecutable" : " true" ,
450+ " -id" : " Process_f5f16a1" ,
451+ " bpmn:startEvent" : {
452+ " -id" : " Event_5d74c17" ,
453+ " -name" : " 开始" ,
454+ " -width" : 36 ,
455+ " -height" : 36
456+ },
457+ " bpmn:sequenceFlow" : []
458+ },
459+ " bpmndi:BPMNDiagram" : {
460+ " -id" : " BPMNDiagram_1" ,
461+ " bpmndi:BPMNPlane" : {
462+ " -id" : " BPMNPlane_1" ,
463+ " -bpmnElement" : " Process_f5f16a1" ,
464+ " bpmndi:BPMNEdge" : [],
465+ " bpmndi:BPMNShape" : [
466+ {
467+ " -id" : " Event_5d74c17_di" ,
468+ " -bpmnElement" : " Event_5d74c17" ,
469+ " dc:Bounds" : {
470+ " -x" : 547.98828125 ,
471+ " -y" : 133.98828125 ,
472+ " -width" : 40 ,
473+ " -height" : 40
474+ },
475+ " bpmndi:BPMNLabel" : {
476+ " dc:Bounds" : {
477+ " -x" : 557.98828125 ,
478+ " -y" : 186.98828125 ,
479+ " -width" : 20 ,
480+ " -height" : 14
481+ }
482+ }
483+ }
484+ ]
485+ }
486+ }
487+ }
488+ )
448489// 生成BPMN XML数据并下载到本地
449490const handleDownloadData = () => {
450491 const retainedFields = [' width' , ' height' ]
@@ -1287,17 +1328,25 @@ const lf = new LogicFlow({
128713282. 使用插件进行数据转换
12881329` ` ` js
12891330// 渲染数据
1290- lf .render ({
1291- nodes: [
1292- { id: ' Event_1234567' , type: ' bpmn:startEvent' , x: 100 , y: 100 , },
1293- { id: ' Task_123ac56' , type: ' bpmn:userTask' , x: 300 , y: 100 , },
1294- { id: ' Event_fa4c699' , type: ' bpmn:endEvent' , x: 500 , y: 100 , },
1295- ],
1296- edges: [
1297- { id: ' Flow_12ac567' , sourceNodeId: ' Event_123ac56' , targetNodeId: ' Task_123ac56' , type: ' bpmn:sequenceFlow' , },
1298- { id: ' Flow_fa4c689' , sourceNodeId: ' Task_123ac56' , targetNodeId: ' Event_fa4c699' , type: ' bpmn:sequenceFlow' , },
1299- ],
1300- })
1331+ lf .render (`
1332+ <bpmn:definitions id="Definitions_48012e2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" targetNamespace="http://logic-flow.org" exporter="logicflow" exporterVersion="1.2.0">
1333+ <bpmn:process isExecutable="true" id="Process_0482d02">
1334+ <bpmn:startEvent id="Event_5d74c17" name="开始" width="36" height="36">
1335+ <businessData name="开始流程" />
1336+ </bpmn:startEvent>
1337+ </bpmn:process>
1338+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
1339+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_0482d02">
1340+ <bpmndi:BPMNShape id="Event_5d74c17_di" bpmnElement="Event_5d74c17">
1341+ <dc:Bounds x="547.98828125" y="133.98828125" width="40" height="40" />
1342+ <bpmndi:BPMNLabel>
1343+ <dc:Bounds x="557.98828125" y="186.98828125" width="20" height="14" />
1344+ </bpmndi:BPMNLabel>
1345+ </bpmndi:BPMNShape>
1346+ </bpmndi:BPMNPlane>
1347+ </bpmndi:BPMNDiagram>
1348+ </bpmn:definitions>
1349+ ` )
13011350// 生成BPMN XML数据并下载到本地
13021351const handleDownloadData = () => {
13031352 const retainedFields = [' width' , ' height' ]
0 commit comments