antd-management-fast-flow 1.0.77 → 1.0.80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,7 +14,4 @@ export function BackwardEdge({ id, data, sourceX, sourceY, targetX, targetY, sou
14
14
  style?: {} | undefined;
15
15
  markerEnd: any;
16
16
  }): React.JSX.Element;
17
- export namespace BackwardEdge {
18
- let defaultProps: {};
19
- }
20
17
  import React from 'react';
@@ -3,7 +3,4 @@ export class CarbonCopyEdge extends React.PureComponent<any, any, any> {
3
3
  constructor(props: any, context: any);
4
4
  render(): React.JSX.Element;
5
5
  }
6
- export namespace CarbonCopyEdge {
7
- let defaultProps: {};
8
- }
9
6
  import React from 'react';
@@ -1,5 +1,2 @@
1
1
  export function EndNode(properties: any): React.JSX.Element;
2
- export namespace EndNode {
3
- let defaultProps: {};
4
- }
5
2
  import React from 'react';
@@ -3,7 +3,4 @@ export class ForwardEdge extends React.PureComponent<any, any, any> {
3
3
  constructor(props: any, context: any);
4
4
  render(): React.JSX.Element;
5
5
  }
6
- export namespace ForwardEdge {
7
- let defaultProps: {};
8
- }
9
6
  import React from 'react';
@@ -1,5 +1,2 @@
1
1
  export function StartNode(properties: any): React.JSX.Element;
2
- export namespace StartNode {
3
- let defaultProps: {};
4
- }
5
2
  import React from 'react';
