You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
987 B
2 lines
987 B
const T={SEQUENCE_FLOW:1,START_EVENT:2,END_EVENT:3,USER_TASK:4,SERVICE_TASK:5,EXCLUSIVE_GATEWAY:6};function f(o){const{incoming:e,outgoing:t,properties:s,key:i}=o,{text:c,startPoint:p,endPoint:r,pointsList:E,logicFlowType:n}=s,g={id:i,type:n,sourceNodeId:e[0],targetNodeId:t[0],text:c,startPoint:p,endPoint:r,pointsList:E,properties:{}},l=["startPoint","endPoint","pointsList","text","logicFlowType"];return Object.keys(o.properties).forEach(d=>{l.indexOf(d)===-1&&(g.properties[d]=o.properties[d])}),g}function u(o){const{properties:e,key:t}=o,{x:s,y:i,text:c,logicFlowType:p}=e,r={id:t,type:p,x:s,y:i,text:c,properties:{}},E=["x","y","text","logicFlowType"];return Object.keys(o.properties).forEach(n=>{E.indexOf(n)===-1&&(r.properties[n]=o.properties[n])}),r}function x(o){const e={nodes:[],edges:[]},t=o.flowElementList;return t&&t.length>0&&t.forEach(s=>{if(s.type===T.SEQUENCE_FLOW){const i=f(s);e.edges.push(i)}else{const i=u(s);e.nodes.push(i)}}),e}export{x as toLogicFlowData};
|