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
2.8 KiB
2 lines
2.8 KiB
var b=Object.defineProperty;var N=Object.getOwnPropertySymbols;var D=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable;var I=(s,r,n)=>r in s?b(s,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):s[r]=n,h=(s,r)=>{for(var n in r||(r={}))D.call(r,n)&&I(s,n,r[n]);if(N)for(var n of N(r))v.call(r,n)&&I(s,n,r[n]);return s};import{G as U}from"./html-a2da55a6.js";import{getNodeTemplateByType as w}from"./x6Shapes-9ea647b1.js";import{connectConfig as x}from"./x6Config-e7abb0b2.js";import M from"./BSEntity-840a884b.js";import{r as S}from"./index-f4658ae7.js";import"./_createCompounder-ed41a610.js";import"./merge-15067256.js";import"./_baseFor-37716d03.js";import"./_createAssigner-77c8874c.js";import"./difference-bddb49bc.js";import"./_createAggregator-c692fd07.js";import"./_baseEach-1e26df34.js";import"./_baseMap-457e4262.js";import"./isNumber-0bc0d001.js";import"./throttle-35369e52.js";import"./OrderedListOutlined-6126615f.js";import"./ParamsUtils-3cbc5822.js";import"./ParamUtils-cdc24dd6.js";function j(){const s=S(),r=(p,a,d,o=!1)=>{s.value=new U({container:p,width:a,height:d,background:{color:"#f2f5f7"},panning:{enabled:!0,modifiers:["alt","shift"]},interacting:{nodeMovable:!o},mousewheel:{enabled:!0,zoomAtMousePosition:!0,modifiers:"ctrl",minScale:.5,maxScale:3},connecting:h({},x),highlighting:{magnetAdsorbed:{name:"stroke",args:{attrs:{fill:"#f2f5f7",stroke:"#5555ff"}}}}})},n=(p,a)=>{const d=p.map(i=>parseInt(i.NodeID)),o=[];for(const i of a)(!d.includes(i.Node)||!d.includes(i.ToNode))&&o.push(i.MyPK);return o.length>0&&o.forEach(i=>{new M("BP.WF.Template.Direction",i).Delete()}),a.filter(i=>!o.includes(i.MyPK))},y=p=>{const a=/[\u4e00-\u9fa5]/g,d=p.match(a),o=(d==null?void 0:d.length)||0;return o*12+(p.length-o)*7};return{graph:s,convertData:(p,a,d)=>{var m,i,f;const o={nodes:[],edges:[]};a=n(p,a);for(const e of p){const c=w(e.NodeType,e.RunModel);if(!c)continue;const t=JSON.parse(JSON.stringify(c));t.id=e.NodeID,t.label=e.Name,t.attrs.id=e.NodeID,t.attrs.label=e.Name,e.UIWidth>t.width&&(t.width=e.UIWidth),e.UIHeight>t.height&&(t.height=e.UIHeight),e.UIAngle>0&&(t.angle=e.UIAngle),t.x=e.X,t.y=e.Y,t.ports.items=t.ports.items.map(l=>({group:l.group,id:e.NodeID+"-"+l.group})),t.data=e,t.tools=[{name:"node-editor"}],(m=o.nodes)==null||m.push(t)}for(const e of d)(i=o.nodes)==null||i.push({shape:"graph-tag",x:e.X,y:e.Y,size:{width:y(e.Name),height:20},data:h({},e),id:e.MyPK});for(const e of a){let c=[];if(typeof e.Vertices=="string"&&e.Vertices.length>0)try{c=e.Vertices.split("|").map(g=>{const u=g.split(",");return{x:parseInt(u[0]||0),y:parseInt(u[1]||0)}})}catch(g){c=[]}const t=e.Node+"",l=e.ToNode+"";(f=o.edges)==null||f.push({shape:"edge",source:t,target:l,label:e.Des,router:"manhattan",snap:{radius:0},attrs:{line:{stroke:"#999",strokeWidth:2},dataSource:e},vertices:c})}return o},initGraph:r}}export{j as useX6Graph};
|