package/es/index.js CHANGED
@@ -1 +1 @@
1
- import e,{PureComponent as t,useEffect as n}from"react";import r,{getSmoothStepPath as o,BaseEdge as l,EdgeLabelRenderer as a,Handle as i,Position as c,MarkerType as p,useNodesState as s,useEdgesState as d,Controls as u,MiniMap as m,Panel as f,Background as g}from"reactflow";import{getValueByKey as y,isFunction as x,convertCollection as b,checkStringIsNullOrWhiteSpace as E,buildRandomHexColor as h,isArray as v}from"easy-soft-utility";import{Typography as k,Space as C,Divider as P,Button as w,Card as S,Alert as R,Empty as N,Timeline as O}from"antd";import{iconBuilder as z,FlexBox as A,VerticalBox as K,ColorText as L,CenterBox as j,HelpBox as T,ScrollFacadeBox as B}from"antd-management-fast-component";import Y from"classnames";function X(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,l,a,i=[],c=!0,p=!1;try{if(l=(n=n.call(e)).next,0===t);else for(;!(c=(r=l.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){p=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(p)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return X(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?X(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function D(e){return D="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},D(e)}function _(e){var t=function(e,t){if("object"!=D(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=D(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==D(t)?t:t+""}function F(e,t,n){return(t=_(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function H(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function V(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?H(Object(n),!0).forEach((function(t){F(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):H(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var q="antd-management-fast-flow",J="#4e44f2",M="#a98477",U="#ffcc00",W="#bed2bb",$="#a4baea",G="#e895d2",Q="#f66902",Z="#c2fa32",ee="#05ea7f",te={backgroundColor:G},ne={backgroundColor:Z},re={backgroundColor:ee},oe=k.Text,le=function(t){var n=t.id,r=t.data,i=t.sourceX,c=t.sourceY,p=t.targetX,s=t.targetY,d=t.sourcePosition,u=t.targetPosition,m=t.borderRadius,f=t.centerX,g=t.centerY,b=t.offset,E=t.style,h=void 0===E?{}:E,v=t.markerEnd,k=I(o({sourceX:i,sourceY:c,sourcePosition:d,targetX:p,targetY:s,targetPosition:u,borderRadius:m,centerX:f,centerY:g,offset:b}),3),P=k[0],w=k[1],S=k[2],R=V({canEdit:!1,multibranch:!1},r),N=R.data,O=R.canEdit,A=R.multibranch,K=R.onChange,L=R.onChangeBranchCondition,j=R.onRemove,T=y({data:N,key:"title"}),B=y({data:N,key:"description"});return e.createElement(e.Fragment,null,e.createElement(l,{id:n,path:P,markerEnd:v,style:h}),e.createElement(a,null,e.createElement("div",{style:{position:"absolute",transform:"translate(-50%, -50%) translate(".concat(w,"px,").concat(S,"px)"),background:W,padding:6,borderRadius:5,fontSize:12,pointerEvents:"all"},title:B||""},e.createElement(C,null,e.createElement(oe,{style:{fontSize:"12px",padding:"0.5px 2px",border:"1.2mm ridge ".concat("rgba(52, 231, 228, .6)"),color:"#666"}},T||"回退"),O?e.createElement("button",{style:{padding:"0.5px 4px",fontSize:"12px"},title:"点击变更连线",onClick:function(e){e.stopPropagation(),x(K)&&K(N)}},z.edit()):null,A?e.createElement("button",{style:{padding:"0.5px 4px",fontSize:"12px"},title:"点击变更绑定逆向连接条件",onClick:function(e){e.stopPropagation(),x(L)&&L(N)}},z.pullRequest()):null,O?e.createElement("button",{style:{padding:"0.5px 4px",fontSize:"12px"},title:"点击移除连线",onClick:function(e){e.stopPropagation(),x(j)&&j(N)}},z.delete()):null))))};function ae(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ie(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,_(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ce(e,t){if(t&&("object"==D(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function pe(e){return pe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},pe(e)}function se(e,t){return se=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},se(e,t)}function de(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&se(e,t)}function ue(e,t,n){return t=pe(t),ce(e,me()?Reflect.construct(t,n||[],pe(e).constructor):t.apply(e,n))}function me(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(me=function(){return!!e})()}le.defaultProps={};var fe=k.Text,ge=function(){function n(){return ae(this,n),ue(this,n,arguments)}return de(n,t),ie(n,[{key:"render",value:function(){var t=this.props,n=t.id,r=t.data,i=t.sourceX,c=t.sourceY,p=t.targetX,s=t.targetY,d=t.sourcePosition,u=t.targetPosition,m=t.borderRadius,f=t.centerX,g=t.centerY,b=t.offset,E=t.markerEnd,h=t.style,v=I(o({sourceX:i,sourceY:c,sourcePosition:d,targetX:p,targetY:s,targetPosition:u,borderRadius:m,centerX:f,centerY:g,offset:b}),3),k=v[0],P=v[1],w=v[2],S=V({canEdit:!1,multibranch:!1},r),R=S.data,N=S.canEdit,O=S.onChange,A=S.onRemove,K=y({data:R,key:"title"}),L=y({data:R,key:"description"});return e.createElement(e.Fragment,null,e.createElement(l,{id:n,path:k,markerEnd:E,style:h}),e.createElement(a,null,e.createElement("div",{style:{position:"absolute",transform:"translate(-50%, -50%) translate(".concat(P,"px,").concat(w,"px)"),background:$,padding:6,borderRadius:5,fontSize:12,pointerEvents:"all"},title:L||""},e.createElement(C,null,e.createElement(fe,{style:{fontSize:"12px",padding:"0.5px 2px",border:"1.2mm ridge ".concat("rgba(921, 120, 90, .6)")}},K||"抄送"),N?e.createElement("button",{style:{padding:"0.5px 4px",fontSize:"12px"},title:"点击变更连线",onClick:function(e){e.stopPropagation(),x(O)&&O(R)}},z.edit()):null,N?e.createElement("button",{style:{padding:"0.5px 4px",fontSize:"12px"},title:"点击移除连线",onClick:function(e){e.stopPropagation(),x(A)&&A(R)}},z.delete()):null))))}}])}();function ye(e,t,n){return t=pe(t),ce(e,xe()?Reflect.construct(t,n||[],pe(e).constructor):t.apply(e,n))}function xe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(xe=function(){return!!e})()}ge.defaultProps={};var be=function(){function n(){return ae(this,n),ye(this,n,arguments)}return de(n,t),ie(n,[{key:"render",value:function(){var t=this.props,n=t.data,r=t.size,o=V({canEdit:!1,multibranch:!1,nodeNameKey:"nodeNameKey",listInLineKey:"listInLine",listApproverKey:"listApprover",personnelNameKey:"personnelName",personnelNameLabel:""},n),l=o.data,a=o.isNext,p=o.canEdit,s=o.nodeNameKey,d=o.listApproverKey,u=o.personnelNameKey,m=o.personnelNameLabel,f=o.onAddApprover,g=o.onChange,h=o.onRemove,v=o.onRemoveApprover,k=y({data:l,key:s,defaultValue:"暂无"}),S=y({data:l,key:d,convert:b.array}),R=S.length>0;return e.createElement(e.Fragment,null,e.createElement("div",{className:Y("".concat(q+"-node"),a?"".concat(q+"-node-next"):null)},e.createElement("div",{className:"".concat(q+"-node-header"),style:re},e.createElement(A,{flexAuto:"left",miniAuto:!0,left:e.createElement(K,null,e.createElement(L,{block:!0,title:!0,style:{height:"22px"},textStyle:{width:"100%",height:"22px",lineHeight:"22px",textOverflow:"ellipsis"},color:"#333",separator:" ",textPrefixStyle:{marginRight:"6px"},text:k||"抄送项"})),leftStyle:{paddingRight:"5px"},right:p?e.createElement(C,null,e.createElement("button",{style:{padding:"1px 4px",fontSize:"12px",backgroundColor:"transparent",borderRadius:"5px",borderColor:"#fff"},title:"点击添加抄送人",onClick:function(e){e.stopPropagation(),x(f)&&f(l)}},z.plusCircle()),e.createElement("button",{style:{padding:"1px 4px",fontSize:"12px",backgroundColor:"transparent",borderRadius:"5px",borderColor:"#fff"},title:"点击编辑节点",onClick:function(e){e.stopPropagation(),x(g)&&g(l)}},z.edit()),e.createElement("button",{style:{padding:"1px 4px",fontSize:"12px",backgroundColor:"transparent",borderRadius:"5px",borderColor:"#fff"},title:"点击移除节点",onClick:function(e){e.stopPropagation(),x(h)&&h(l)}},z.delete())):null})),"small"!==r&&e.createElement("div",{className:"".concat(q+"-node-content")},e.createElement("div",{className:"".concat(q+"-node-content-inner")},e.createElement("div",{className:"".concat(q+"-node-content-info")},e.createElement(C,{direction:"vertical",style:{width:"100%"},split:e.createElement(P,{style:{margin:"0"}})},R&&S.map((function(t,n){var r=y({data:t,key:u,defaultValue:""});return e.createElement(A,{key:"user_".concat(n),flexAuto:"left",left:e.createElement(L,{textPrefix:m,text:r||"未设置",separatorStyle:{paddingRight:"3px"},textPrefixStyle:{color:"#333"},color:E(r)?"#ccc":""}),right:p?e.createElement(C,{split:e.createElement(P,{type:"vertical",style:{marginLeft:"1px",marginRight:"1px"}})},e.createElement(w,{size:"small",style:{padding:"0.5px 5px",fontSize:"12px"},title:"移除抄送人",onClick:function(e){e.stopPropagation(),x(v)&&v(t)}},z.delete())):null})})),R?null:e.createElement("div",null,"未设置抄送人",p?",点击 ":"",p?z.plusCircle():"",p?" 按钮添加":"","。")))))),e.createElement(i,{type:"target",id:"top",position:c.Top,style:{left:"50%",background:J},isConnectable:!0}),e.createElement(i,{type:"target",position:c.Left,id:"left",style:{top:"50%",background:J},isConnectable:!0}),e.createElement(i,{type:"target",position:c.Right,id:"right",style:{top:"50%",background:J},isConnectable:!0}),e.createElement(i,{type:"target",id:"bottom",position:c.Bottom,style:{left:"50%",background:J},isConnectable:!0}))}}])}();be.defaultProps={color:"black",data:{},size:""};var Ee=function(t){var n=t.size,r=t.data,o=t.onClick,l=V({canEdit:!1},r),a=l.data,p=l.canEdit,s=l.onRemove,d=y({data:a,key:"name"}),u=y({data:a,key:"description"});return e.createElement(e.Fragment,null,e.createElement("div",{className:"".concat(q+"-node"),onClick:o,title:u||""},e.createElement("div",{className:"".concat(q+"-node-header"),style:ne},e.createElement(A,{flexAuto:"left",miniAuto:!0,left:e.createElement(K,null,e.createElement(L,{block:!0,title:!0,style:{height:"22px"},textStyle:{width:"100%",height:"22px",lineHeight:"22px",textOverflow:"ellipsis"},color:"#333",separator:" ",textPrefixStyle:{marginRight:"6px"},text:d||"终止点"})),right:p?e.createElement(C,null,e.createElement("button",{style:{padding:"1px 4px",fontSize:"12px",backgroundColor:"transparent",borderRadius:"5px",borderColor:"#fff"},title:"点击移除节点",onClick:function(e){e.stopPropagation(),x(s)&&s(a)}},z.delete())):null})),"small"!==n&&e.createElement("div",{className:"".concat(q+"-node-content")},e.createElement("div",{className:"".concat(q+"-node-content-inner")},e.createElement("div",{className:"".concat(q+"-node-content-info")},e.createElement(L,{text:"此节点为终止节点,代表流程结束。"}))))),e.createElement(i,{type:"target",position:c.Top,id:"top",style:{background:J},isConnectable:!0}),e.createElement(i,{type:"target",position:c.Left,id:"left",style:{top:"50%",background:J},isConnectable:!0}),e.createElement(i,{type:"target",position:c.Right,id:"right",style:{top:"50%",background:J},isConnectable:!0}),e.createElement(i,{type:"target",position:c.Bottom,id:"bottom",style:{top:"100%",background:J},isConnectable:!0}))};function he(e,t,n){return t=pe(t),ce(e,ve()?Reflect.construct(t,n||[],pe(e).constructor):t.apply(e,n))}function ve(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ve=function(){return!!e})()}Ee.defaultProps={};var ke=k.Text,Ce=function(){function n(){return ae(this,n),he(this,n,arguments)}return de(n,t),ie(n,[{key:"render",value:function(){var t=this.props,n=t.id,r=t.data,i=t.sourceX,c=t.sourceY,p=t.targetX,s=t.targetY,d=t.sourcePosition,u=t.targetPosition,m=t.borderRadius,f=t.centerX,g=t.centerY,b=t.offset,E=t.markerEnd,h=t.style,v=I(o({sourceX:i,sourceY:c,sourcePosition:d,targetX:p,targetY:s,targetPosition:u,borderRadius:m,centerX:f,centerY:g,offset:b}),3),k=v[0],P=v[1],w=v[2],S=V({canEdit:!1,multibranch:!1},r),R=S.data,N=S.canEdit,O=S.multibranch,A=S.onChange,K=S.onChangeBranchCondition,L=S.onRemove,j=y({data:R,key:"title"}),T=y({data:R,key:"description"});return e.createElement(e.Fragment,null,e.createElement(l,{id:n,path:k,markerEnd:E,style:h}),e.createElement(a,null,e.createElement("div",{style:{position:"absolute",transform:"translate(-50%, -50%) translate(".concat(P,"px,").concat(w,"px)"),background:U,padding:6,borderRadius:5,fontSize:12,pointerEvents:"all"},title:T||""},e.createElement(C,null,e.createElement(ke,{style:{fontSize:"12px",padding:"0.5px 2px",border:"1.2mm ridge ".concat("rgba(211, 220, 50, .6)")}},j||"前进"),N?e.createElement("button",{style:{padding:"0.5px 4px",fontSize:"12px"},title:"点击变更连线",onClick:function(e){e.stopPropagation(),x(A)&&A(R)}},z.edit()):null,O?e.createElement("button",{style:{padding:"0.5px 4px",fontSize:"12px"},title:"点击变更绑定的正向连接条件",onClick:function(e){e.stopPropagation(),x(K)&&K(R)}},z.nodeIndex()):null,N?e.createElement("button",{style:{padding:"0.5px 4px",fontSize:"12px"},title:"点击移除连线",onClick:function(e){e.stopPropagation(),x(L)&&L(R)}},z.delete()):null))))}}])}();function Pe(e,t,n){return t=pe(t),ce(e,we()?Reflect.construct(t,n||[],pe(e).constructor):t.apply(e,n))}function we(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(we=function(){return!!e})()}Ce.defaultProps={};var Se=function(){function n(){return ae(this,n),Pe(this,n,arguments)}return de(n,t),ie(n,[{key:"render",value:function(){var t=this.props,n=t.data,r=t.size,o=V({canEdit:!1,multibranch:!1,nodeNameKey:"nodeNameKey",listInLineKey:"listInLine",listOutLineKey:"listOutLine",listApproverKey:"listApprover",personnelNameKey:"personnelName",personnelNameLabel:""},n),l=o.data,a=o.isNext,p=o.canEdit,s=o.multibranch,d=o.nodeNameKey,u=o.listApproverKey,m=o.personnelNameKey,f=o.personnelNameLabel,g=o.onAddApprover,h=o.onChange,v=o.onChangeBranchCondition,k=o.onRemove,S=o.onRemoveApprover,R=y({data:l,key:d,defaultValue:"暂无"}),N=y({data:l,key:u,convert:b.array}),O=N.length>0;return e.createElement(e.Fragment,null,e.createElement("div",{className:Y("".concat(q+"-node"),a?"".concat(q+"-node-next"):null)},e.createElement("div",{className:"".concat(q+"-node-header")},e.createElement(A,{flexAuto:"left",miniAuto:!0,left:e.createElement(K,null,e.createElement("div",{style:{width:"100%"}},e.createElement(L,{block:!0,title:!0,style:{height:"22px"},textStyle:{width:"100%",height:"22px",lineHeight:"22px",textOverflow:"ellipsis"},color:"#333",separator:" ",textPrefixStyle:{marginRight:"6px"},text:R||"流程项"}))),right:p?e.createElement(C,null,e.createElement("button",{style:{padding:"1px 4px",fontSize:"12px",backgroundColor:"transparent",borderRadius:"5px",borderColor:"#fff"},title:"点击添加审批人",onClick:function(e){e.stopPropagation(),x(g)&&g(l)}},z.plusCircle()),e.createElement("button",{style:{padding:"1px 4px",fontSize:"12px",backgroundColor:"transparent",borderRadius:"5px",borderColor:"#fff"},title:"点击编辑节点",onClick:function(e){e.stopPropagation(),x(h)&&h(l)}},z.edit()),s?e.createElement("button",{style:{padding:"1px 4px",fontSize:"12px",backgroundColor:"transparent",borderRadius:"5px",borderColor:"#fff"},title:"点击编辑分支条件",onClick:function(e){e.stopPropagation(),x(v)&&v(l)}},z.branches()):null,e.createElement("button",{style:{padding:"1px 4px",fontSize:"12px",backgroundColor:"transparent",borderRadius:"5px",borderColor:"#fff"},title:"点击移除节点",onClick:function(e){e.stopPropagation(),x(k)&&k(l)}},z.delete())):null})),"small"!==r&&e.createElement("div",{className:"".concat(q+"-node-content")},e.createElement("div",{className:"".concat(q+"-node-content-inner")},e.createElement("div",{className:"".concat(q+"-node-content-info")},e.createElement(C,{direction:"vertical",style:{width:"100%"},split:e.createElement(P,{style:{margin:"0"}})},O&&N.map((function(t,n){var r=y({data:t,key:m,defaultValue:""});return e.createElement(A,{key:"user_".concat(n),flexAuto:"left",left:e.createElement(L,{textPrefix:f,text:r||"未设置",separatorStyle:{paddingRight:"3px"},textPrefixStyle:{color:"#333"},color:E(r)?"#ccc":""}),right:p?e.createElement(C,{split:e.createElement(P,{type:"vertical",style:{marginLeft:"1px",marginRight:"1px"}})},e.createElement(w,{size:"small",style:{padding:"0.5px 5px",fontSize:"12px"},title:"移除审批人",onClick:function(e){e.stopPropagation(),x(S)&&S(t)}},z.delete())):null})})),O?null:e.createElement("div",null,"未设置审批人",p?",点击 ":"",p?z.plusCircle():"",p?" 按钮添加":"","。")))))),e.createElement(i,{type:"target",id:"top",position:c.Top,style:{left:"45%",background:J},isConnectable:!0}),e.createElement(i,{type:"source",id:"top",position:c.Top,style:{left:"55%",background:M},isConnectable:!0}),e.createElement(i,{type:"target",position:c.Left,id:"left",style:{top:"33%",background:J},isConnectable:!0}),e.createElement(i,{type:"source",position:c.Left,id:"left",style:{top:"66%",background:M},isConnectable:!0}),e.createElement(i,{type:"target",position:c.Right,id:"right",style:{top:"66%",background:J},isConnectable:!0}),e.createElement(i,{type:"source",position:c.Right,id:"right",style:{top:"33%",background:M},isConnectable:!0}),e.createElement(i,{type:"target",id:"bottom",position:c.Bottom,style:{left:"55%",background:J},isConnectable:!0}),e.createElement(i,{type:"source",position:c.Bottom,id:"bottom",style:{left:"45%",background:M},isConnectable:!0}))}}])}();Se.defaultProps={color:"black",data:{},size:""};var Re=function(t){var n=t.size,r=t.onClick;return e.createElement(e.Fragment,null,e.createElement("div",{className:"".concat(q+"-node"),onClick:r},e.createElement("div",{className:"".concat(q+"-node-header"),style:te},e.createElement(A,{flexAuto:"left",miniAuto:!0,left:e.createElement(K,null,e.createElement(L,{block:!0,title:!0,style:{height:"22px"},textStyle:{width:"100%",height:"22px",lineHeight:"22px",textOverflow:"ellipsis"},color:"#333",separator:" ",text:"起始点"}))})),"small"!==n&&e.createElement("div",{className:"".concat(q+"-node-content")},e.createElement("div",{className:"".concat(q+"-node-content-inner")},e.createElement("div",{className:"".concat(q+"-node-content-info")},e.createElement(L,{text:"此为流程发起唯一节点,无审批人。"}))))),e.createElement(i,{type:"target",id:"top",position:c.Top,style:{left:"45%",background:J},isConnectable:!0}),e.createElement(i,{type:"source",id:"top",position:c.Top,style:{left:"55%",background:M},isConnectable:!0}),e.createElement(i,{type:"target",position:c.Left,id:"left",style:{top:"33%",background:J},isConnectable:!0}),e.createElement(i,{type:"source",position:c.Left,id:"left",style:{top:"66%",background:M},isConnectable:!0}),e.createElement(i,{type:"target",position:c.Right,id:"right",style:{top:"66%",background:J},isConnectable:!0}),e.createElement(i,{type:"source",position:c.Right,id:"right",style:{top:"33%",background:M},isConnectable:!0}),e.createElement(i,{type:"target",id:"bottom",position:c.Bottom,style:{left:"55%",background:J},isConnectable:!0}),e.createElement(i,{type:"source",position:c.Bottom,id:"bottom",style:{left:"45%",background:M},isConnectable:!0}))};Re.defaultProps={};var Ne={intermediate:Se,carbonCopy:be,start:Re,end:Ee},Oe={forward:Ce,backward:le,carbonCopy:ge};function ze(){return e.createElement(S,{title:"图示说明:",size:"small"},e.createElement("div",{style:{width:"120px"}},e.createElement(A,{flex:"left",leftStyle:{paddingRight:"10px"},left:e.createElement(j,null,e.createElement("div",{style:{height:"10px",width:"16px",backgroundColor:G,borderRadius:"3px"}})),right:"流程起始节点"})),e.createElement("div",{style:{width:"120px"}},e.createElement(A,{flex:"left",leftStyle:{paddingRight:"10px"},left:e.createElement(j,null,e.createElement("div",{style:{height:"10px",width:"16px",backgroundColor:Q,borderRadius:"3px"}})),right:"流程中间节点"})),e.createElement("div",{style:{width:"120px"}},e.createElement(A,{flex:"left",leftStyle:{paddingRight:"10px"},left:e.createElement(j,null,e.createElement("div",{style:{height:"10px",width:"16px",backgroundColor:ee,borderRadius:"3px"}})),right:"流程抄送节点"})),e.createElement("div",{style:{width:"120px"}},e.createElement(A,{flex:"left",leftStyle:{paddingRight:"10px"},left:e.createElement(j,null,e.createElement("div",{style:{height:"10px",width:"16px",backgroundColor:Z,borderRadius:"3px"}})),right:"流程终止节点"})),e.createElement("div",{style:{width:"120px"}},e.createElement(A,{flex:"left",leftStyle:{paddingRight:"10px"},left:e.createElement(j,null,e.createElement("div",{style:{height:"10px",width:"16px",border:"2px solid",borderImage:"linear-gradient(45deg, gold, deeppink) 1",clipPath:"inset(0px round 5px)",filter:"hue-rotate(360deg)"}})),right:"等待流转节点"})),e.createElement(P,{type:"horizontal",style:{marginTop:"6px",marginBottom:"6px"}}),e.createElement("div",null,e.createElement(A,{flex:"left",leftStyle:{paddingRight:"10px"},left:e.createElement(j,null,e.createElement("div",{style:{height:"6px",width:"6px",backgroundColor:J,borderRadius:"50%"}})),right:"节点流程入口"})),e.createElement("div",{style:{width:"120px"}},e.createElement(A,{flex:"left",leftStyle:{paddingRight:"10px"},left:e.createElement(j,null,e.createElement("div",{style:{height:"6px",width:"6px",backgroundColor:M,borderRadius:"50%"}})),right:"节点流程出口"})),e.createElement(P,{type:"horizontal",style:{marginTop:"6px",marginBottom:"6px"}}),e.createElement("div",{style:{width:"120px"}},e.createElement(A,{flex:"left",leftStyle:{paddingRight:"10px"},left:e.createElement(j,null,e.createElement("div",{style:{height:"10px",width:"16px",backgroundColor:U,borderRadius:"3px"}})),right:"前进指向标签"})),e.createElement("div",{style:{width:"120px"}},e.createElement(A,{flex:"left",leftStyle:{paddingRight:"10px"},left:e.createElement(j,null,e.createElement("div",{style:{height:"10px",width:"16px",backgroundColor:$,borderRadius:"3px"}})),right:"抄送指向标签"})),e.createElement("div",{style:{width:"120px"}},e.createElement(A,{flex:"left",leftStyle:{paddingRight:"10px"},left:e.createElement(j,null,e.createElement("div",{style:{height:"10px",width:"16px",backgroundColor:W,borderRadius:"3px"}})),right:"回退指向标签"})))}function Ae(){return e.createElement(S,{title:"操作说明:",size:"small"},e.createElement("div",{style:{width:"180px"}},e.createElement(T,{showTitle:!1,showNumber:!0,labelWidth:18,list:[{text:"起始节点仅能存在一个。"},{text:"点击节点中的 ”编辑“ 可设置节点信息。"},{text:"点击节点中的 ”更改“ 可设置节点审核人信息。"},{text:"点击节点中的 ”条件“ 可设置节点的分支进入条件, 仅在存在多条驶出线条时可用。"},{text:"点击线条中的 ”变更“ 可设置连线信息。"},{text:"点击 刷新图标 可重新加载信息。"},{text:"点击节点或线条的 删除图标 可删除节点或连线。"}],useBackground:!1})))}function Ke(e){return V({position:{x:0,y:0},canEdit:!1},e)}function Le(e){var t=y({data:e,key:"index",convert:b.number}),n=y({data:e,key:"forward",convert:b.boolean}),r=y({data:e,key:"carbonCopy",convert:b.boolean}),o=t>0?h({seed:30*t+t+2}):"#b1b1b7",l=t>0?h({seed:30*t+t+2}):"#ea7f5b";return V(V({animated:!0,canEdit:!1,sourceHandle:n?"bottom":"right",targetHandle:n?"top":"right"},e),{},{type:n?r?"carbonCopy":"forward":"backward",markerEnd:{type:p.ArrowClosed,color:n?o:l},style:{stroke:n?o:l}})}var je={};function Te(t){var o=t.canEdit,l=t.multibranch,a=t.nodeNameKey,i=t.listInLineKey,c=t.listOutLineKey,p=t.listApproverKey,y=t.personnelNameKey,b=t.personnelNameLabel,E=t.nodes,h=t.edges,k=t.updateViewConfig,C=t.onEdgeCreate,P=v(E)?E:[],w=v(h)?h:[],S=I(s([]),3),R=S[0],N=S[1],O=S[2],z=I(d([]),3),A=z[0],K=z[1],L=z[2];n((function(){N(P),K(w)}),[P,w]);var j=R.map((function(e){return e.data.canEdit=o||!1,e.data.multibranch=l||!1,e.data.nodeNameKey=a,e.data.listInLineKey=i,e.data.listOutLineKey=c,e.data.listApproverKey=p,e.data.personnelNameKey=y,e.data.personnelNameLabel=b,e})),T=A.map((function(e){return e.data.canEdit=o||!1,e.data.multibranch=l||!1,e}));return e.createElement(r,{fitView:!0,nodes:j,edges:T,onConnect:function(e){x(C)&&C(e)},onNodesChange:function(e){o&&O(e)},onEdgesChange:function(e){o&&L(e)},onNodeDragStart:function(e,t){if(o){var n=t.position;je=n}},onNodeDragStop:function(e,t){if(o&&x(k)){var n=t.position,r=t.data.data,l=n.x,a=n.y,i=je,c=i.x,p=i.y;l==c&&a==p||k({viewConfigData:JSON.stringify({position:n})},r)}},nodeTypes:Ne,edgeTypes:Oe},e.createElement(u,null),e.createElement(m,{zoomable:!0,pannable:!0}),e.createElement(f,{position:"top-left"},e.createElement(ze,null)),e.createElement(f,{position:"top-right"},o?e.createElement(Ae,null):null),e.createElement(g,null))}Te.defaultProps={canEdit:!0,multibranch:!1,nodeNameKey:"nodeNameKey",listInLineKey:"listInLine",listOutLineKey:"listOutLine",listApproverKey:"listApprover",personnelNameKey:"personnelNameKey",personnelNameLabel:"personnelNameLabel",onEdgeCreate:function(){}};var Be=k.Paragraph;function Ye(t){var n=t.style,r=t.title,o=t.showTitle,l=t.showLeftDivider,a=t.list,i=t.listItemConvert,c=t.nextData,p=t.nextDataConvert,s=null==c?null:x(p)?p(c):c,d=(v(a)?a:[]).map((function(e){return x(i)?i(e):e}));null!=s&&d.push(s);var u=null;if(d.length<=0)u=e.createElement(N,null);else{var m=d.length,f=d.map((function(t,n){var r=V({titlePrefix:"审批节点",icon:null,color:null,notePrefix:"审批备注",resultPrefix:"审批结果",operatorNamePrefix:"审批人",timePrefix:"审批时间",compact:!1},t),o=r.titlePrefix,l=r.title,a=r.notePrefix,i=r.note,c=r.resultPrefix,p=r.result,d=r.operatorNamePrefix,u=r.operatorName,f=r.timePrefix,g=r.time,y=r.icon,x=r.color,b=r.compact;return{color:x||(null==s&&m===n+1?"blue":"gray"),dot:y,children:e.createElement(e.Fragment,null,E(l)?null:e.createElement(Be,null,e.createElement(L,{separatorStyle:{padding:"0 4px 0 2px"},textPrefix:o,text:l})),b||E(p)?null:e.createElement(Be,null,e.createElement(L,{separatorStyle:{padding:"0 4px 0 2px"},textPrefix:c,text:p})),b||E(u)?null:e.createElement(Be,null,e.createElement(L,{separatorStyle:{padding:"0 4px 0 2px"},textPrefix:d,text:u})),b||E(i)?null:e.createElement(Be,null,e.createElement(L,{separatorStyle:{padding:"0 4px 0 2px"},textPrefix:a,text:i||"无备注"})),b||E(g)?null:e.createElement(Be,null,e.createElement(L,{separatorStyle:{padding:"0 4px 0 2px"},textPrefix:f,text:g})))}}));u=e.createElement(O,{reverse:!0,style:{marginTop:"10px"},items:f})}var g=e.createElement(A,{style:{height:"100%"},flexAuto:"bottom",topStyle:{paddingBottom:"6px"},top:o?e.createElement(R,{message:"".concat(r,":"),type:"info"}):null,bottom:o?e.createElement("div",{style:{height:"100%",position:"relative"}},e.createElement(B,{style:{position:"absolute",left:0,top:0,paddingLeft:"6px",paddingRight:"6px",height:"100%",width:"100%",overflowY:"auto"}},u)):u});return l?e.createElement(A,{style:V(V({},n),{},{height:"100%"}),flexAuto:"right",left:e.createElement(P,{type:"vertical",style:{height:"100%"}}),right:g}):g}Ye.defaultProps={style:{},title:"审批进度",showTitle:!1,showLeftDivider:!1,canEdit:!0,list:[],listItemConvert:null,nextData:null,nextDataConvert:null};export{Te as Flow,Ye as FlowProcessHistory,Le as adjustEdge,Ke as adjustNode};
1
+ import e,{PureComponent as t,useEffect as n}from"react";import r,{getSmoothStepPath as o,BaseEdge as l,EdgeLabelRenderer as a,Handle as i,Position as c,MarkerType as p,useNodesState as s,useEdgesState as d,Controls as u,MiniMap as m,Panel as f,Background as g}from"reactflow";import{getValueByKey as y,isFunction as x,convertCollection as b,checkStringIsNullOrWhiteSpace as E,buildRandomHexColor as h,isArray as v}from"easy-soft-utility";import{Typography as k,Space as C,Divider as P,Button as w,Card as S,Alert as R,Empty as N,Timeline as O}from"antd";import{iconBuilder as z,FlexBox as A,VerticalBox as K,ColorText as L,CenterBox as j,HelpBox as T,ScrollFacadeBox as B}from"antd-management-fast-component";import Y from"classnames";function X(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,l,a,i=[],c=!0,p=!1;try{if(l=(n=n.call(e)).next,0===t);else for(;!(c=(r=l.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){p=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(p)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return X(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?X(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function D(e){return D="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},D(e)}function _(e){var t=function(e,t){if("object"!=D(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=D(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==D(t)?t:t+""}function F(e,t,n){return(t=_(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function H(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function V(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?H(Object(n),!0).forEach((function(t){F(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):H(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var q="antd-management-fast-flow",J="#4e44f2",M="#a98477",U="#ffcc00",W="#bed2bb",$="#a4baea",G="#e895d2",Q="#f66902",Z="#c2fa32",ee="#05ea7f",te={backgroundColor:G},ne={backgroundColor:Z},re={backgroundColor:ee},oe=k.Text;function le(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ae(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,_(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ie(e,t){if(t&&("object"==D(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function ce(e){return ce=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ce(e)}function pe(e,t){return pe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},pe(e,t)}function se(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&pe(e,t)}function de(e,t,n){return t=ce(t),ie(e,ue()?Reflect.construct(t,n||[],ce(e).constructor):t.apply(e,n))}function ue(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ue=function(){return!!e})()}var me=k.Text,fe=function(){function n(){return le(this,n),de(this,n,arguments)}return se(n,t),ae(n,[{key:"render",value:function(){var t=this.props,n=t.id,r=t.data,i=t.sourceX,c=t.sourceY,p=t.targetX,s=t.targetY,d=t.sourcePosition,u=t.targetPosition,m=t.borderRadius,f=t.centerX,g=t.centerY,b=t.offset,E=t.markerEnd,h=t.style,v=I(o({sourceX:i,sourceY:c,sourcePosition:d,targetX:p,targetY:s,targetPosition:u,borderRadius:m,centerX:f,centerY:g,offset:b}),3),k=v[0],P=v[1],w=v[2],S=V({canEdit:!1,multibranch:!1},r),R=S.data,N=S.canEdit,O=S.onChange,A=S.onRemove,K=y({data:R,key:"title"}),L=y({data:R,key:"description"});return e.createElement(e.Fragment,null,e.createElement(l,{id:n,path:k,markerEnd:E,style:h}),e.createElement(a,null,e.createElement("div",{style:{position:"absolute",transform:"translate(-50%, -50%) translate(".concat(P,"px,").concat(w,"px)"),background:$,padding:6,borderRadius:5,fontSize:12,pointerEvents:"all"},title:L||""},e.createElement(C,null,e.createElement(me,{style:{fontSize:"12px",padding:"0.5px 2px",border:"1.2mm ridge ".concat("rgba(921, 120, 90, .6)")}},K||"抄送"),N?e.createElement("button",{style:{padding:"0.5px 4px",fontSize:"12px"},title:"点击变更连线",onClick:function(e){e.stopPropagation(),x(O)&&O(R)}},z.edit()):null,N?e.createElement("button",{style:{padding:"0.5px 4px",fontSize:"12px"},title:"点击移除连线",onClick:function(e){e.stopPropagation(),x(A)&&A(R)}},z.delete()):null))))}}])}();function ge(e,t,n){return t=ce(t),ie(e,ye()?Reflect.construct(t,n||[],ce(e).constructor):t.apply(e,n))}function ye(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ye=function(){return!!e})()}var xe=function(){function n(){return le(this,n),ge(this,n,arguments)}return se(n,t),ae(n,[{key:"render",value:function(){var t=this.props,n=t.data,r=t.size,o=V({canEdit:!1,multibranch:!1,nodeNameKey:"nodeNameKey",listInLineKey:"listInLine",listApproverKey:"listApprover",personnelNameKey:"personnelName",personnelNameLabel:""},n),l=o.data,a=o.isNext,p=o.canEdit,s=o.nodeNameKey,d=o.listApproverKey,u=o.personnelNameKey,m=o.personnelNameLabel,f=o.onAddApprover,g=o.onChange,h=o.onRemove,v=o.onRemoveApprover,k=y({data:l,key:s,defaultValue:"暂无"}),S=y({data:l,key:d,convert:b.array}),R=S.length>0;return e.createElement(e.Fragment,null,e.createElement("div",{className:Y("".concat(q+"-node"),a?"".concat(q+"-node-next"):null)},e.createElement("div",{className:"".concat(q+"-node-header"),style:re},e.createElement(A,{flexAuto:"left",miniAuto:!0,left:e.createElement(K,null,e.createElement(L,{block:!0,title:!0,style:{height:"22px"},textStyle:{width:"100%",height:"22px",lineHeight:"22px",textOverflow:"ellipsis"},color:"#333",separator:" ",textPrefixStyle:{marginRight:"6px"},text:k||"抄送项"})),leftStyle:{paddingRight:"5px"},right:p?e.createElement(C,null,e.createElement("button",{style:{padding:"1px 4px",fontSize:"12px",backgroundColor:"transparent",borderRadius:"5px",borderColor:"#fff"},title:"点击添加抄送人",onClick:function(e){e.stopPropagation(),x(f)&&f(l)}},z.plusCircle()),e.createElement("button",{style:{padding:"1px 4px",fontSize:"12px",backgroundColor:"transparent",borderRadius:"5px",borderColor:"#fff"},title:"点击编辑节点",onClick:function(e){e.stopPropagation(),x(g)&&g(l)}},z.edit()),e.createElement("button",{style:{padding:"1px 4px",fontSize:"12px",backgroundColor:"transparent",borderRadius:"5px",borderColor:"#fff"},title:"点击移除节点",onClick:function(e){e.stopPropagation(),x(h)&&h(l)}},z.delete())):null})),"small"!==r&&e.createElement("div",{className:"".concat(q+"-node-content")},e.createElement("div",{className:"".concat(q+"-node-content-inner")},e.createElement("div",{className:"".concat(q+"-node-content-info")},e.createElement(C,{direction:"vertical",style:{width:"100%"},split:e.createElement(P,{style:{margin:"0"}})},R&&S.map((function(t,n){var r=y({data:t,key:u,defaultValue:""});return e.createElement(A,{key:"user_".concat(n),flexAuto:"left",left:e.createElement(L,{textPrefix:m,text:r||"未设置",separatorStyle:{paddingRight:"3px"},textPrefixStyle:{color:"#333"},color:E(r)?"#ccc":""}),right:p?e.createElement(C,{split:e.createElement(P,{type:"vertical",style:{marginLeft:"1px",marginRight:"1px"}})},e.createElement(w,{size:"small",style:{padding:"0.5px 5px",fontSize:"12px"},title:"移除抄送人",onClick:function(e){e.stopPropagation(),x(v)&&v(t)}},z.delete())):null})})),R?null:e.createElement("div",null,"未设置抄送人",p?",点击 ":"",p?z.plusCircle():"",p?" 按钮添加":"","。")))))),e.createElement(i,{type:"target",id:"top",position:c.Top,style:{left:"50%",background:J},isConnectable:!0}),e.createElement(i,{type:"target",position:c.Left,id:"left",style:{top:"50%",background:J},isConnectable:!0}),e.createElement(i,{type:"target",position:c.Right,id:"right",style:{top:"50%",background:J},isConnectable:!0}),e.createElement(i,{type:"target",id:"bottom",position:c.Bottom,style:{left:"50%",background:J},isConnectable:!0}))}}])}();xe.defaultProps={color:"black",data:{},size:""};function be(e,t,n){return t=ce(t),ie(e,Ee()?Reflect.construct(t,n||[],ce(e).constructor):t.apply(e,n))}function Ee(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ee=function(){return!!e})()}var he=k.Text,ve=function(){function n(){return le(this,n),be(this,n,arguments)}return se(n,t),ae(n,[{key:"render",value:function(){var t=this.props,n=t.id,r=t.data,i=t.sourceX,c=t.sourceY,p=t.targetX,s=t.targetY,d=t.sourcePosition,u=t.targetPosition,m=t.borderRadius,f=t.centerX,g=t.centerY,b=t.offset,E=t.markerEnd,h=t.style,v=I(o({sourceX:i,sourceY:c,sourcePosition:d,targetX:p,targetY:s,targetPosition:u,borderRadius:m,centerX:f,centerY:g,offset:b}),3),k=v[0],P=v[1],w=v[2],S=V({canEdit:!1,multibranch:!1},r),R=S.data,N=S.canEdit,O=S.multibranch,A=S.onChange,K=S.onChangeBranchCondition,L=S.onRemove,j=y({data:R,key:"title"}),T=y({data:R,key:"description"});return e.createElement(e.Fragment,null,e.createElement(l,{id:n,path:k,markerEnd:E,style:h}),e.createElement(a,null,e.createElement("div",{style:{position:"absolute",transform:"translate(-50%, -50%) translate(".concat(P,"px,").concat(w,"px)"),background:U,padding:6,borderRadius:5,fontSize:12,pointerEvents:"all"},title:T||""},e.createElement(C,null,e.createElement(he,{style:{fontSize:"12px",padding:"0.5px 2px",border:"1.2mm ridge ".concat("rgba(211, 220, 50, .6)")}},j||"前进"),N?e.createElement("button",{style:{padding:"0.5px 4px",fontSize:"12px"},title:"点击变更连线",onClick:function(e){e.stopPropagation(),x(A)&&A(R)}},z.edit()):null,O?e.createElement("button",{style:{padding:"0.5px 4px",fontSize:"12px"},title:"点击变更绑定的正向连接条件",onClick:function(e){e.stopPropagation(),x(K)&&K(R)}},z.nodeIndex()):null,N?e.createElement("button",{style:{padding:"0.5px 4px",fontSize:"12px"},title:"点击移除连线",onClick:function(e){e.stopPropagation(),x(L)&&L(R)}},z.delete()):null))))}}])}();function ke(e,t,n){return t=ce(t),ie(e,Ce()?Reflect.construct(t,n||[],ce(e).constructor):t.apply(e,n))}function Ce(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ce=function(){return!!e})()}var Pe=function(){function n(){return le(this,n),ke(this,n,arguments)}return se(n,t),ae(n,[{key:"render",value:function(){var t=this.props,n=t.data,r=t.size,o=V({canEdit:!1,multibranch:!1,nodeNameKey:"nodeNameKey",listInLineKey:"listInLine",listOutLineKey:"listOutLine",listApproverKey:"listApprover",personnelNameKey:"personnelName",personnelNameLabel:""},n),l=o.data,a=o.isNext,p=o.canEdit,s=o.multibranch,d=o.nodeNameKey,u=o.listApproverKey,m=o.personnelNameKey,f=o.personnelNameLabel,g=o.onAddApprover,h=o.onChange,v=o.onChangeBranchCondition,k=o.onRemove,S=o.onRemoveApprover,R=y({data:l,key:d,defaultValue:"暂无"}),N=y({data:l,key:u,convert:b.array}),O=N.length>0;return e.createElement(e.Fragment,null,e.createElement("div",{className:Y("".concat(q+"-node"),a?"".concat(q+"-node-next"):null)},e.createElement("div",{className:"".concat(q+"-node-header")},e.createElement(A,{flexAuto:"left",miniAuto:!0,left:e.createElement(K,null,e.createElement("div",{style:{width:"100%"}},e.createElement(L,{block:!0,title:!0,style:{height:"22px"},textStyle:{width:"100%",height:"22px",lineHeight:"22px",textOverflow:"ellipsis"},color:"#333",separator:" ",textPrefixStyle:{marginRight:"6px"},text:R||"流程项"}))),right:p?e.createElement(C,null,e.createElement("button",{style:{padding:"1px 4px",fontSize:"12px",backgroundColor:"transparent",borderRadius:"5px",borderColor:"#fff"},title:"点击添加审批人",onClick:function(e){e.stopPropagation(),x(g)&&g(l)}},z.plusCircle()),e.createElement("button",{style:{padding:"1px 4px",fontSize:"12px",backgroundColor:"transparent",borderRadius:"5px",borderColor:"#fff"},title:"点击编辑节点",onClick:function(e){e.stopPropagation(),x(h)&&h(l)}},z.edit()),s?e.createElement("button",{style:{padding:"1px 4px",fontSize:"12px",backgroundColor:"transparent",borderRadius:"5px",borderColor:"#fff"},title:"点击编辑分支条件",onClick:function(e){e.stopPropagation(),x(v)&&v(l)}},z.branches()):null,e.createElement("button",{style:{padding:"1px 4px",fontSize:"12px",backgroundColor:"transparent",borderRadius:"5px",borderColor:"#fff"},title:"点击移除节点",onClick:function(e){e.stopPropagation(),x(k)&&k(l)}},z.delete())):null})),"small"!==r&&e.createElement("div",{className:"".concat(q+"-node-content")},e.createElement("div",{className:"".concat(q+"-node-content-inner")},e.createElement("div",{className:"".concat(q+"-node-content-info")},e.createElement(C,{direction:"vertical",style:{width:"100%"},split:e.createElement(P,{style:{margin:"0"}})},O&&N.map((function(t,n){var r=y({data:t,key:m,defaultValue:""});return e.createElement(A,{key:"user_".concat(n),flexAuto:"left",left:e.createElement(L,{textPrefix:f,text:r||"未设置",separatorStyle:{paddingRight:"3px"},textPrefixStyle:{color:"#333"},color:E(r)?"#ccc":""}),right:p?e.createElement(C,{split:e.createElement(P,{type:"vertical",style:{marginLeft:"1px",marginRight:"1px"}})},e.createElement(w,{size:"small",style:{padding:"0.5px 5px",fontSize:"12px"},title:"移除审批人",onClick:function(e){e.stopPropagation(),x(S)&&S(t)}},z.delete())):null})})),O?null:e.createElement("div",null,"未设置审批人",p?",点击 ":"",p?z.plusCircle():"",p?" 按钮添加":"","。")))))),e.createElement(i,{type:"target",id:"top",position:c.Top,style:{left:"45%",background:J},isConnectable:!0}),e.createElement(i,{type:"source",id:"top",position:c.Top,style:{left:"55%",background:M},isConnectable:!0}),e.createElement(i,{type:"target",position:c.Left,id:"left",style:{top:"33%",background:J},isConnectable:!0}),e.createElement(i,{type:"source",position:c.Left,id:"left",style:{top:"66%",background:M},isConnectable:!0}),e.createElement(i,{type:"target",position:c.Right,id:"right",style:{top:"66%",background:J},isConnectable:!0}),e.createElement(i,{type:"source",position:c.Right,id:"right",style:{top:"33%",background:M},isConnectable:!0}),e.createElement(i,{type:"target",id:"bottom",position:c.Bottom,style:{left:"55%",background:J},isConnectable:!0}),e.createElement(i,{type:"source",position:c.Bottom,id:"bottom",style:{left:"45%",background:M},isConnectable:!0}))}}])}();Pe.defaultProps={color:"black",data:{},size:""};var we={intermediate:Pe,carbonCopy:xe,start:function(t){var n=t.size,r=t.onClick;return e.createElement(e.Fragment,null,e.createElement("div",{className:"".concat(q+"-node"),onClick:r},e.createElement("div",{className:"".concat(q+"-node-header"),style:te},e.createElement(A,{flexAuto:"left",miniAuto:!0,left:e.createElement(K,null,e.createElement(L,{block:!0,title:!0,style:{height:"22px"},textStyle:{width:"100%",height:"22px",lineHeight:"22px",textOverflow:"ellipsis"},color:"#333",separator:" ",text:"起始点"}))})),"small"!==n&&e.createElement("div",{className:"".concat(q+"-node-content")},e.createElement("div",{className:"".concat(q+"-node-content-inner")},e.createElement("div",{className:"".concat(q+"-node-content-info")},e.createElement(L,{text:"此为流程发起唯一节点,无审批人。"}))))),e.createElement(i,{type:"target",id:"top",position:c.Top,style:{left:"45%",background:J},isConnectable:!0}),e.createElement(i,{type:"source",id:"top",position:c.Top,style:{left:"55%",background:M},isConnectable:!0}),e.createElement(i,{type:"target",position:c.Left,id:"left",style:{top:"33%",background:J},isConnectable:!0}),e.createElement(i,{type:"source",position:c.Left,id:"left",style:{top:"66%",background:M},isConnectable:!0}),e.createElement(i,{type:"target",position:c.Right,id:"right",style:{top:"66%",background:J},isConnectable:!0}),e.createElement(i,{type:"source",position:c.Right,id:"right",style:{top:"33%",background:M},isConnectable:!0}),e.createElement(i,{type:"target",id:"bottom",position:c.Bottom,style:{left:"55%",background:J},isConnectable:!0}),e.createElement(i,{type:"source",position:c.Bottom,id:"bottom",style:{left:"45%",background:M},isConnectable:!0}))},end:function(t){var n=t.size,r=t.data,o=t.onClick,l=V({canEdit:!1},r),a=l.data,p=l.canEdit,s=l.onRemove,d=y({data:a,key:"name"}),u=y({data:a,key:"description"});return e.createElement(e.Fragment,null,e.createElement("div",{className:"".concat(q+"-node"),onClick:o,title:u||""},e.createElement("div",{className:"".concat(q+"-node-header"),style:ne},e.createElement(A,{flexAuto:"left",miniAuto:!0,left:e.createElement(K,null,e.createElement(L,{block:!0,title:!0,style:{height:"22px"},textStyle:{width:"100%",height:"22px",lineHeight:"22px",textOverflow:"ellipsis"},color:"#333",separator:" ",textPrefixStyle:{marginRight:"6px"},text:d||"终止点"})),right:p?e.createElement(C,null,e.createElement("button",{style:{padding:"1px 4px",fontSize:"12px",backgroundColor:"transparent",borderRadius:"5px",borderColor:"#fff"},title:"点击移除节点",onClick:function(e){e.stopPropagation(),x(s)&&s(a)}},z.delete())):null})),"small"!==n&&e.createElement("div",{className:"".concat(q+"-node-content")},e.createElement("div",{className:"".concat(q+"-node-content-inner")},e.createElement("div",{className:"".concat(q+"-node-content-info")},e.createElement(L,{text:"此节点为终止节点,代表流程结束。"}))))),e.createElement(i,{type:"target",position:c.Top,id:"top",style:{background:J},isConnectable:!0}),e.createElement(i,{type:"target",position:c.Left,id:"left",style:{top:"50%",background:J},isConnectable:!0}),e.createElement(i,{type:"target",position:c.Right,id:"right",style:{top:"50%",background:J},isConnectable:!0}),e.createElement(i,{type:"target",position:c.Bottom,id:"bottom",style:{top:"100%",background:J},isConnectable:!0}))}},Se={forward:ve,backward:function(t){var n=t.id,r=t.data,i=t.sourceX,c=t.sourceY,p=t.targetX,s=t.targetY,d=t.sourcePosition,u=t.targetPosition,m=t.borderRadius,f=t.centerX,g=t.centerY,b=t.offset,E=t.style,h=void 0===E?{}:E,v=t.markerEnd,k=I(o({sourceX:i,sourceY:c,sourcePosition:d,targetX:p,targetY:s,targetPosition:u,borderRadius:m,centerX:f,centerY:g,offset:b}),3),P=k[0],w=k[1],S=k[2],R=V({canEdit:!1,multibranch:!1},r),N=R.data,O=R.canEdit,A=R.multibranch,K=R.onChange,L=R.onChangeBranchCondition,j=R.onRemove,T=y({data:N,key:"title"}),B=y({data:N,key:"description"});return e.createElement(e.Fragment,null,e.createElement(l,{id:n,path:P,markerEnd:v,style:h}),e.createElement(a,null,e.createElement("div",{style:{position:"absolute",transform:"translate(-50%, -50%) translate(".concat(w,"px,").concat(S,"px)"),background:W,padding:6,borderRadius:5,fontSize:12,pointerEvents:"all"},title:B||""},e.createElement(C,null,e.createElement(oe,{style:{fontSize:"12px",padding:"0.5px 2px",border:"1.2mm ridge ".concat("rgba(52, 231, 228, .6)"),color:"#666"}},T||"回退"),O?e.createElement("button",{style:{padding:"0.5px 4px",fontSize:"12px"},title:"点击变更连线",onClick:function(e){e.stopPropagation(),x(K)&&K(N)}},z.edit()):null,A?e.createElement("button",{style:{padding:"0.5px 4px",fontSize:"12px"},title:"点击变更绑定逆向连接条件",onClick:function(e){e.stopPropagation(),x(L)&&L(N)}},z.pullRequest()):null,O?e.createElement("button",{style:{padding:"0.5px 4px",fontSize:"12px"},title:"点击移除连线",onClick:function(e){e.stopPropagation(),x(j)&&j(N)}},z.delete()):null))))},carbonCopy:fe};function Re(){return e.createElement(S,{title:"图示说明:",size:"small"},e.createElement("div",{style:{width:"120px"}},e.createElement(A,{flex:"left",leftStyle:{paddingRight:"10px"},left:e.createElement(j,null,e.createElement("div",{style:{height:"10px",width:"16px",backgroundColor:G,borderRadius:"3px"}})),right:"流程起始节点"})),e.createElement("div",{style:{width:"120px"}},e.createElement(A,{flex:"left",leftStyle:{paddingRight:"10px"},left:e.createElement(j,null,e.createElement("div",{style:{height:"10px",width:"16px",backgroundColor:Q,borderRadius:"3px"}})),right:"流程中间节点"})),e.createElement("div",{style:{width:"120px"}},e.createElement(A,{flex:"left",leftStyle:{paddingRight:"10px"},left:e.createElement(j,null,e.createElement("div",{style:{height:"10px",width:"16px",backgroundColor:ee,borderRadius:"3px"}})),right:"流程抄送节点"})),e.createElement("div",{style:{width:"120px"}},e.createElement(A,{flex:"left",leftStyle:{paddingRight:"10px"},left:e.createElement(j,null,e.createElement("div",{style:{height:"10px",width:"16px",backgroundColor:Z,borderRadius:"3px"}})),right:"流程终止节点"})),e.createElement("div",{style:{width:"120px"}},e.createElement(A,{flex:"left",leftStyle:{paddingRight:"10px"},left:e.createElement(j,null,e.createElement("div",{style:{height:"10px",width:"16px",border:"2px solid",borderImage:"linear-gradient(45deg, gold, deeppink) 1",clipPath:"inset(0px round 5px)",filter:"hue-rotate(360deg)"}})),right:"等待流转节点"})),e.createElement(P,{type:"horizontal",style:{marginTop:"6px",marginBottom:"6px"}}),e.createElement("div",null,e.createElement(A,{flex:"left",leftStyle:{paddingRight:"10px"},left:e.createElement(j,null,e.createElement("div",{style:{height:"6px",width:"6px",backgroundColor:J,borderRadius:"50%"}})),right:"节点流程入口"})),e.createElement("div",{style:{width:"120px"}},e.createElement(A,{flex:"left",leftStyle:{paddingRight:"10px"},left:e.createElement(j,null,e.createElement("div",{style:{height:"6px",width:"6px",backgroundColor:M,borderRadius:"50%"}})),right:"节点流程出口"})),e.createElement(P,{type:"horizontal",style:{marginTop:"6px",marginBottom:"6px"}}),e.createElement("div",{style:{width:"120px"}},e.createElement(A,{flex:"left",leftStyle:{paddingRight:"10px"},left:e.createElement(j,null,e.createElement("div",{style:{height:"10px",width:"16px",backgroundColor:U,borderRadius:"3px"}})),right:"前进指向标签"})),e.createElement("div",{style:{width:"120px"}},e.createElement(A,{flex:"left",leftStyle:{paddingRight:"10px"},left:e.createElement(j,null,e.createElement("div",{style:{height:"10px",width:"16px",backgroundColor:$,borderRadius:"3px"}})),right:"抄送指向标签"})),e.createElement("div",{style:{width:"120px"}},e.createElement(A,{flex:"left",leftStyle:{paddingRight:"10px"},left:e.createElement(j,null,e.createElement("div",{style:{height:"10px",width:"16px",backgroundColor:W,borderRadius:"3px"}})),right:"回退指向标签"})))}function Ne(){return e.createElement(S,{title:"操作说明:",size:"small"},e.createElement("div",{style:{width:"180px"}},e.createElement(T,{showTitle:!1,showNumber:!0,labelWidth:18,list:[{text:"起始节点仅能存在一个。"},{text:"点击节点中的 ”编辑“ 可设置节点信息。"},{text:"点击节点中的 ”更改“ 可设置节点审核人信息。"},{text:"点击节点中的 ”条件“ 可设置节点的分支进入条件, 仅在存在多条驶出线条时可用。"},{text:"点击线条中的 ”变更“ 可设置连线信息。"},{text:"点击 刷新图标 可重新加载信息。"},{text:"点击节点或线条的 删除图标 可删除节点或连线。"}],useBackground:!1})))}function Oe(e){return V({position:{x:0,y:0},canEdit:!1},e)}function ze(e){var t=y({data:e,key:"index",convert:b.number}),n=y({data:e,key:"forward",convert:b.boolean}),r=y({data:e,key:"carbonCopy",convert:b.boolean}),o=t>0?h({seed:30*t+t+2}):"#b1b1b7",l=t>0?h({seed:30*t+t+2}):"#ea7f5b";return V(V({animated:!0,canEdit:!1,sourceHandle:n?"bottom":"right",targetHandle:n?"top":"right"},e),{},{type:n?r?"carbonCopy":"forward":"backward",markerEnd:{type:p.ArrowClosed,color:n?o:l},style:{stroke:n?o:l}})}var Ae={};function Ke(t){var o=t.canEdit,l=t.multibranch,a=t.nodeNameKey,i=t.listInLineKey,c=t.listOutLineKey,p=t.listApproverKey,y=t.personnelNameKey,b=t.personnelNameLabel,E=t.nodes,h=t.edges,k=t.updateViewConfig,C=t.onEdgeCreate,P=v(E)?E:[],w=v(h)?h:[],S=I(s([]),3),R=S[0],N=S[1],O=S[2],z=I(d([]),3),A=z[0],K=z[1],L=z[2];n((function(){N(P),K(w)}),[P,w]);var j=R.map((function(e){return e.data.canEdit=o||!1,e.data.multibranch=l||!1,e.data.nodeNameKey=a,e.data.listInLineKey=i,e.data.listOutLineKey=c,e.data.listApproverKey=p,e.data.personnelNameKey=y,e.data.personnelNameLabel=b,e})),T=A.map((function(e){return e.data.canEdit=o||!1,e.data.multibranch=l||!1,e}));return e.createElement(r,{fitView:!0,nodes:j,edges:T,onConnect:function(e){x(C)&&C(e)},onNodesChange:function(e){o&&O(e)},onEdgesChange:function(e){o&&L(e)},onNodeDragStart:function(e,t){if(o){var n=t.position;Ae=n}},onNodeDragStop:function(e,t){if(o&&x(k)){var n=t.position,r=t.data.data,l=n.x,a=n.y,i=Ae,c=i.x,p=i.y;l==c&&a==p||k({viewConfigData:JSON.stringify({position:n})},r)}},nodeTypes:we,edgeTypes:Se},e.createElement(u,null),e.createElement(m,{zoomable:!0,pannable:!0}),e.createElement(f,{position:"top-left"},e.createElement(Re,null)),e.createElement(f,{position:"top-right"},o?e.createElement(Ne,null):null),e.createElement(g,null))}Ke.defaultProps={canEdit:!0,multibranch:!1,nodeNameKey:"nodeNameKey",listInLineKey:"listInLine",listOutLineKey:"listOutLine",listApproverKey:"listApprover",personnelNameKey:"personnelNameKey",personnelNameLabel:"personnelNameLabel",onEdgeCreate:function(){}};var Le=k.Paragraph;function je(t){var n=t.style,r=t.title,o=t.showTitle,l=t.showLeftDivider,a=t.list,i=t.listItemConvert,c=t.nextData,p=t.nextDataConvert,s=null==c?null:x(p)?p(c):c,d=(v(a)?a:[]).map((function(e){return x(i)?i(e):e}));null!=s&&d.push(s);var u=null;if(d.length<=0)u=e.createElement(N,null);else{var m=d.length,f=d.map((function(t,n){var r=V({titlePrefix:"审批节点",icon:null,color:null,notePrefix:"审批备注",resultPrefix:"审批结果",operatorNamePrefix:"审批人",timePrefix:"审批时间",compact:!1},t),o=r.titlePrefix,l=r.title,a=r.notePrefix,i=r.note,c=r.resultPrefix,p=r.result,d=r.operatorNamePrefix,u=r.operatorName,f=r.timePrefix,g=r.time,y=r.icon,x=r.color,b=r.compact;return{color:x||(null==s&&m===n+1?"blue":"gray"),dot:y,children:e.createElement(e.Fragment,null,E(l)?null:e.createElement(Le,null,e.createElement(L,{separatorStyle:{padding:"0 4px 0 2px"},textPrefix:o,text:l})),b||E(p)?null:e.createElement(Le,null,e.createElement(L,{separatorStyle:{padding:"0 4px 0 2px"},textPrefix:c,text:p})),b||E(u)?null:e.createElement(Le,null,e.createElement(L,{separatorStyle:{padding:"0 4px 0 2px"},textPrefix:d,text:u})),b||E(i)?null:e.createElement(Le,null,e.createElement(L,{separatorStyle:{padding:"0 4px 0 2px"},textPrefix:a,text:i||"无备注"})),b||E(g)?null:e.createElement(Le,null,e.createElement(L,{separatorStyle:{padding:"0 4px 0 2px"},textPrefix:f,text:g})))}}));u=e.createElement(O,{reverse:!0,style:{marginTop:"10px"},items:f})}var g=e.createElement(A,{style:{height:"100%"},flexAuto:"bottom",topStyle:{paddingBottom:"6px"},top:o?e.createElement(R,{message:"".concat(r,":"),type:"info"}):null,bottom:o?e.createElement("div",{style:{height:"100%",position:"relative"}},e.createElement(B,{style:{position:"absolute",left:0,top:0,paddingLeft:"6px",paddingRight:"6px",height:"100%",width:"100%",overflowY:"auto"}},u)):u});return l?e.createElement(A,{style:V(V({},n),{},{height:"100%"}),flexAuto:"right",left:e.createElement(P,{type:"vertical",style:{height:"100%"}}),right:g}):g}je.defaultProps={style:{},title:"审批进度",showTitle:!1,showLeftDivider:!1,canEdit:!0,list:[],listItemConvert:null,nextData:null,nextDataConvert:null};export{Ke as Flow,je as FlowProcessHistory,ze as adjustEdge,Oe as adjustNode};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antd-management-fast-flow",
3
- "version": "1.0.77",
3
+ "version": "1.0.80",
4
4
  "keywords": [
5
5
  "antd-management-fast-flow"
6
6
  ],
@@ -61,7 +61,7 @@
61
61
  "antd-management-fast-common": "workspace:*",
62
62
  "antd-management-fast-component": "workspace:*",
63
63
  "classnames": "^2.5.1",
64
- "easy-soft-utility": "^2.8.57",
64
+ "easy-soft-utility": "^2.8.58",
65
65
  "react": "^18.3.1",
66
66
  "react-dom": "^18.3.1",
67
67
  "reactflow": "^11.11.4"
@@ -93,7 +93,7 @@
93
93
  "cross-env": "^7.0.3",
94
94
  "cz-git": "^1.9.4",
95
95
  "docdash": "^2.0.2",
96
- "easy-soft-develop": "^2.1.216",
96
+ "easy-soft-develop": "^2.1.224",
97
97
  "eslint": "^8.57.0",
98
98
  "eslint-config-airbnb": "^19.0.4",
99
99
  "eslint-config-airbnb-typescript": "^18.0.0",