本地logicflow依赖包
This commit is contained in:
1 parent
8ff82208ad
commit
30f225df00
290 files changed
+18624
-16276
No files matched your search
File diff suppressed because it is too large.
Load diff
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
(function(){function a(a,b){return[-a[0][b]+3*a[1][b]+-3*a[2][b]+a[3][b],3*a[0][b]-6*a[1][b]+3*a[2][b],-3*a[0][b]+3*a[1][b],a[0][b]]}function b(b){return[a(b,"x"),a(b,"y")]}function c(a){return 0>a?-1:a>0?1:0}function d(a,b,d,e){var f,g,h=b/a,i=d/a,j=e/a,k=(3*i-Math.pow(h,2))/9,l=(9*h*i-27*j-2*Math.pow(h,3))/54,m=Math.pow(k,3)+Math.pow(l,2),n=[];if(m>=0)f=c(l+Math.sqrt(m))*Math.pow(Math.abs(l+Math.sqrt(m)),1/3),g=c(l-Math.sqrt(m))*Math.pow(Math.abs(l-Math.sqrt(m)),1/3),n[0]=-h/3+(f+g),n[1]=-h/3-(f+g)/2,n[2]=-h/3-(f+g)/2,0!==Math.abs(Math.sqrt(3)*(f-g)/2)&&(n[1]=-1,n[2]=-1);else{var o=Math.acos(l/Math.sqrt(-Math.pow(k,3)));n[0]=2*Math.sqrt(-k)*Math.cos(o/3)-h/3,n[1]=2*Math.sqrt(-k)*Math.cos((o+2*Math.PI)/3)-h/3,n[2]=2*Math.sqrt(-k)*Math.cos((o+4*Math.PI)/3)-h/3}for(var p=0;3>p;p++)(n[p]<0||n[p]>1)&&(n[p]=-1);return n}"undefined"==typeof Math.sgn&&(Math.sgn=function(a){return 0==a?0:a>0?1:-1});var e={subtract:function(a,b){return{x:a.x-b.x,y:a.y-b.y}},dotProduct:function(a,b){return a.x*b.x+a.y*b.y},square:function(a){return Math.sqrt(a.x*a.x+a.y*a.y)},scale:function(a,b){return{x:a.x*b,y:a.y*b}}},f=64,g=Math.pow(2,-f-1),h=function(a,b){for(var c=[],d=j(a,b),f=b.length-1,g=2*f-1,h=k(d,g,c,0),i=e.subtract(a,b[0]),l=e.square(i),m=0,n=0;h>n;n++){i=e.subtract(a,o(b,f,c[n],null,null));var p=e.square(i);l>p&&(l=p,m=c[n])}return i=e.subtract(a,b[f]),p=e.square(i),l>p&&(l=p,m=1),{location:m,distance:l}},i=function(a,b){var c=h(a,b);return{point:o(b,b.length-1,c.location,null,null),location:c.location}},j=function(a,b){for(var c=b.length-1,d=2*c-1,f=[],g=[],h=[],i=[],j=[[1,.6,.3,.1],[.4,.6,.6,.4],[.1,.3,.6,1]],k=0;c>=k;k++)f[k]=e.subtract(b[k],a);for(var k=0;c-1>=k;k++)g[k]=e.subtract(b[k+1],b[k]),g[k]=e.scale(g[k],3);for(var l=0;c-1>=l;l++)for(var m=0;c>=m;m++)h[l]||(h[l]=[]),h[l][m]=e.dotProduct(g[l],f[m]);for(k=0;d>=k;k++)i[k]||(i[k]=[]),i[k].y=0,i[k].x=parseFloat(k)/d;for(var n=c,o=c-1,p=0;n+o>=p;p++){var q=Math.max(0,p-o),r=Math.min(p,n);for(k=q;r>=k;k++){var s=p-k;i[k+s].y+=h[s][k]*j[s][k]}}return i},k=function(a,b,c,d){var e,g,h=[],i=[],j=[],p=[];switch(l(a,b)){case 0:return 0;case 1:if(d>=f)return c[0]=(a[0].x+a[b].x)/2,1;if(m(a,b))return c[0]=n(a,b),1}o(a,b,.5,h,i),e=k(h,b,j,d+1),g=k(i,b,p,d+1);for(var q=0;e>q;q++)c[q]=j[q];for(var q=0;g>q;q++)c[q+e]=p[q];return e+g},l=function(a,b){var c,d,e=0;c=d=Math.sgn(a[0].y);for(var f=1;b>=f;f++)c=Math.sgn(a[f].y),c!=d&&e++,d=c;return e},m=function(a,b){var c,d,e,f,h,i,j,k,l,m,n,o,p,q,r,s;i=a[0].y-a[b].y,j=a[b].x-a[0].x,k=a[0].x*a[b].y-a[b].x*a[0].y;var t,u;t=u=0;for(var v=1;b>v;v++){var w=i*a[v].x+j*a[v].y+k;w>t?t=w:u>w&&(u=w)}return n=0,o=1,p=0,q=i,r=j,s=k-t,l=n*r-q*o,m=1/l,d=(o*s-r*p)*m,q=i,r=j,s=k-u,l=n*r-q*o,m=1/l,e=(o*s-r*p)*m,f=Math.min(d,e),h=Math.max(d,e),c=h-f,g>c?1:0},n=function(a,b){var c=1,d=0,e=a[b].x-a[0].x,f=a[b].y-a[0].y,g=a[0].x-0,h=a[0].y-0,i=e*d-f*c,j=1/i,k=(e*h-f*g)*j;return 0+c*k},o=function(a,b,c,d,e){for(var f=[[]],g=0;b>=g;g++)f[0][g]=a[g];for(var h=1;b>=h;h++)for(var g=0;b-h>=g;g++)f[h]||(f[h]=[]),f[h][g]||(f[h][g]={}),f[h][g].x=(1-c)*f[h-1][g].x+c*f[h-1][g+1].x,f[h][g].y=(1-c)*f[h-1][g].y+c*f[h-1][g+1].y;if(null!=d)for(g=0;b>=g;g++)d[g]=f[g][0];if(null!=e)for(g=0;b>=g;g++)e[g]=f[b-g][g];return f[b][0]},p={},q=function(a){var b=p[a];if(!b){b=[];var c=function(){return function(b){return Math.pow(b,a)}},d=function(){return function(b){return Math.pow(1-b,a)}},e=function(a){return function(b){return a}},f=function(){return function(a){return a}},g=function(){return function(a){return 1-a}},h=function(a){return function(b){for(var c=1,d=0;d<a.length;d++)c*=a[d](b);return c}};b.push(new c);for(var i=1;a>i;i++){for(var j=[new e(a)],k=0;a-i>k;k++)j.push(new f);for(var k=0;i>k;k++)j.push(new g);b.push(new h(j))}b.push(new d),p[a]=b}return b},r=function(a,b){for(var c=q(a.length-1),d=0,e=0,f=0;f<a.length;f++)d+=a[f].x*c[f](b),e+=a[f].y*c[f](b);return{x:d,y:e}},s=function(a,b){return Math.sqrt(Math.pow(a.x-b.x,2)+Math.pow(a.y-b.y,2))},t=function(a){return a[0].x===a[1].x&&a[0].y===a[1].y},u=function(a,b,c){if(t(a))return{point:a[0],location:b};for(var d=r(a,b),e=0,f=b,g=c>0?1:-1,h=null;e<Math.abs(c);)f+=.005*g,h=r(a,f),e+=s(h,d),d=h;return{point:h,location:f}},v=function(a){if(t(a))return 0;for(var b=r(a,0),c=0,d=0,e=1,f=null;1>d;)d+=.005*e,f=r(a,d),c+=s(f,b),b=f;return c},w=function(a,b,c){return u(a,b,c).point},x=function(a,b,c){return u(a,b,c).location},y=function(a,b){var c=r(a,b),d=r(a.slice(0,a.length-1),b),e=d.y-c.y,f=d.x-c.x;return 0===e?1/0:Math.atan(e/f)},z=function(a,b,c){var d=u(a,b,c);return d.location>1&&(d.location=1),d.location<0&&(d.location=0),y(a,d.location)},A=function(a,b,c,d){d=null==d?0:d;var e=u(a,b,d),f=y(a,e.location),g=Math.atan(-1/f),h=c/2*Math.sin(g),i=c/2*Math.cos(g);return[{x:e.point.x+i,y:e.point.y+h},{x:e.point.x-i,y:e.point.y-h}]},B=function(a,c,e,f,g){var h=f-c,i=a-e,j=a*(c-f)+c*(e-a),k=b(g),l=[h*k[0][0]+i*k[1][0],h*k[0][1]+i*k[1][1],h*k[0][2]+i*k[1][2],h*k[0][3]+i*k[1][3]+j],m=d.apply(null,l),n=[];if(null!=m)for(varLine truncated
|
||||
this[a+"Scope"]=function(b,c){x(b._katavorioDrag,c,this._dragsByScope,a+"Scope"),x(b._katavorioDrop,c,this._dropsByScope,a+"Scope")}.bind(this),this[a+"DragScope"]=function(b,c){x(b.constructor===F?b:b._katavorioDrag,c,this._dragsByScope,a+"Scope")}.bind(this),this[a+"DropScope"]=function(b,c){x(b.constructor===G?b:b._katavorioDrop,c,this._dropsByScope,a+"Scope")}.bind(this)}.bind(this)),this.snapToGrid=function(a,b){for(var c in this._dragsByScope)w(this._dragsByScope[c],function(c){c.snap(a,b)})},this.getDragsForScope=function(a){return this._dragsByScope[a]},this.getDropsForScope=function(a){return this._dropsByScope[a]};var z=function(a,b,c){if(a=J(a),a[b]){var d=f.indexOf(a[b]);d>=0&&f.splice(d,1),j(a[b],c)&&y(a[b],function(a){a.destroy()}),delete a[b]}},B=function(a,b,c,d){a=J(a),a[b]&&a[b].off(c,d)};this.elementRemoved=function(a){this.destroyDraggable(a),this.destroyDroppable(a)},this.destroyDraggable=function(a,b,c){1===arguments.length?z(a,"_katavorioDrag",this._dragsByScope):B(a,"_katavorioDrag",b,c)},this.destroyDroppable=function(a,b,c){1===arguments.length?z(a,"_katavorioDrop",this._dropsByScope):B(a,"_katavorioDrop",b,c)},this.reset=function(){this._dragsByScope={},this._dropsByScope={},f=[],g={},C={}};var C={},D=function(a,c,d){var f=e(c)?c:c.id,g=e(c)?!0:c.active!==!1,h=C[f]||function(){var a={name:f,members:[]};return C[f]=a,a}();return y(a,function(a){if(a._katavorioDrag){if(d&&null!=a._katavorioDrag.posseRoles[h.name])return;b(h.members,a._katavorioDrag),b(a._katavorioDrag.posses,h.name),a._katavorioDrag.posseRoles[h.name]=g}}),h};this.addToPosse=function(a,b){for(var c=[],d=1;d<arguments.length;d++)c.push(D(a,arguments[d]));return 1===c.length?c[0]:c},this.setPosse=function(a,b){for(var c=[],e=1;e<arguments.length;e++)c.push(D(a,arguments[e],!0).name);return y(a,function(a){if(a._katavorioDrag){var b=d(a._katavorioDrag.posses,c),e=[];Array.prototype.push.apply(e,a._katavorioDrag.posses);for(var f=0;f<b.length;f++)this.removeFromPosse(a,b[f])}}.bind(this)),1===c.length?c[0]:c},this.removeFromPosse=function(a,b){if(arguments.length<2)throw new TypeError("No posse id provided for remove operation");for(var d=1;d<arguments.length;d++)b=arguments[d],y(a,function(a){if(a._katavorioDrag&&a._katavorioDrag.posses){var d=a._katavorioDrag;y(b,function(a){c(C[a].members,d),c(d.posses,a),delete d.posseRoles[a]})}})},this.removeFromAllPosses=function(a){y(a,function(a){if(a._katavorioDrag&&a._katavorioDrag.posses){var b=a._katavorioDrag;y(b.posses,function(a){c(C[a].members,b)}),b.posses.length=0,b.posseRoles={}}})},this.setPosseState=function(a,b,c){var d=C[b];d&&y(a,function(a){a._katavorioDrag&&a._katavorioDrag.posses&&(a._katavorioDrag.posseRoles[d.name]=c)})}},a.Katavorio.version="1.0.0","undefined"!=typeof exports&&(exports.Katavorio=a.Katavorio)}.call("undefined"!=typeof window?window:this),function(){function a(a){return"[object Array]"===Object.prototype.toString.call(a)}function b(a){return"[object Number]"===Object.prototype.toString.call(a)}function c(a){return"string"==typeof a}function d(a){return"boolean"==typeof a}function e(a){return null==a}function f(a){return null==a?!1:"[object Object]"===Object.prototype.toString.call(a)}function g(a){return"[object Date]"===Object.prototype.toString.call(a)}function h(a){return"[object Function]"===Object.prototype.toString.call(a)}function i(a){return h(a)&&null!=a.name&&a.name.length>0}function j(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0}function k(b){if(c(b))return""+b;if(d(b))return!!b;if(g(b))return new Date(b.getTime());if(h(b))return b;if(a(b)){for(var e=[],i=0;i<b.length;i++)e.push(k(b[i]));return e}if(f(b)){var j={};for(var l in b)j[l]=k(b[l]);return j}return b}function l(b,e,g,h){var i,j,l={},m={};for(g=g||[],h=h||[],j=0;j<g.length;j++)l[g[j]]=!0;for(j=0;j<h.length;j++)m[h[j]]=!0;var n=k(b);for(j in e)if(null==n[j]||m[j])n[j]=e[j];else if(c(e[j])||d(e[j]))l[j]?(i=[],i.push.apply(i,a(n[j])?n[j]:[n[j]]),i.push.apply(i,d(e[j])?e[j]:[e[j]]),n[j]=i):n[j]=e[j];else if(a(e[j]))i=[],a(n[j])&&i.push.apply(i,n[j]),i.push.apply(i,e[j]),n[j]=i;else if(f(e[j])){f(n[j])||(n[j]={});for(var o in e[j])n[j][o]=e[j][o]}return n}function m(a,b,c){if(null!=a){var d=a,e=d;return b.replace(/([^\.])+/g,function(a,b,d,f){var g=a.match(/([^\[0-9]+){1}(\[)([0-9+])/),h=d+a.length>=f.length,i=function(){return e[g[1]]||function(){return e[g[1]]=[],e[g[1]]}()};if(h)g?i()[g[3]]=c:e[a]=c;else if(g){var j=i();e=j[g[3]]||function(){return j[g[3]]={},j[g[3]]}()}else e=e[a]||function(){return e[a]={},e[a]}();return""}),a}}function n(a,b,c){for(var d=0;d<c.length;d++){var e=c[d][0][c[d][1]].apply(c[d][0],c[d][2]);if(e===b)return e}return a}function o(b,d,e,g){var i=function(a){var b=a.match(/(\${.*?})/g);if(null!=b)for(var c=0;c<b.length;c++){var e=d[b[c].substring(2,b[c].length-1)]||"";null!=e&&(a=a.replace(b[c],e))}return a},j=function(b){if(null!=b){if(c(b))return i(b);if(!h(b)||g||null!=e&&0!==(b.name||"").indexOf(e)){if(a(b)){for(var k=[],l=0;l<b.lLine truncated
|
||||
f};var W=function(a,b,c){var d=f.Defaults.ConnectionType||f.getDefaultConnectionType(),e=a.constructor===d,g=e?{connection:a,source:a.source,target:a.target,sourceId:a.sourceId,targetId:a.targetId,sourceEndpoint:a.endpoints[0],targetEndpoint:a.endpoints[1]}:a;b&&f.fire("connectionDetached",g,c),f.fire("internal.connectionDetached",g,c),f.anchorManager.connectionDetached(g)},X=f.fireMoveEvent=function(a,b){f.fire("connectionMoved",a,b)};this.unregisterEndpoint=function(a){a._jsPlumb.uuid&&(v[a._jsPlumb.uuid]=null),f.anchorManager.deleteEndpoint(a);for(var b in u){var c=u[b];if(c){for(var d=[],e=0,g=c.length;g>e;e++)c[e]!==a&&d.push(c[e]);u[b]=d}u[b].length<1&&delete u[b]}};var Y="isDetachAllowed",Z="beforeDetach",$="checkCondition";this.deleteConnection=function(a,c){return null!=a&&(c=c||{},c.force||b.functionChain(!0,!1,[[a.endpoints[0],Y,[a]],[a.endpoints[1],Y,[a]],[a,Y,[a]],[f,$,[Z,a]]]))?(a.setHover(!1),W(a,!a.pending&&c.fireEvent!==!1,c.originalEvent),a.endpoints[0].detachFromConnection(a),a.endpoints[1].detachFromConnection(a),b.removeWithFunction(t,function(b){return a.id===b.id}),a.cleanup(),a.destroy(),!0):!1},this.deleteEveryConnection=function(a){a=a||{};var b=t.length,c=0;return f.batch(function(){for(var d=0;b>d;d++)c+=f.deleteConnection(t[0],a)?1:0}),c},this.deleteConnectionsForElement=function(a,b){b=b||{},a=f.getElement(a);var c=T(a),d=u[c];if(d&&d.length)for(var e=0,g=d.length;g>e;e++)d[e].deleteEveryConnection(b);return f},this.deleteObject=function(a){var c={endpoints:{},connections:{},endpointCount:0,connectionCount:0},d=a.deleteAttachedObjects!==!1,e=function(b){null!=b&&null==c.connections[b.id]&&(a.dontUpdateHover||null==b._jsPlumb||b.setHover(!1),c.connections[b.id]=b,c.connectionCount++)},g=function(b){if(null!=b&&null==c.endpoints[b.id]&&(a.dontUpdateHover||null==b._jsPlumb||b.setHover(!1),c.endpoints[b.id]=b,c.endpointCount++,d))for(var f=0;f<b.connections.length;f++){var g=b.connections[f];e(g)}};a.connection?e(a.connection):g(a.endpoint);for(var h in c.connections){var i=c.connections[h];if(i._jsPlumb){b.removeWithFunction(t,function(a){return i.id===a.id}),W(i,a.fireEvent===!1?!1:!i.pending,a.originalEvent);var j=null==a.deleteAttachedObjects?null:!a.deleteAttachedObjects;i.endpoints[0].detachFromConnection(i,null,j),i.endpoints[1].detachFromConnection(i,null,j),i.cleanup(!0),i.destroy(!0)}}for(var k in c.endpoints){var l=c.endpoints[k];l._jsPlumb&&(f.unregisterEndpoint(l),l.cleanup(!0),l.destroy(!0))}return c};var _=function(a,b,c,d){for(var e=0,f=a.length;f>e;e++)a[e][b].apply(a[e],c);return d(a)},aa=function(a,b,c){for(var d=[],e=0,f=a.length;f>e;e++)d.push([a[e][b].apply(a[e],c),a[e]]);return d},ba=function(a,b,c){return function(){return _(a,b,arguments,c)}},ca=function(a,b){return function(){return aa(a,b,arguments)}},da=function(a,b){var c=[];if(a)if("string"==typeof a){if("*"===a)return a;c.push(a)}else if(b)c=a;else if(a.length)for(var d=0,e=a.length;e>d;d++)c.push(l(a[d]).id);else c.push(l(a).id);return c},ea=function(a,b,c){return"*"===a?!0:a.length>0?-1!==a.indexOf(b):!c};this.getConnections=function(a,b){a?a.constructor===String&&(a={scope:a}):a={};for(var c=a.scope||f.getDefaultScope(),d=da(c,!0),e=da(a.source),g=da(a.target),h=!b&&d.length>1?{}:[],i=function(a,c){if(!b&&d.length>1){var e=h[a];null==e&&(e=h[a]=[]),e.push(c)}else h.push(c)},j=0,k=t.length;k>j;j++){var l=t[j],m=l.proxies&&l.proxies[0]?l.proxies[0].originalEp.elementId:l.sourceId,n=l.proxies&&l.proxies[1]?l.proxies[1].originalEp.elementId:l.targetId;ea(d,l.scope)&&ea(e,m)&&ea(g,n)&&i(l.scope,l)}return h};var fa=function(a,b){return function(c){for(var d=0,e=a.length;e>d;d++)c(a[d]);return b(a)}},ga=function(a){return function(b){return a[b]}},ha=function(a,b){var c,d,e={length:a.length,each:fa(a,b),get:ga(a)},f=["setHover","removeAllOverlays","setLabel","addClass","addOverlay","removeOverlay","removeOverlays","showOverlay","hideOverlay","showOverlays","hideOverlays","setPaintStyle","setHoverPaintStyle","setSuspendEvents","setParameter","setParameters","setVisible","repaint","addType","toggleType","removeType","removeClass","setType","bind","unbind"],g=["getLabel","getOverlay","isHover","getParameter","getParameters","getPaintStyle","getHoverPaintStyle","isVisible","hasType","getType","isSuspendEvents"];for(c=0,d=f.length;d>c;c++)e[f[c]]=ba(a,f[c],b);for(c=0,d=g.length;d>c;c++)e[g[c]]=ca(a,g[c]);return e},ia=function(a){var b=ha(a,ia);return o.extend(b,{setDetachable:ba(a,"setDetachable",ia),setReattach:ba(a,"setReattach",ia),setConnector:ba(a,"setConnector",ia),"delete":function(){for(var b=0,c=a.length;c>b;b++)f.deleteConnection(a[b])},isDetachable:ca(a,"isDetachable"),isReattach:ca(a,"isReattach")})},ja=function(a){var b=ha(a,ja);return o.extend(b,{setEnabled:ba(a,"setEnabled",ja),setAnchor:ba(a,"setAnchor",ja),isEnabled:ca(a,"isEnabled"),deleteEveryConnection:function(){for(var b=0,c=a.length;c>b;b++)a[b].deleteEveryConnection()},"delete":function(){for(var b=0,c=a.length;c>b;b++)f.deleteEndpointLine truncated
|
||||
}.bind(this);this.prepareAnchor=function(a){var b=this._jsPlumb.instance.makeAnchor(a,this.elementId,i);return b.bind("anchorChanged",function(a){this.fire("anchorChanged",{endpoint:this,anchor:a}),n()}.bind(this)),b},this.setPreparedAnchor=function(a,b){return this._jsPlumb.instance.continuousAnchorFactory.clear(this.elementId),this.anchor=a,n(),b||this._jsPlumb.instance.repaint(this.elementId),this},this.setAnchor=function(a,b){var c=this.prepareAnchor(a);return this.setPreparedAnchor(c,b),this};var o=function(a){if(this.connections.length>0)for(var b=0;b<this.connections.length;b++)this.connections[b].setHover(a,!1);else this.setHover(a)}.bind(this);this.bind("mouseover",function(){o(!0)}),this.bind("mouseout",function(){o(!1)}),a._transient||this._jsPlumb.instance.anchorManager.add(this,this.elementId),this.prepareEndpoint=function(d,e){var f,g=function(a,c){var d=i.getRenderMode();if(b.Endpoints[d][a])return new b.Endpoints[d][a](c);if(!i.Defaults.DoNotThrowErrors)throw{msg:"jsPlumb: unknown endpoint type '"+a+"'"}},h={_jsPlumb:this._jsPlumb.instance,cssClass:a.cssClass,container:a.container,tooltip:a.tooltip,connectorTooltip:a.connectorTooltip,endpoint:this};return c.isString(d)?f=g(d,h):c.isArray(d)?(h=c.merge(d[1],h),f=g(d[0],h)):f=d.clone(),f.clone=function(){return c.isString(d)?g(d,h):c.isArray(d)?(h=c.merge(d[1],h),g(d[0],h)):void 0}.bind(this),f.typeId=e,f},this.setEndpoint=function(a,b){var c=this.prepareEndpoint(a);this.setPreparedEndpoint(c,!0)},this.setPreparedEndpoint=function(a,b){null!=this.endpoint&&(this.endpoint.cleanup(),this.endpoint.destroy()),this.endpoint=a,this.type=this.endpoint.type,this.canvas=this.endpoint.canvas},b.extend(this,a,g),this.isSource=a.isSource||!1,this.isTemporarySource=a.isTemporarySource||!1,this.isTarget=a.isTarget||!1,this.connections=a.connections||[],this.connectorPointerEvents=a["connector-pointer-events"],this.scope=a.scope||i.getDefaultScope(),this.timestamp=null,this.reattachConnections=a.reattach||i.Defaults.ReattachConnections,this.connectionsDetachable=i.Defaults.ConnectionsDetachable,(a.connectionsDetachable===!1||a.detachable===!1)&&(this.connectionsDetachable=!1),this.dragAllowedWhenFull=a.dragAllowedWhenFull!==!1,a.onMaxConnections&&this.bind("maxConnections",a.onMaxConnections),this.addConnection=function(a){this.connections.push(a),this[(this.connections.length>0?"add":"remove")+"Class"](i.endpointConnectedClass),this[(this.isFull()?"add":"remove")+"Class"](i.endpointFullClass)},this.detachFromConnection=function(a,b,c){b=null==b?this.connections.indexOf(a):b,b>=0&&(this.connections.splice(b,1),this[(this.connections.length>0?"add":"remove")+"Class"](i.endpointConnectedClass),this[(this.isFull()?"add":"remove")+"Class"](i.endpointFullClass)),!c&&m&&0===this.connections.length&&i.deleteObject({endpoint:this,fireEvent:!1,deleteAttachedObjects:c!==!0})},this.deleteEveryConnection=function(a){for(var b=this.connections.length,c=0;b>c;c++)i.deleteConnection(this.connections[0],a)},this.detachFrom=function(a,b,c){for(var d=[],e=0;e<this.connections.length;e++)(this.connections[e].endpoints[1]===a||this.connections[e].endpoints[0]===a)&&d.push(this.connections[e]);for(var f=0,g=d.length;g>f;f++)i.deleteConnection(d[0]);return this},this.getElement=function(){return this.element},this.setElement=function(d){var e=this._jsPlumb.instance.getId(d),f=this.elementId;return c.removeWithFunction(a.endpointsByElement[this.elementId],function(a){return a.id===this.id}.bind(this)),this.element=b.getElement(d),this.elementId=i.getId(this.element),i.anchorManager.rehomeEndpoint(this,f,this.element),i.dragManager.endpointAdded(this.element),c.addToList(a.endpointsByElement,e,this),this},this.makeInPlaceCopy=function(){var b=this.anchor.getCurrentLocation({element:this}),c=this.anchor.getOrientation(this),d=this.anchor.getCssClass(),e={bind:function(){},compute:function(){return[b[0],b[1]]},getCurrentLocation:function(){return[b[0],b[1]]},getOrientation:function(){return c},getCssClass:function(){return d}};return k({dropOptions:a.dropOptions,anchor:e,source:this.element,paintStyle:this.getPaintStyle(),endpoint:a.hideOnDrag?"Blank":this.endpoint,_transient:!0,scope:this.scope,reference:this})},this.connectorSelector=function(){return this.connections[0]},this.setStyle=this.setPaintStyle,this.paint=function(a){a=a||{};var b=a.timestamp,c=!(a.recalc===!1);if(!b||this.timestamp!==b){var d=i.updateOffset({elId:this.elementId,timestamp:b}),e=a.offset?a.offset.o:d.o;if(null!=e){var f=a.anchorPoint,g=a.connectorPaintStyle;if(null==f){var j=a.dimensions||d.s,k={xy:[e.left,e.top],wh:j,element:this,timestamp:b};if(c&&this.anchor.isDynamic&&this.connections.length>0){var l=h(this,a.elementWithPrecedence),m=l.endpoints[0]===this?1:0,n=0===m?l.sourceId:l.targetId,o=i.getCachedData(n),p=o.o,q=o.s;k.index=0===m?1:0,k.connection=l,k.txy=[p.left,p.top],k.twh=q,k.tElement=l.endpoints[m]}else this.connections.length>0&&(k.connection=this.connections[0]);f=this.anchor.compute(k)}thiLine truncated
|
||||
endpoint:c,deleteAttachedObjects:!1}),this._jsPlumb.instance.fire("endpointReplaced",{previous:c,current:g}),this._jsPlumb.instance.anchorManager.updateOtherEndpoint(this.endpoints[0].elementId,this.endpoints[1].elementId,this.endpoints[1].elementId,this)}})}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.jsPlumbUtil,c=a.jsPlumb;c.AnchorManager=function(a){var d={},e={},f={},g={},h=this,i={},j=a.jsPlumbInstance,k={},l=function(a,b,c,d,e,f,g){for(var h=[],i=b[e?0:1]/(d.length+1),j=0;j<d.length;j++){var k=(j+1)*i,l=f*b[e?1:0];g&&(k=b[e?0:1]-k);var m=e?k:l,n=c[0]+m,o=m/b[0],p=e?l:k,q=c[1]+p,r=p/b[1];h.push([n,q,o,r,d[j][1],d[j][2]])}return h},m=function(a){return function(b,c){var d=!0;return d=a?b[0][0]<c[0][0]:b[0][0]>c[0][0],d===!1?-1:1}},n=function(a,b){var c=a[0][0]<0?-Math.PI-a[0][0]:Math.PI-a[0][0],d=b[0][0]<0?-Math.PI-b[0][0]:Math.PI-b[0][0];return c>d?1:-1},o={top:function(a,b){return a[0]>b[0]?1:-1},right:m(!0),bottom:m(!0),left:n},p=function(a,b){return a.sort(b)},q=function(a,b){var c=j.getCachedData(a),d=c.s,g=c.o,h=function(b,c,d,g,h,i,j){if(g.length>0)for(var k=p(g,o[b]),m="right"===b||"top"===b,n=l(b,c,d,k,h,i,m),q=function(a,b){e[a.id]=[b[0],b[1],b[2],b[3]],f[a.id]=j},r=0;r<n.length;r++){var s=n[r][4],t=s.endpoints[0].elementId===a,u=s.endpoints[1].elementId===a;t&&q(s.endpoints[0],n[r]),u&&q(s.endpoints[1],n[r])}};h("bottom",d,[g.left,g.top],b.bottom,!0,1,[0,1]),h("top",d,[g.left,g.top],b.top,!0,0,[0,-1]),h("left",d,[g.left,g.top],b.left,!1,0,[-1,0]),h("right",d,[g.left,g.top],b.right,!1,1,[1,0])};this.reset=function(){d={},g={},i={}},this.addFloatingConnection=function(a,b){k[a]=b},this.removeFloatingConnection=function(a){delete k[a]},this.newConnection=function(a){var d=a.sourceId,e=a.targetId,f=a.endpoints,h=!0,i=function(i,j,k,l,m){d===e&&k.isContinuous&&(a._jsPlumb.instance.removeElement(f[1].canvas),h=!1),b.addToList(g,l,[m,j,k.constructor===c.DynamicAnchor])};i(0,f[0],f[0].anchor,e,a),h&&i(1,f[1],f[1].anchor,d,a)};var r=function(a){!function(a,c){if(a){var d=function(a){return a[4]===c};b.removeWithFunction(a.top,d),b.removeWithFunction(a.left,d),b.removeWithFunction(a.bottom,d),b.removeWithFunction(a.right,d)}}(i[a.elementId],a.id)};this.connectionDetached=function(a,c){var d=a.connection||a,e=a.sourceId,f=a.targetId,i=d.endpoints,j=function(a,c,d,e,f){b.removeWithFunction(g[e],function(a){return a[0].id===f.id})};j(1,i[1],i[1].anchor,e,d),j(0,i[0],i[0].anchor,f,d),d.floatingId&&(j(d.floatingIndex,d.floatingEndpoint,d.floatingEndpoint.anchor,d.floatingId,d),r(d.floatingEndpoint)),r(d.endpoints[0]),r(d.endpoints[1]),c||(h.redraw(d.sourceId),d.targetId!==d.sourceId&&h.redraw(d.targetId))},this.add=function(a,c){b.addToList(d,c,a)},this.changeId=function(a,b){g[b]=g[a],d[b]=d[a],delete g[a],delete d[a]},this.getConnectionsFor=function(a){return g[a]||[]},this.getEndpointsFor=function(a){return d[a]||[]},this.deleteEndpoint=function(a){b.removeWithFunction(d[a.elementId],function(b){return b.id===a.id}),r(a)},this.clearFor=function(a){delete d[a],d[a]=[]};var s=function(c,d,e,f,g,h,i,j,k,l,m,n){var o,p,q=-1,r=-1,s=f.endpoints[i],t=s.id,u=[1,0][i],v=[[d,e],f,g,h,t],w=c[k],x=s._continuousAnchorEdge?c[s._continuousAnchorEdge]:null;if(x){var y=b.findWithFunction(x,function(a){return a[4]===t});if(-1!==y)for(x.splice(y,1),o=0;o<x.length;o++)p=x[o][1],b.addWithFunction(m,p,function(a){return a.id===p.id}),b.addWithFunction(n,x[o][1].endpoints[i],function(a){return a.id===p.endpoints[i].id}),b.addWithFunction(n,x[o][1].endpoints[u],function(a){return a.id===p.endpoints[u].id})}for(o=0;o<w.length;o++)p=w[o][1],1===a.idx&&w[o][3]===h&&-1===r&&(r=o),b.addWithFunction(m,p,function(a){return a.id===p.id}),b.addWithFunction(n,w[o][1].endpoints[i],function(a){return a.id===p.endpoints[i].id}),b.addWithFunction(n,w[o][1].endpoints[u],function(a){return a.id===p.endpoints[u].id});if(-1!==q)w[q]=v;else{var z=j?-1!==r?r:0:w.length;w.splice(z,0,v)}s._continuousAnchorEdge=k};this.updateOtherEndpoint=function(a,d,e,f){var h=b.findWithFunction(g[a],function(a){return a[0].id===f.id}),i=b.findWithFunction(g[d],function(a){return a[0].id===f.id});-1!==h&&(g[a][h][0]=f,g[a][h][1]=f.endpoints[1],g[a][h][2]=f.endpoints[1].anchor.constructor===c.DynamicAnchor),i>-1&&(g[d].splice(i,1),b.addToList(g,e,[f,f.endpoints[0],f.endpoints[0].anchor.constructor===c.DynamicAnchor])),f.updateConnectedClass()},this.sourceChanged=function(a,d,e,f){if(a!==d){e.sourceId=d,e.source=f,b.removeWithFunction(g[a],function(a){return a[0].id===e.id});var h=b.findWithFunction(g[e.targetId],function(a){return a[0].id===e.id});h>-1&&(g[e.targetId][h][0]=e,g[e.targetId][h][1]=e.endpoints[0],g[e.targetId][h][2]=e.endpoints[0].anchor.constructor===c.DynamicAnchor),b.addToList(g,d,[e,e.endpoints[1],e.endpoints[1].anchor.constructor===c.DynamicAnchor]),e.endpoints[1].anchor.isContinuous&&(e.source===e.target?e._jsPlumb.instance.removeElement(e.endpoints[1].canvas):null==e.endpoints[1].canvas.parentNode&&e._jsLine truncated
|
||||
display:"block",width:"1px",height:"1px",background:"transparent",position:"absolute"},this._jsPlumb.instance.endpointClass+d),this._jsPlumb.instance.appendElement(this.canvas),this.paint=function(a,b){c.sizeElement(this.canvas,this.x,this.y,this.w,this.h)}},c.extend(b.Endpoints.Blank,[b.Endpoints.AbstractEndpoint,f],{cleanup:function(){this.canvas&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}}),b.Endpoints.Triangle=function(a){this.type="Triangle",b.Endpoints.AbstractEndpoint.apply(this,arguments);var c=this;a=a||{},a.width=a.width||55,a.height=a.height||55,this.width=a.width,this.height=a.height,this._compute=function(a,b,d,e){var f=d.width||c.width,g=d.height||c.height,h=a[0]-f/2,i=a[1]-g/2;return[h,i,f,g]}};var g=b.Overlays.AbstractOverlay=function(a){this.visible=!0,this.isAppendedAtTopLevel=!0,this.component=a.component,this.loc=null==a.location?.5:a.location,this.endpointLoc=null==a.endpointLocation?[.5,.5]:a.endpointLocation,this.visible=a.visible!==!1};g.prototype={cleanup:function(a){a&&(this.component=null,this.canvas=null,this.endpointLoc=null)},reattach:function(a,b){},setVisible:function(a){this.visible=a,this.component.repaint()},isVisible:function(){return this.visible},hide:function(){this.setVisible(!1)},show:function(){this.setVisible(!0)},incrementLocation:function(a){this.loc+=a,this.component.repaint()},setLocation:function(a){this.loc=a,this.component.repaint()},getLocation:function(){return this.loc},updateFrom:function(){}},b.Overlays.Arrow=function(a){this.type="Arrow",g.apply(this,arguments),this.isAppendedAtTopLevel=!1,a=a||{};var e=this;this.length=a.length||20,this.width=a.width||20,this.id=a.id,this.direction=(a.direction||1)<0?-1:1;var f=a.paintStyle||{"stroke-width":1},h=a.foldback||.623;this.computeMaxSize=function(){return 1.5*e.width},this.elementCreated=function(c,d){if(this.path=c,a.events)for(var e in a.events)b.on(c,e,a.events[e])},this.draw=function(a,b){var e,g,i,j,k;if(a.pointAlongPathFrom){if(c.isString(this.loc)||this.loc>1||this.loc<0){var l=parseInt(this.loc,10),m=this.loc<0?1:0;e=a.pointAlongPathFrom(m,l,!1),g=a.pointAlongPathFrom(m,l-this.direction*this.length/2,!1),i=d.pointOnLine(e,g,this.length)}else if(1===this.loc){if(e=a.pointOnPath(this.loc),g=a.pointAlongPathFrom(this.loc,-this.length),i=d.pointOnLine(e,g,this.length),-1===this.direction){var n=i;i=e,e=n}}else if(0===this.loc){if(i=a.pointOnPath(this.loc),g=a.pointAlongPathFrom(this.loc,this.length),e=d.pointOnLine(i,g,this.length),-1===this.direction){var o=i;i=e,e=o}}else e=a.pointAlongPathFrom(this.loc,this.direction*this.length/2),g=a.pointOnPath(this.loc),i=d.pointOnLine(e,g,this.length);j=d.perpendicularLineTo(e,i,this.width),k=d.pointOnLine(e,i,h*this.length);var p={hxy:e,tail:j,cxy:k},q=f.stroke||b.stroke,r=f.fill||b.stroke,s=f.strokeWidth||b.strokeWidth;return{component:a,d:p,"stroke-width":s,stroke:q,fill:r,minX:Math.min(e.x,j[0].x,j[1].x),maxX:Math.max(e.x,j[0].x,j[1].x),minY:Math.min(e.y,j[0].y,j[1].y),maxY:Math.max(e.y,j[0].y,j[1].y)}}return{component:a,minX:0,maxX:0,minY:0,maxY:0}}},c.extend(b.Overlays.Arrow,g,{updateFrom:function(a){this.length=a.length||this.length,this.width=a.width||this.width,this.direction=null!=a.direction?a.direction:this.direction,this.foldback=a.foldback||this.foldback},cleanup:function(){this.path&&this.canvas&&this.canvas.removeChild(this.path)}}),b.Overlays.PlainArrow=function(a){a=a||{};var c=b.extend(a,{foldback:1});b.Overlays.Arrow.call(this,c),this.type="PlainArrow"},c.extend(b.Overlays.PlainArrow,b.Overlays.Arrow),b.Overlays.Diamond=function(a){a=a||{};var c=a.length||40,d=b.extend(a,{length:c/2,foldback:2});b.Overlays.Arrow.call(this,d),this.type="Diamond"},c.extend(b.Overlays.Diamond,b.Overlays.Arrow);var h=function(a,b){return(null==a._jsPlumb.cachedDimensions||b)&&(a._jsPlumb.cachedDimensions=a.getDimensions()),a._jsPlumb.cachedDimensions},i=function(a){b.jsPlumbUIComponent.apply(this,arguments),g.apply(this,arguments);var d=this.fire;this.fire=function(){d.apply(this,arguments),this.component&&this.component.fire.apply(this.component,arguments)},this.detached=!1,this.id=a.id,this._jsPlumb.div=null,this._jsPlumb.initialised=!1,this._jsPlumb.component=a.component,this._jsPlumb.cachedDimensions=null,this._jsPlumb.create=a.create,this._jsPlumb.initiallyInvisible=a.visible===!1,this.getElement=function(){if(null==this._jsPlumb.div){var c=this._jsPlumb.div=b.getElement(this._jsPlumb.create(this._jsPlumb.component));c.style.position="absolute",jsPlumb.addClass(c,this._jsPlumb.instance.overlayClass+" "+(this.cssClass?this.cssClass:a.cssClass?a.cssClass:"")),this._jsPlumb.instance.appendElement(c),this._jsPlumb.instance.getId(c),this.canvas=c;var d="translate(-50%, -50%)";c.style.webkitTransform=d,c.style.mozTransform=d,c.style.msTransform=d,c.style.oTransform=d,c.style.transform=d,c._jsPlumb=this,a.visible===!1&&(c.style.display="none")}return this._jsPlumb.div},this.draw=function(a,b,d){var e=h(this);if(null!=e&&2===e.length){Line truncated
|
||||
return t("circle",{cx:this.w/2,cy:this.h/2,r:this.radius})},this.updateNode=function(a){s(a,{cx:this.w/2,cy:this.h/2,r:this.radius})}},c.extend(b.Endpoints.svg.Dot,[b.Endpoints.Dot,A]),b.Endpoints.svg.Rectangle=function(){b.Endpoints.Rectangle.apply(this,arguments),A.apply(this,arguments),this.makeNode=function(a){return t("rect",{width:this.w,height:this.h})},this.updateNode=function(a){s(a,{width:this.w,height:this.h})}},c.extend(b.Endpoints.svg.Rectangle,[b.Endpoints.Rectangle,A]),b.Endpoints.svg.Image=b.Endpoints.Image,b.Endpoints.svg.Blank=b.Endpoints.Blank,b.Overlays.svg.Label=b.Overlays.Label,b.Overlays.svg.Custom=b.Overlays.Custom;var B=function(a,c){a.apply(this,c),b.jsPlumbUIComponent.apply(this,c),this.isAppendedAtTopLevel=!1;this.path=null,this.paint=function(a,b){if(a.component.svg&&b){null==this.path&&(this.path=t("path",{"pointer-events":"all"}),a.component.svg.appendChild(this.path),this.elementCreated&&this.elementCreated(this.path,a.component),this.canvas=a.component.svg);var e=c&&1===c.length?c[0].cssClass||"":"",f=[0,0];b.xmin<0&&(f[0]=-b.xmin),b.ymin<0&&(f[1]=-b.ymin),s(this.path,{d:d(a.d),"class":e,stroke:a.stroke?a.stroke:null,fill:a.fill?a.fill:null,transform:"translate("+f[0]+","+f[1]+")"})}};var d=function(a){return isNaN(a.cxy.x)||isNaN(a.cxy.y)?"":"M"+a.hxy.x+","+a.hxy.y+" L"+a.tail[0].x+","+a.tail[0].y+" L"+a.cxy.x+","+a.cxy.y+" L"+a.tail[1].x+","+a.tail[1].y+" L"+a.hxy.x+","+a.hxy.y};this.transfer=function(a){a.canvas&&this.path&&this.path.parentNode&&(this.path.parentNode.removeChild(this.path),a.canvas.appendChild(this.path))}};c.extend(B,[b.jsPlumbUIComponent,b.Overlays.AbstractOverlay],{cleanup:function(a){null!=this.path&&(a?this._jsPlumb.instance.removeElement(this.path):this.path.parentNode&&this.path.parentNode.removeChild(this.path))},reattach:function(a,b){this.path&&b.canvas&&b.canvas.appendChild(this.path)},setVisible:function(a){null!=this.path&&(this.path.style.display=a?"block":"none")}}),b.Overlays.svg.Arrow=function(){B.apply(this,[b.Overlays.Arrow,arguments])},c.extend(b.Overlays.svg.Arrow,[b.Overlays.Arrow,B]),b.Overlays.svg.PlainArrow=function(){B.apply(this,[b.Overlays.PlainArrow,arguments])},c.extend(b.Overlays.svg.PlainArrow,[b.Overlays.PlainArrow,B]),b.Overlays.svg.Diamond=function(){B.apply(this,[b.Overlays.Diamond,arguments])},c.extend(b.Overlays.svg.Diamond,[b.Overlays.Diamond,B]),b.Overlays.svg.GuideLines=function(){var a,c,d=null,e=this;b.Overlays.GuideLines.apply(this,arguments),this.paint=function(b,g){null==d&&(d=t("path"),b.connector.svg.appendChild(d),e.attachListeners(d,b.connector),e.attachListeners(d,e),a=t("path"),b.connector.svg.appendChild(a),e.attachListeners(a,b.connector),e.attachListeners(a,e),c=t("path"),b.connector.svg.appendChild(c),e.attachListeners(c,b.connector),e.attachListeners(c,e));var h=[0,0];g.xmin<0&&(h[0]=-g.xmin),g.ymin<0&&(h[1]=-g.ymin),s(d,{d:f(b.head,b.tail),stroke:"red",fill:null,transform:"translate("+h[0]+","+h[1]+")"}),s(a,{d:f(b.tailLine[0],b.tailLine[1]),stroke:"blue",fill:null,transform:"translate("+h[0]+","+h[1]+")"}),s(c,{d:f(b.headLine[0],b.headLine[1]),stroke:"green",fill:null,transform:"translate("+h[0]+","+h[1]+")"})};var f=function(a,b){return"M "+a.x+","+a.y+" L"+b.x+","+b.y}},c.extend(b.Overlays.svg.GuideLines,b.Overlays.GuideLines)}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.jsPlumb,c=a.jsPlumbUtil,d=a.Katavorio,e=a.Biltong,f=function(b){var c=b._mottle;return c||(c=b._mottle=new a.Mottle),c},g=function(a,c){c=c||"main";var f="_katavorio_"+c,g=a[f],h=a.getEventManager();return g||(g=new d({bind:h.on,unbind:h.off,getSize:b.getSize,getConstrainingRectangle:function(a){return[a.parentNode.scrollWidth,a.parentNode.scrollHeight]},getPosition:function(b,c){var d=a.getOffset(b,c,b._katavorioDrag?b.offsetParent:null);return[d.left,d.top]},setPosition:function(a,b){a.style.left=b[0]+"px",a.style.top=b[1]+"px"},addClass:b.addClass,removeClass:b.removeClass,intersects:e.intersects,indexOf:function(a,b){return a.indexOf(b)},scope:a.getDefaultScope(),css:{noSelect:a.dragSelectClass,droppable:"jtk-droppable",draggable:"jtk-draggable",drag:"jtk-drag",selected:"jtk-drag-selected",active:"jtk-drag-active",hover:"jtk-drag-hover",ghostProxy:"jtk-ghost-proxy"}}),g.setZoom(a.getZoom()),a[f]=g,a.bind("zoom",g.setZoom)),g},h=function(a){var b=a.el._jsPlumbDragOptions,c=!0;return b.canDrag&&(c=b.canDrag()),c&&(this.setHoverSuspended(!0),this.select({source:a.el}).addClass(this.elementDraggingClass+" "+this.sourceElementDraggingClass,!0),this.select({target:a.el}).addClass(this.elementDraggingClass+" "+this.targetElementDraggingClass,!0),this.setConnectionBeingDragged(!0)),c},i=function(a){var b=this.getUIPosition(arguments,this.getZoom());if(null!=b){var c=a.el._jsPlumbDragOptions;this.draw(a.el,b,null,!0),c._dragging&&this.addClass(a.el,"jtk-dragged"),c._dragging=!0}},j=function(a){for(var b,c=a.selection,d=function(a){null!=a[1]&&(b=this.getUIPosition([{el:a[2].el,pos:[a[1].left,aLine truncated
|
||||
@@ -1,602 +0,0 @@
|
||||
/*
|
||||
Default styles for jsPlumb Toolkit
|
||||
|
||||
Copyright 2018 https://jsplumbtoolkit.com
|
||||
*/
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/* --- SURFACE WIDGET -------------------------------------------------------------------------- */
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
Assigned to every Node managed by an instance of the Toolkit. They are required to be positioned absolute, to
|
||||
enable dragging to work properly.
|
||||
*/
|
||||
.jtk-node {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
/*
|
||||
Assigned to every Group managed by an instance of the Toolkit. They are required to be positioned absolute, to
|
||||
enable dragging to work properly. We set overflow:visible on Group elements too, as a drag outside of the bounds
|
||||
is automatically reverted anyway, and without overflow:visible you cannot drag a node to some other element. You can
|
||||
also drag a node out of the element's viewport and if you drop it you can never get it back.
|
||||
*/
|
||||
.jtk-group {
|
||||
position: absolute;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
This is the attribute used to mark which part of a Group DOM element should contain the child Nodes. We mark it
|
||||
as having `position:relative` so that the absolute positioned Nodes are drawn correctly.
|
||||
*/
|
||||
[jtk-group-content] {
|
||||
position:relative;
|
||||
}
|
||||
|
||||
/*
|
||||
This style was created in response to this Chrome bug:
|
||||
http://stackoverflow.com/questions/13758215/artifacts-when-css-scaled-in-chrome
|
||||
|
||||
Basically it's about how sometimes there can be artefacts left on screen when the user drags an element. It seems
|
||||
the issue has been fixed in more recent versions of Chrome, but the style is left here in case you come across
|
||||
the problem.
|
||||
*/
|
||||
.jtk-node.jtk-drag {
|
||||
/*-webkit-backface-visibility: hidden;*/
|
||||
}
|
||||
|
||||
/*
|
||||
Suppresses the pointer events on an element that was created by Katavorio in response to a drag in which the element
|
||||
should first be cloned. Having this clone ignore pointer events means there is less chance that any other
|
||||
mouse activity (such as click) on the original element will not be consumed by katavorio.
|
||||
*/
|
||||
.katavorio-clone-drag {
|
||||
pointer-events:none;
|
||||
}
|
||||
|
||||
/*
|
||||
Assigned to an element that is the `Container` in a `render` call.
|
||||
Elements that are acting as Surface widgets should have overflow:hidden set to prevent libs from
|
||||
scrolling them during drag (we don't want scrollbars; we have an infinite canvas). Position is set to
|
||||
`relative` as this is the parent for nodes, which are positioned absolute (and for absolute positioning
|
||||
to work, you need to ensure the parent node has `position:relative`). This style also sets some default
|
||||
values for the cursor - using a `grab` cursor where supported.
|
||||
*/
|
||||
.jtk-surface {
|
||||
overflow: hidden !important;
|
||||
position: relative;
|
||||
cursor: move;
|
||||
cursor: -moz-grab;
|
||||
cursor: -webkit-grab;
|
||||
|
||||
/*
|
||||
For IE10+. As discussed on this page:
|
||||
|
||||
https://msdn.microsoft.com/en-us/library/ie/jj583807(v=vs.85).aspx
|
||||
|
||||
Microsoft have very helpfully implemented default behaviours for a bunch of touch events and
|
||||
then consumed the events so you don't have to be bothered by them. They've "done a lot of research"
|
||||
about this stuff and put together a really great default experience for everyone in the entire world.
|
||||
*/
|
||||
touch-action:none;
|
||||
|
||||
/*
|
||||
Another Chrome issue that appears to have been fixed in later versions
|
||||
http://stackoverflow.com/questions/15464055/css-transition-effect-makes-image-blurry-moves-image-1px-in-chrome
|
||||
*/
|
||||
/*
|
||||
-webkit-backface-visibility: hidden;
|
||||
-webkit-transform: translateZ(0) scale(1.0, 1.0);
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
Assigned to the surface when it is being panned. The default is to change the cursor (in browsers that support
|
||||
a `grabbing` cursor), and to disable text selection.
|
||||
*/
|
||||
.jtk-surface-panning {
|
||||
cursor: -moz-grabbing;
|
||||
cursor: -webkit-grabbing;
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
/*
|
||||
The work area in a surface renderer.
|
||||
*/
|
||||
.jtk-surface-canvas {
|
||||
overflow: visible !important;
|
||||
}
|
||||
|
||||
/*
|
||||
For IE10+. Discussed above in the .jtk-surface styles. This one is specific to elements that are configured
|
||||
to be droppable on a Surface via its `registerDroppableNodes` method.
|
||||
*/
|
||||
.jtk-surface-droppable-node {
|
||||
touch-action:none;
|
||||
}
|
||||
|
||||
/*
|
||||
Assigned to a Surface widget when panning is disabled (and therefore the app is relying on scrollbars when the content overflows).
|
||||
*/
|
||||
.jtk-surface-nopan {
|
||||
overflow: scroll !important;
|
||||
cursor:default;
|
||||
}
|
||||
|
||||
/*
|
||||
Assigned to tile images in a tiled background
|
||||
*/
|
||||
.jtk-surface-tile {
|
||||
border:none;
|
||||
outline:none;
|
||||
margin:0;
|
||||
-webkit-transition: opacity .3s ease .15s;
|
||||
-moz-transition: opacity .3s ease .15s;
|
||||
-o-transition: opacity .3s ease .15s;
|
||||
-ms-transition: opacity .3s ease .15s;
|
||||
transition: opacity .3s ease .15s;
|
||||
}
|
||||
|
||||
/*
|
||||
Assigned to the element used for node select with the mouse ("lasso").
|
||||
*/
|
||||
.jtk-lasso {
|
||||
border: 2px solid rgb(49, 119, 184);
|
||||
background-color: WhiteSmoke;
|
||||
opacity: 0.5;
|
||||
display: none;
|
||||
z-index: 20000;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
/*
|
||||
This class is added to the document body on lasso drag start and removed at the end of lasso dragging. Its purpose
|
||||
is to switch off text selection on all elements while the user is dragging the lasso.
|
||||
*/
|
||||
.jtk-lasso-select-defeat * {
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
/**
|
||||
Added to the lasso mask when it is operating in 'inverted' mode, ie. the excluded parts of the UI are covered, rather
|
||||
than the normal mode in which the selected parts of the UI are covered.
|
||||
*/
|
||||
.jtk-lasso-mask {
|
||||
position:fixed;
|
||||
z-index:20000;
|
||||
display:none;
|
||||
opacity:0.5;
|
||||
background-color: #07234E;
|
||||
top:0;
|
||||
bottom:0;
|
||||
left:0;
|
||||
right:0;
|
||||
}
|
||||
|
||||
/*
|
||||
Assigned to some element that has been selected (either via lasso or programmatically).
|
||||
*/
|
||||
.jtk-surface-selected-element {
|
||||
border: 2px dashed #f76258 !important;
|
||||
}
|
||||
|
||||
/*
|
||||
Assigned to all pan buttons in a surface widget.
|
||||
*/
|
||||
.jtk-surface-pan {
|
||||
background-color: Azure;
|
||||
opacity: 0.4;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
z-index: 2;
|
||||
-webkit-transition: background-color 0.15s ease-in;
|
||||
-moz-transition: background-color 0.15s ease-in;
|
||||
-o-transition: background-color 0.15s ease-in;
|
||||
transition: background-color 0.15s ease-in;
|
||||
}
|
||||
|
||||
/*
|
||||
Specific styles for the top and bottom pan buttons.
|
||||
Top/bottom are 100% width and 20px high by default
|
||||
*/
|
||||
.jtk-surface-pan-top, .jtk-surface-pan-bottom {
|
||||
width: 100%;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
/*
|
||||
Hover styles for all pan buttons.
|
||||
On hover, change color, background color, font weight and opacity.
|
||||
*/
|
||||
.jtk-surface-pan-top:hover, .jtk-surface-pan-bottom:hover, .jtk-surface-pan-left:hover, .jtk-surface-pan-right:hover {
|
||||
opacity: 0.6;
|
||||
background-color: rgb(49, 119, 184);
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/*
|
||||
Specific styles for the left and right pan buttons.
|
||||
Left/right pan buttons are 100% height and 20px wide
|
||||
*/
|
||||
.jtk-surface-pan-left, .jtk-surface-pan-right {
|
||||
width: 20px;
|
||||
height: 100%;
|
||||
line-height: 40;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Assigned to a pan button when the user is pressing it.
|
||||
*/
|
||||
.jtk-surface-pan-active, .jtk-surface-pan-active:hover {
|
||||
background-color: #f76258;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/* --- MINIVIEW WIDGET ------------------------------------------------------------------------- */
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
Assigned to an element that is acting as a Miniview.
|
||||
As with Surface, Miniview elements should have overflow:hidden set to prevent
|
||||
libs from scrolling them during drag. This style also provides a default width/height for a miniview,
|
||||
which you may wish to override.
|
||||
*/
|
||||
.jtk-miniview {
|
||||
overflow: hidden !important;
|
||||
width: 125px;
|
||||
height: 125px;
|
||||
position: relative;
|
||||
background-color: #B2C9CD;
|
||||
border: 1px solid #E2E6CD;
|
||||
border-radius: 4px;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
/*
|
||||
Assigned to the element that shows the size of the related viewport in a Miniview widget, and which can be dragged to
|
||||
move the surface.
|
||||
*/
|
||||
.jtk-miniview-panner {
|
||||
border: 5px dotted WhiteSmoke;
|
||||
opacity: 0.4;
|
||||
background-color: rgb(79, 111, 126);
|
||||
cursor: move;
|
||||
cursor: -moz-grab;
|
||||
cursor: -webkit-grab;
|
||||
}
|
||||
|
||||
/*
|
||||
Assigned to the miniview's panner when it is being dragged.
|
||||
*/
|
||||
.jtk-miniview-panning {
|
||||
cursor: -moz-grabbing;
|
||||
cursor: -webkit-grabbing;
|
||||
}
|
||||
|
||||
/*
|
||||
Added to all elements displayed in a miniview.
|
||||
*/
|
||||
.jtk-miniview-element {
|
||||
background-color: rgb(96, 122, 134);
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
/*
|
||||
Added to Group elements displayed in a miniview
|
||||
*/
|
||||
.jtk-miniview-group-element {
|
||||
background: transparent;
|
||||
border: 2px solid rgb(96,122,134);
|
||||
}
|
||||
|
||||
/*
|
||||
Assigned to the collapse/expand miniview button
|
||||
*/
|
||||
.jtk-miniview-collapse {
|
||||
color: whiteSmoke;
|
||||
position: absolute;
|
||||
font-size: 18px;
|
||||
top: -1px;
|
||||
right: 3px;
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/*
|
||||
The '-' symbol when the miniview is expanded
|
||||
*/
|
||||
.jtk-miniview-collapse:before {
|
||||
content: "\2012";
|
||||
}
|
||||
|
||||
/*
|
||||
Assigned to the miniview element when it is collapsed.
|
||||
*/
|
||||
.jtk-miniview-collapsed {
|
||||
background-color: #449ea6;
|
||||
border-radius: 4px;
|
||||
height: 22px;
|
||||
margin-right: 0;
|
||||
padding: 4px;
|
||||
width: 21px;
|
||||
}
|
||||
|
||||
/*
|
||||
Hide all children of the miniview (except the expand button) when it is collapsed so you don't see anything
|
||||
poking through under the + icon.
|
||||
*/
|
||||
.jtk-miniview-collapsed .jtk-miniview-element, .jtk-miniview-collapsed .jtk-miniview-panner {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
/*
|
||||
The '+' symbol when the miniview is collapsed.
|
||||
*/
|
||||
.jtk-miniview-collapsed .jtk-miniview-collapse:before {
|
||||
content: "+";
|
||||
}
|
||||
|
||||
/*
|
||||
Hover state for the collapse/expand icon.
|
||||
*/
|
||||
.jtk-miniview-collapse:hover {
|
||||
color: #E4F013;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------------------- */
|
||||
/* --- DIALOGS --------------------------------------------------------------------------------*/
|
||||
/* ------------------------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
This is the element that acts as the dialog underlay - the modal "mask". Note the high z-index default
|
||||
set here (and note also the overlay style below has a z-index with a value higher by one).
|
||||
*/
|
||||
.jtk-dialog-underlay {
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
position: fixed;
|
||||
z-index: 100000;
|
||||
opacity: 0.8;
|
||||
background-color: #CCC;
|
||||
display: none;
|
||||
}
|
||||
|
||||
/*
|
||||
This is the element that acts as the parent for dialog content.
|
||||
*/
|
||||
.jtk-dialog-overlay {
|
||||
position: fixed;
|
||||
z-index: 100001;
|
||||
display: none;
|
||||
background-color: white;
|
||||
font-family: "Open Sans", sans-serif;
|
||||
padding: 7px;
|
||||
box-shadow: 0 0 5px gray;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.jtk-dialog-overlay-x {
|
||||
max-height:0;
|
||||
transition: max-height 0.5s ease-in;
|
||||
-moz-transition: max-height 0.5s ease-in;
|
||||
-ms-transition: max-height 0.5s ease-in;
|
||||
-o-transition: max-height 0.5s ease-in;
|
||||
-webkit-transition: max-height 0.5s ease-in;
|
||||
}
|
||||
|
||||
.jtk-dialog-overlay-y {
|
||||
max-width:0;
|
||||
transition: max-width 0.5s ease-in;
|
||||
-moz-transition: max-width 0.5s ease-in;
|
||||
-ms-transition: max-width 0.5s ease-in;
|
||||
-o-transition: max-width 0.5s ease-in;
|
||||
-webkit-transition: max-width 0.5s ease-in;
|
||||
}
|
||||
|
||||
.jtk-dialog-overlay-top {
|
||||
top:20px;
|
||||
}
|
||||
|
||||
.jtk-dialog-overlay-bottom {
|
||||
bottom:20px;
|
||||
}
|
||||
|
||||
.jtk-dialog-overlay-left {
|
||||
left:20px;
|
||||
}
|
||||
|
||||
.jtk-dialog-overlay-right {
|
||||
right:20px;
|
||||
}
|
||||
|
||||
.jtk-dialog-overlay-x.jtk-dialog-overlay-visible {
|
||||
max-height:1000px;
|
||||
}
|
||||
|
||||
.jtk-dialog-overlay-y.jtk-dialog-overlay-visible {
|
||||
max-width:1000px;
|
||||
}
|
||||
|
||||
/*
|
||||
The element containing buttons in a dialog.
|
||||
*/
|
||||
.jtk-dialog-buttons {
|
||||
text-align: right;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
/*
|
||||
An individual button in a dialog.
|
||||
*/
|
||||
.jtk-dialog-button {
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
margin-right: 5px;
|
||||
min-width: 56px;
|
||||
background-color: white;
|
||||
outline: 1px solid #ccc;
|
||||
}
|
||||
|
||||
/*
|
||||
Hover style for an individual button in a dialog.
|
||||
*/
|
||||
.jtk-dialog-button:hover {
|
||||
color: white;
|
||||
background-color: #234b5e;
|
||||
}
|
||||
|
||||
/*
|
||||
The titlebar of a dialog.
|
||||
*/
|
||||
.jtk-dialog-title {
|
||||
text-align: left;
|
||||
font-size: 14px;
|
||||
margin-bottom: 9px;
|
||||
}
|
||||
|
||||
.jtk-dialog-content {
|
||||
font-size:12px;
|
||||
text-align:left;
|
||||
min-width:250px;
|
||||
margin: 0 14px;
|
||||
}
|
||||
|
||||
.jtk-dialog-content ul {
|
||||
width:100%;
|
||||
padding-left:0;
|
||||
}
|
||||
|
||||
.jtk-dialog-content label {
|
||||
cursor: pointer;
|
||||
font-weight: inherit;
|
||||
}
|
||||
|
||||
.jtk-dialog-overlay input, .jtk-dialog-overlay textarea {
|
||||
background-color: #FFF;
|
||||
border: 1px solid #CCC;
|
||||
color: #333;
|
||||
font-size: 14px;
|
||||
font-style: normal;
|
||||
outline: none;
|
||||
padding: 6px 4px;
|
||||
margin-right: 6px;
|
||||
}
|
||||
|
||||
.jtk-dialog-overlay input:focus, .jtk-dialog-overlay textarea:focus {
|
||||
background-color: #cbeae1;
|
||||
border: 1px solid #83b8a8;
|
||||
color: #333;
|
||||
font-size: 14px;
|
||||
font-style: normal;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------------------------- */
|
||||
/* --- DRAWING TOOLS -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
Assigned to the element that is drawn around some other element when a drawing operation is taking place.
|
||||
*/
|
||||
.jtk-draw-skeleton {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
outline: 2px solid #84acb3;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
/*
|
||||
Assigned to every handle (top left, top right, bottom left, bottom right, center) in a draw skeleton.
|
||||
*/
|
||||
.jtk-draw-handle {
|
||||
position: absolute;
|
||||
width: 7px;
|
||||
height: 7px;
|
||||
background-color: #84acb3;
|
||||
}
|
||||
|
||||
/*
|
||||
Assigned to the top left handle in a draw skeleton
|
||||
*/
|
||||
.jtk-draw-handle-tl {
|
||||
left: 0;
|
||||
top: 0;
|
||||
cursor: nw-resize;
|
||||
}
|
||||
|
||||
/*
|
||||
Assigned to the top right handle in a draw skeleton
|
||||
*/
|
||||
.jtk-draw-handle-tr {
|
||||
right: 0;
|
||||
top: 0;
|
||||
cursor: ne-resize;
|
||||
}
|
||||
|
||||
/*
|
||||
Assigned to the bottom left handle in a draw skeleton
|
||||
*/
|
||||
.jtk-draw-handle-bl {
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
cursor: sw-resize;
|
||||
}
|
||||
|
||||
/*
|
||||
Assigned to the bottom right handle in a draw skeleton
|
||||
*/
|
||||
.jtk-draw-handle-br {
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
cursor: se-resize;
|
||||
}
|
||||
|
||||
/*
|
||||
Assigned to the center handle in a draw skeleton (the handle by which the element may be dragged). This is
|
||||
not visible by defaut; enable if you need it.
|
||||
*/
|
||||
.jtk-draw-drag {
|
||||
display:none;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
margin-left: -10px;
|
||||
margin-top: -10px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
background-color: #84acb3;
|
||||
cursor: move;
|
||||
}
|
||||
|
||||
/*
|
||||
This class is added to the document body on drag resize start and removed at the end of resizing. Its purpose
|
||||
is to switch off text selection on all elements while the user is resizing an element.
|
||||
*/
|
||||
.jtk-drag-select-defeat * {
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
<p align="center">
|
||||
<a href="http://logic-flow.org" target="_blank">
|
||||
<img
|
||||
src="http://logic-flow.org/new-logo.png"
|
||||
alt="LogicFlow logo"
|
||||
width="250"
|
||||
/>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://www.npmjs.com/package/@logicflow/core">
|
||||
<img src="https://img.shields.io/npm/v/@logicflow/core" alt="Version">
|
||||
</a>
|
||||
<a href="https://www.npmjs.com/package/@logicflow/core">
|
||||
<img src="https://img.shields.io/npm/dm/@logicflow/core" alt="Download">
|
||||
</a>
|
||||
<a href="https://github.com/didi/LogicFlow/blob/master/LICENSE">
|
||||
<img src="https://img.shields.io/npm/l/@logicflow/core" alt="LICENSE">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
LogicFlow 是一款流程图编辑框架,提供了一系列流程图交互、编辑所必需的功能和简单灵活的节点自定义、插件等拓展机制,方便我们快速在业务系统内满足类流程图的需求。
|
||||
|
||||
## 特性
|
||||
|
||||
|
||||
- 🛠 高拓展性
|
||||
|
||||
兼容各种产品自定义的流程编辑需求,绝大部分模块以插件的形式实现,支持各模块自由插拔。
|
||||
|
||||
- 🚀 重执行
|
||||
|
||||
流程图能完备的表达业务逻辑,不受流程引擎限制。
|
||||
|
||||
- 🎯 专业
|
||||
|
||||
专注于业务流程图编辑的框架
|
||||
|
||||
## 使用
|
||||
|
||||
### 安装
|
||||
|
||||
```sh
|
||||
# npm
|
||||
$ npm install @logicflow/core --save
|
||||
|
||||
|
||||
# yarn
|
||||
$ yarn add @logicflow/core
|
||||
```
|
||||
|
||||
### 代码示例
|
||||
|
||||
```js
|
||||
// 创建容器
|
||||
<div id="container"></div>;
|
||||
|
||||
// 准备数据
|
||||
const data = {
|
||||
// 节点
|
||||
nodes: [
|
||||
{
|
||||
id: 21,
|
||||
type: 'rect',
|
||||
x: 100,
|
||||
y: 200,
|
||||
text: {
|
||||
value: '矩形节点',
|
||||
x: 100,
|
||||
y: 200,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 50,
|
||||
type: 'circle',
|
||||
x: 300,
|
||||
y: 400,
|
||||
text: {
|
||||
value: '圆形节点',
|
||||
x: 300,
|
||||
y: 400,
|
||||
},
|
||||
},
|
||||
],
|
||||
// 边
|
||||
edges: [
|
||||
{
|
||||
type: 'polyline',
|
||||
sourceNodeId: 50,
|
||||
targetNodeId: 21,
|
||||
},
|
||||
],
|
||||
};
|
||||
// 渲染画布
|
||||
const lf = new LogicFlow({
|
||||
container: document.querySelector('#container'),
|
||||
width: 700,
|
||||
height: 600,
|
||||
});
|
||||
|
||||
lf.render(data);
|
||||
```
|
||||
|
||||
## 文档
|
||||
|
||||
[官方文档](http://logic-flow.org)
|
||||
|
||||
- [快速上手](http://logic-flow.org/guide/start.html#安装)
|
||||
- [基础教程](http://logic-flow.org/guide/basic/logic-flow.html)
|
||||
- [进阶指南](http://logic-flow.org/guide/advance/theme.html)
|
||||
- [拓展](http://logic-flow.org/guide/extension/extension-components.html)
|
||||
- [示例](http://logic-flow.org/usage/bpmn.html)
|
||||
|
||||
## 核心能力
|
||||
|
||||
### 流程图编辑器快速搭建
|
||||
|
||||
提供了一个流程图编辑所必需的各项能力,这也是 LogicFlow 的基础能力:
|
||||
|
||||
- 图的绘制能力。基于 SVG 来绘制形状各异的节点和线,并提供了基础的节点(矩形、圆形、多边形等)和线(直线、折线、曲线)
|
||||
- 各类交互能力,让图动起来。根据节点、线、图的各类鼠标事件(hover、点击、拖拽等)做出反应。比如节点拖拽、拖拽创建边、线的调整、双击节点编辑文本等
|
||||
- 提升编辑效率的能力。提供网格、对齐线,上一步、下一步,键盘快捷键,图放大缩小等配套能力,帮助用户提升编辑效率
|
||||
- 提供了丰富的 API ,宿主研发通过 API 传参调用和监听事件的方式,与 LogicFlow 完成交互
|
||||
|
||||
下面是通过 LogicFlow 内置的节点和配套能力,做的流程图示例
|
||||
:
|
||||
|
||||
<image src="https://dpubstatic.udache.com/static/dpubimg/eEMT14E7BR/lfexample1.gif" width="500"/>
|
||||
|
||||
### 基于业务场景拓展
|
||||
|
||||
当基础能力无法满足业务需求的时候,便需要基于业务场景拓展。
|
||||
|
||||
- 设置图上所有元素的样式,比如各种节点、线、锚点、箭头、对齐线的大小颜色等,满足对前端样式调整的需求
|
||||
- API 拓展。支持在 LogicFlow 上注册自定义的方法,比如通过 API 拓展提供图片下载的方法
|
||||
- 自定义节点、线。内置的矩形、圆形等图形类节点往往无法满足实际的业务需求,需要定义具有业务意义的节点。LogicFlow 提供了 的方式让用户定制具有自定义图形、业务数据的节点,比如流程审批场景中的 “审批” 节点
|
||||
- 拓展组件。LogicFlow 在 SVG 图层上提供了 HTML 层和一系列坐标转换逻辑,并支持在 HTML 层注册组件。宿主研发可以通过 LogicFlow 的 API,基于任何 View 框架开发组件,比如节点的右键菜单、控制面板等
|
||||
- 数据转换 adapter。LogicFlow 默认导出的图数据不一定适合所有业务,此时可以通过 adapter API,在图数据从 LogicFlow 输入、输出的时候做自定义转换,比如转换成 BPMN 规范的图数据
|
||||
- 内置部分拓展能力。基于上述拓展能力,我们还单独提供了 extension 的包,用来存放当前业务下沉淀出的具有通用性的节点、组件等,比如面向 BPMN 规范的节点和数据 adapter,默认菜单。注意 extension 可以单独安装,并支持按需引入
|
||||
|
||||
基于上述拓展的能力,前端研发能够根据实际业务场景的需求,灵活的开发出所需的节点、组件等。下面有两个基于 LogicFlow 拓展能力做出的流程图:
|
||||
|
||||
#### BPMN 规范
|
||||
|
||||

|
||||
|
||||
#### 审批流
|
||||
|
||||

|
||||
|
||||
#### vue 应用 demo
|
||||
|
||||
[代码地址](https://github.com/xinxin93/logicflow_vue_demo)
|
||||
|
||||

|
||||
|
||||
|
||||
#### vue3 node-red风格示例
|
||||
|
||||
[Logic-Flow/logicflow-node-red-vue3](https://github.com/Logic-Flow/logicflow-node-red-vue3)
|
||||
|
||||

|
||||
|
||||
## 联系我们
|
||||
|
||||
### 加入微信群
|
||||
|
||||
添加微信号:logic-flow 加入用户群
|
||||
|
||||
### 加入 QQ 群
|
||||
|
||||
<image src="https://dpubstatic.udache.com/static/dpubimg/VMBzV7jhh8/qq.png" width="300"/>
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r=e();for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(window,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=215)}([function(t,e,r){"use strict";(function(t,n){r.d(e,"a",(function(){return w})),r.d(e,"b",(function(){return er})),r.d(e,"c",(function(){return Ft})),r.d(e,"d",(function(){return jt})),r.d(e,"e",(function(){return yt})),r.d(e,"f",(function(){return dt})),r.d(e,"g",(function(){return _t})),r.d(e,"h",(function(){return yr})),r.d(e,"i",(function(){return at})),r.d(e,"j",(function(){return wt})),r.d(e,"k",(function(){return Qt})),r.d(e,"l",(function(){return ne})),r.d(e,"m",(function(){return rt})),r.d(e,"n",(function(){return se})),r.d(e,"o",(function(){return E})),r.d(e,"p",(function(){return Se})),r.d(e,"q",(function(){return le})),r.d(e,"r",(function(){return ge})),r.d(e,"s",(function(){return dr})),r.d(e,"t",(function(){return de})),r.d(e,"u",(function(){return ee})),r.d(e,"v",(function(){return Oe})),r.d(e,"w",(function(){return we})),r.d(e,"x",(function(){return je})),r.d(e,"y",(function(){return Je})),r.d(e,"z",(function(){return rr})),r.d(e,"A",(function(){return pr})),r.d(e,"B",(function(){return Ee})),r.d(e,"C",(function(){return Z})),r.d(e,"D",(function(){return Pe})),r.d(e,"E",(function(){return ue})),r.d(e,"F",(function(){return ae})),r.d(e,"G",(function(){return te})),r.d(e,"H",(function(){return $t})),r.d(e,"I",(function(){return De})),r.d(e,"J",(function(){return Me})),r.d(e,"K",(function(){return lt})),r.d(e,"L",(function(){return xe})),r.d(e,"M",(function(){return Ne}));var o=[];Object.freeze(o);var i={};function a(){return++Rt.mobxGuid}function u(t){throw c(!1,t),"X"}function c(t,e){if(!t)throw new Error("[mobx] "+(e||"An invariant failed, however the error is obfuscated because this is a production build."))}Object.freeze(i);function s(t){var e=!1;return function(){if(!e)return e=!0,t.apply(this,arguments)}}var l=function(){};function f(t){return null!==t&&"object"==typeof t}function p(t){if(null===t||"object"!=typeof t)return!1;var e=Object.getPrototypeOf(t);return e===Object.prototype||null===e}function d(t,e,r){Object.defineProperty(t,e,{enumerable:!1,writable:!0,configurable:!0,value:r})}function y(t,e){var r="isMobX"+t;return e.prototype[r]=!0,function(t){return f(t)&&!0===t[r]}}function h(t){return t instanceof Map}function v(t){return t instanceof Set}function g(t){var e=new Set;for(var r in t)e.add(r);return Object.getOwnPropertySymbols(t).forEach((function(r){Object.getOwnPropertyDescriptor(t,r).enumerable&&e.add(r)})),Array.from(e)}function b(t){return t&&t.toString?t.toString():new String(t).toString()}function m(t){return null===t?null:"object"==typeof t?""+t:t}var O="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Object.getOwnPropertyNames,w=Symbol("mobx administration"),_=function(){function t(t){void 0===t&&(t="Atom@"+a()),this.name=t,this.isPendingUnobservation=!1,this.isBeingObserved=!1,this.observers=new Set,this.diffValue=0,this.lastAccessedBy=0,this.lowestObserverState=J.NOT_TRACKING}return t.prototype.onBecomeObserved=function(){this.onBecomeObservedListeners&&this.onBecomeObservedListeners.forEach((function(t){return t()}))},t.prototype.onBecomeUnobserved=function(){this.onBecomeUnobservedListeners&&this.onBecomeUnobservedListeners.forEach((function(t){return t()}))},t.prototype.reportObserved=function(){return Xt(this)},t.prototype.reportChanged=function(){Bt(),function(t){if(t.lowestObserverState===J.STALE)return;t.lowestObserverState=J.STALE,t.observers.forEach((function(e){e.dependenciesState===J.UP_TO_DATE&&(e.isTracing!==Q.NONE&&Ut(e,t),e.onBecomeStale()),e.dependenciesState=J.STALE}))}(this),Ht()},t.prototype.toString=function(){return this.name},t}(),j=y("Atom",_);function E(t,e,r){void 0===e&&(e=l),void 0===r&&(r=l);var n,o=new _(t);return e!==l&&ce("onBecomeObserved",o,e,n),r!==l&&ue(Line truncated
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */var P=function(){return(P=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function k(t){var e="function"==typeof Symbol&&t[Symbol.iterator],r=0;return e?e.call(t):{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}}}function A(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function D(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(A(arguments[e]));return t}var T=Symbol("mobx did run lazy initializers"),M=Symbol("mobx pending decorators"),N={},C={};function R(t,e){var r=e?N:C;return r[t]||(r[t]={configurable:!0,enumerable:e,get:function(){return I(this),this[t]},set:function(e){I(this),this[t]=e}})}function I(t){var e,r;if(!0!==t[T]){var n=t[M];if(n){d(t,T,!0);var o=D(Object.getOwnPropertySymbols(n),Object.keys(n));try{for(var i=k(o),a=i.next();!a.done;a=i.next()){var u=n[a.value];u.propertyCreator(t,u.prop,u.descriptor,u.decoratorTarget,u.decoratorArguments)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}}}}function L(t,e){return function(){var r,n=function(n,o,i,a){if(!0===a)return e(n,o,i,n,r),null;if(!Object.prototype.hasOwnProperty.call(n,M)){var u=n[M];d(n,M,P({},u))}return n[M][o]={prop:o,propertyCreator:e,descriptor:i,decoratorTarget:n,decoratorArguments:r},R(o,t)};return z(arguments)?(r=o,n.apply(null,arguments)):(r=Array.prototype.slice.call(arguments),n)}}function z(t){return(2===t.length||3===t.length)&&("string"==typeof t[1]||"symbol"==typeof t[1])||4===t.length&&!0===t[3]}function B(t,e,r){return je(t)?t:Array.isArray(t)?Z.array(t,{name:r}):p(t)?Z.object(t,void 0,{name:r}):h(t)?Z.map(t,{name:r}):v(t)?Z.set(t,{name:r}):t}function H(t){return t}function X(e){c(e);var r=L(!0,(function(t,r,n,o,i){var a=n?n.initializer?n.initializer.call(t):n.value:void 0;ur(t).addObservableProp(r,a,e)})),n=(void 0!==t&&t.env,r);return n.enhancer=e,n}var U={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};function F(t){return null==t?U:"string"==typeof t?{name:t,deep:!0,proxy:!0}:t}Object.freeze(U);var G=X(B),Y=X((function(t,e,r){return null==t||pr(t)||Je(t)||rr(t)||ir(t)?t:Array.isArray(t)?Z.array(t,{name:r,deep:!1}):p(t)?Z.object(t,void 0,{name:r,deep:!1}):h(t)?Z.map(t,{name:r,deep:!1}):v(t)?Z.set(t,{name:r,deep:!1}):u(!1)})),V=X(H),W=X((function(t,e,r){return vr(t,e)?e:t}));function K(t){return t.defaultDecorator?t.defaultDecorator.enhancer:!1===t.deep?H:B}var $={box:function(t,e){arguments.length>2&&q("box");var r=F(e);return new St(t,K(r),r.name,!0,r.equals)},array:function(t,e){arguments.length>2&&q("array");var r=F(e);return We(t,K(r),r.name)},map:function(t,e){arguments.length>2&&q("map");var r=F(e);return new er(t,K(r),r.name)},set:function(t,e){arguments.length>2&&q("set");var r=F(e);return new or(t,K(r),r.name)},object:function(t,e,r){"string"==typeof arguments[1]&&q("object");var n=F(r);if(!1===n.proxy)return le({},t,e,n);var o=fe(n),i=le({},void 0,void 0,n),a=Be(i);return pe(a,t,e,o),a},ref:V,shallow:Y,deep:G,struct:W},Z=function(t,e,r){if("string"==typeof arguments[1]||"symbol"==typeof arguments[1])return G.apply(null,arguments);if(je(t))return t;var n=p(t)?Z.object(t,e,r):Array.isArray(t)?Z.array(t,e):h(t)?Z.map(t,e):v(t)?Z.set(t,e):t;if(n!==t)return n;u(!1)};function q(t){u("Expected one or two arguments to observable."+t+". Did you accidentally try to use observable."+t+" as decorator?")}Object.keys($).forEach((function(t){return Z[t]=$[t]}));var J,Q,tt=L(!1,(function(t,e,r,n,o){var i=r.get,a=r.set,u=o[0]||{};ur(t).addComputedProp(t,e,P({get:i,set:a,context:t},u))})),et=tt({equals:x.structural}),rt=function(t,e,r){if("string"==typeof e)return tt.apply(null,arguments);if(null!==t&&"object"==typeof t&&1===arguments.length)return tt.apply(null,arguments);var n="object"==typeof e?e:{};return n.get=t,n.set="function"==typeof e?e:n.set,n.name=n.name||t.name||"",new kt(n)};rt.struct=et,function(t){t[t.NOT_TRACKING=-1]="NOT_TRACKING",t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.POSSIBLY_STALE=1]="POSSIBLY_STALE",t[t.STALE=2]="STALE"}(J||(J={})),function(t){t[t.NONE=0]="NONE",t[t.LOG=1]="LOG",t[t.BREAK=2]="BREAK"}(Q||(Q={}));var nt=function(t){this.cause=t};function ot(t){return t instanceof nt}function it(t){switch(t.dependenciesState){case J.UP_TO_DATE:return!1;case J.NOT_TRACKING:case J.STALE:return!0;case J.POSSIBLY_STALE:for(var e=dt(!0),r=ft(),n=t.observing,o=n.length,i=0;i<o;i++){var a=n[i];if(At(a)){if(Rt.disableErrorBoundaries)a.get();else try{a.get()}catch(t){return pt(r),yt(e),!0}if(t.dependenciesState===J.STALE)return pt(r),yt(e),!0}}return ht(t),pt(r),yt(e),!1}}function at(){return null!Line truncated
|
||||
+195
@@ -0,0 +1,195 @@
|
||||
.lf-graph {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 0;
|
||||
background: #ffffff;
|
||||
user-select: none;
|
||||
}
|
||||
.lf-element-text {
|
||||
cursor: text;
|
||||
}
|
||||
.lf-text-disabled {
|
||||
pointer-events: none;
|
||||
}
|
||||
.lf-text-draggable {
|
||||
cursor: move;
|
||||
}
|
||||
.lf-node-anchor {
|
||||
cursor: crosshair;
|
||||
}
|
||||
.lf-node-anchor-hover {
|
||||
visibility: hidden;
|
||||
}
|
||||
.lf-anchor:hover .lf-node-anchor-hover {
|
||||
visibility: visible;
|
||||
}
|
||||
.lf-edge.pointer-none {
|
||||
pointer-events: none;
|
||||
}
|
||||
.lf-edge-append {
|
||||
cursor: pointer;
|
||||
}
|
||||
.lf-edge-animation {
|
||||
stroke-dashoffset: 100%;
|
||||
animation: dash 5s linear infinite;
|
||||
}
|
||||
@keyframes dash {
|
||||
to {
|
||||
stroke-dashoffset: 0;
|
||||
}
|
||||
}
|
||||
/* node */
|
||||
.lf-node-not-allow {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.lf-polyline-append-ns-resize {
|
||||
cursor: ns-resize;
|
||||
}
|
||||
.lf-polyline-append-ew-resize {
|
||||
cursor: ew-resize;
|
||||
}
|
||||
.lf-dragging {
|
||||
cursor: grabbing;
|
||||
}
|
||||
.lf-drag-able {
|
||||
cursor: default;
|
||||
}
|
||||
.lf-bezier-adjust-anchor {
|
||||
cursor: pointer;
|
||||
}
|
||||
/* background */
|
||||
.lf-background,
|
||||
.lf-grid {
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: -1;
|
||||
}
|
||||
.lf-background-area {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
/* html-overlay */
|
||||
.lf-html-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 1;
|
||||
pointer-events: none;
|
||||
overflow: hidden;
|
||||
user-select: none;
|
||||
}
|
||||
.lf-html-overlay__transform > * {
|
||||
pointer-events: all;
|
||||
}
|
||||
|
||||
.lf-text-editable {
|
||||
pointer-events: all;
|
||||
}
|
||||
.lf-text-input {
|
||||
text-align: center;
|
||||
outline: none;
|
||||
position: absolute;
|
||||
border: 1px solid #edefed;
|
||||
box-sizing: border-box;
|
||||
line-height: 1.2;
|
||||
border-radius: 3px;
|
||||
resize: none;
|
||||
padding: 5px;
|
||||
min-height: 20px;
|
||||
min-width: 100px;
|
||||
white-space: pre;
|
||||
background: #fff;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
.lf-get-text-height {
|
||||
display: inline-block;
|
||||
word-break: break-all;
|
||||
/* 为了跟输入效果保持一致,设置透明边框占位 */
|
||||
border: 1px solid transparent;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.lf-node-text-auto-wrap {
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
/* border: 1px solid transparent; */
|
||||
}
|
||||
.lf-node-text-auto-wrap-content {
|
||||
line-height: 1.2;
|
||||
background: transparent;
|
||||
text-align: center;
|
||||
word-break: break-all;
|
||||
width: 100%;
|
||||
}
|
||||
.lf-node-text-ellipsis-content {
|
||||
line-height: 1.2;
|
||||
background: transparent;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
/* overflow: hidden;
|
||||
text-overflow: ellipsis; */
|
||||
width: 100%;
|
||||
}
|
||||
.lf-node-text-ellipsis-content>div{
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
/* tool-overlay */
|
||||
.lf-tool-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 2;
|
||||
pointer-events: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
.lf-tool-overlay > * {
|
||||
pointer-events: all;
|
||||
}
|
||||
/* modification-overlay */
|
||||
|
||||
.modification-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 1;
|
||||
pointer-events: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
.modification-overlay > * {
|
||||
pointer-events: all;
|
||||
}
|
||||
.lf-outline,.lf-snapline {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.lf-keyboard-tips {
|
||||
float: right;
|
||||
}
|
||||
.lf-node-select-decorate {
|
||||
transform: translate(-50%, -50%);
|
||||
pointer-events: none;
|
||||
border: 1px dashed #343435;
|
||||
position: absolute;
|
||||
}
|
||||
.lf-multiple-select {
|
||||
position: absolute;
|
||||
border: 2px dashed rgba(24, 125, 255, 0.8);
|
||||
box-shadow: 0px 0px 3px 0px rgba(24, 125, 255, 0.5);
|
||||
cursor: move;
|
||||
}
|
||||
.lf-edge-adjust-point {
|
||||
cursor: move;
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
{
|
||||
"name": "@logicflow/core",
|
||||
"version": "1.1.12",
|
||||
"description": "LogicFlow core, to quickly build flowchart editor",
|
||||
"main": "dist/logic-flow.js",
|
||||
"unpkg": "dist/logic-flow.js",
|
||||
"jsdelivr": "dist/logic-flow.js",
|
||||
"license": "Apache-2.0",
|
||||
"homepage": "http://logic-flow.org/",
|
||||
"types": "types/index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/didi/LogicFlow",
|
||||
"directory": "packages/core"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "cross-env NODE_ENV=development webpack-dev-server --client-log-level warning --config scripts/webpack.config.dev.js",
|
||||
"clean": "rimraf dist lib esm cjs",
|
||||
"build": "npm run build:umd",
|
||||
"build:umd": "cross-env NODE_ENV=production webpack --config scripts/webpack.config.build.js && cp -r src/style/ dist/style",
|
||||
"build-analyse": "cross-env analyse=true npm run build",
|
||||
"types": "tsc -d --declarationDir ./types --outDir temp && rimraf temp",
|
||||
"lint": "eslint . --ext .ts,.tsx",
|
||||
"publish-lib": "npm run types & npm run clean && npm run build && npm publish",
|
||||
"publish-next": "npm run types & npm run clean && npm run build && npm publish --tag next"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"es",
|
||||
"types",
|
||||
"README.md"
|
||||
],
|
||||
"dependencies": {
|
||||
"@types/mousetrap": "^1.6.4",
|
||||
"mousetrap": "^1.6.5",
|
||||
"preact": "^10.4.8"
|
||||
},
|
||||
"keywords": [
|
||||
"flowchart",
|
||||
"diagram"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.9.0",
|
||||
"@babel/plugin-proposal-class-properties": "^7.8.3",
|
||||
"@babel/plugin-proposal-decorators": "^7.10.5",
|
||||
"@babel/plugin-syntax-jsx": "^7.8.3",
|
||||
"@babel/plugin-transform-react-jsx": "^7.10.4",
|
||||
"@babel/preset-env": "^7.9.5",
|
||||
"@babel/preset-typescript": "^7.9.0",
|
||||
"@types/lodash-es": "^4.17.3",
|
||||
"@typescript-eslint/eslint-plugin": "^3.6.1",
|
||||
"@typescript-eslint/parser": "^3.2.0",
|
||||
"autoprefixer": "^9.7.6",
|
||||
"babel-core": "^7.0.0-bridge.0",
|
||||
"babel-loader": "^8.1.0",
|
||||
"babel-plugin-import": "^1.13.0",
|
||||
"case-sensitive-paths-webpack-plugin": "^2.3.0",
|
||||
"classnames": "^2.2.6",
|
||||
"core-js": "^3.6.5",
|
||||
"cross-env": "^7.0.2",
|
||||
"css-loader": "^4.2.1",
|
||||
"eslint": "^7.0.0",
|
||||
"eslint-config-airbnb-typescript": "^9.0.0",
|
||||
"eslint-loader": "^4.0.2",
|
||||
"eslint-plugin-import": "^2.22.0",
|
||||
"eslint-plugin-jsx-a11y": "^6.3.1",
|
||||
"eslint-plugin-react": "^7.20.6",
|
||||
"eslint-plugin-react-hooks": "^4.1.2",
|
||||
"eslint-plugin-standard": "^4.0.1",
|
||||
"eslint-webpack-plugin": "^2.1.0",
|
||||
"html-webpack-plugin": "^4.2.0",
|
||||
"husky": "^4.2.5",
|
||||
"ids": "^1.0.0",
|
||||
"less-loader": "^6.0.0",
|
||||
"lodash-es": "^4.17.15",
|
||||
"mobx": "^5.15.7",
|
||||
"mobx-react": "^6.3.0",
|
||||
"mobx-utils": "^5.6.1",
|
||||
"prettier": "^2.2.1",
|
||||
"rimraf": "^3.0.2",
|
||||
"standard-version": "^9.0.0",
|
||||
"style-loader": "^1.2.0",
|
||||
"style-resources-loader": "^1.3.3",
|
||||
"terser-webpack-plugin": "^4.2.3",
|
||||
"typescript": "^3.8.3",
|
||||
"url-loader": "^4.1.0",
|
||||
"uuid": "^8.2.0",
|
||||
"webpack": "^4.43.0",
|
||||
"webpack-bundle-analyzer": "^3.7.0",
|
||||
"webpack-cli": "^3.3.11",
|
||||
"webpack-dev-server": "^3.10.3"
|
||||
},
|
||||
"browserslist": [
|
||||
"> 3%",
|
||||
"last 2 versions",
|
||||
"not ie <= 11"
|
||||
],
|
||||
"gitHead": "ab8cc6126e9dfa5c4fb18037538a374d3a0b0521"
|
||||
}
|
||||
+553
@@ -0,0 +1,553 @@
|
||||
import GraphModel from './model/GraphModel';
|
||||
import Dnd from './view/behavior/DnD';
|
||||
import * as Options from './options';
|
||||
import * as _Model from './model';
|
||||
import History from './history/History';
|
||||
import Tool from './tool';
|
||||
import { CallbackType } from './event/eventEmitter';
|
||||
import Keyboard from './keyboard';
|
||||
import { EdgeConfig, EdgeFilter, NodeConfig, Extension, ComponentRender, FocusOnArgs, EdgeData, GraphConfigData, RegisterElementFn, RegisterConfig, ZoomParam, PointTuple } from './type';
|
||||
import SnaplineModel from './model/SnaplineModel';
|
||||
import { EditConfigInterface } from './model/EditConfigModel';
|
||||
import { Theme } from './constant/DefaultTheme';
|
||||
declare type GraphConfigModel = {
|
||||
nodes: _Model.BaseNodeModel[];
|
||||
edges: _Model.BaseEdgeModel[];
|
||||
};
|
||||
export default class LogicFlow {
|
||||
/**
|
||||
* 只读:logicflow实例挂载的容器。
|
||||
*/
|
||||
container: HTMLElement;
|
||||
/**
|
||||
* 只读:画布宽度
|
||||
*/
|
||||
width: number;
|
||||
/**
|
||||
* 只读:画布高度
|
||||
*/
|
||||
height: number;
|
||||
/**
|
||||
* 只读:控制整个logicflow画布的model
|
||||
*/
|
||||
graphModel: GraphModel;
|
||||
/**
|
||||
* 只读:控制上一步、下一步相关
|
||||
*/
|
||||
history: History;
|
||||
viewMap: Map<any, any>;
|
||||
tool: Tool;
|
||||
keyboard: Keyboard;
|
||||
dnd: Dnd;
|
||||
options: Options.Definition;
|
||||
snaplineModel: SnaplineModel;
|
||||
components: ComponentRender[];
|
||||
/**
|
||||
* 个性配置的插件,覆盖全局配置的插件
|
||||
*/
|
||||
plugins: Extension[];
|
||||
/**
|
||||
* 全局配置的插件,所有的LogicFlow示例都会使用
|
||||
*/
|
||||
static extensions: Map<string, Extension>;
|
||||
/**
|
||||
* 插件扩展方法
|
||||
* @example
|
||||
*/
|
||||
extension: Record<string, any>;
|
||||
/**
|
||||
* 自定义数据格式转换方法
|
||||
* 当接入系统格式和logicflow格式不一直的时候,可以自定义此方法来转换数据格式
|
||||
* 详情请参考adapter
|
||||
* @see todo
|
||||
*/
|
||||
adapterIn: (data: unknown) => GraphConfigData;
|
||||
/**
|
||||
* 自定义数据格式转换方法
|
||||
* 把logicflow输入的格式转换也接入系统需要的格式
|
||||
* 详情请参考adapter
|
||||
* @see todo
|
||||
*/
|
||||
adapterOut: (data: GraphConfigData) => unknown;
|
||||
/**
|
||||
* 支持插件在logicflow实例上增加自定义方法
|
||||
*/
|
||||
[propName: string]: any;
|
||||
constructor(options: Options.Definition);
|
||||
/**
|
||||
* 注册自定义节点和边
|
||||
* 支持两种方式
|
||||
* 方式一(推荐)
|
||||
* 详情见 todo: docs link
|
||||
* @example
|
||||
* import { RectNode, RectModel } from '@logicflow/core'
|
||||
* class CustomView extends RectNode {
|
||||
* }
|
||||
* class CustomModel extends RectModel {
|
||||
* }
|
||||
* lf.register({
|
||||
* type: 'custom',
|
||||
* view: CustomView,
|
||||
* model: CustomModel
|
||||
* })
|
||||
* 方式二
|
||||
* 不推荐,极个别在自定义的时候需要用到lf的情况下可以用这种方式。
|
||||
* 大多数情况下,我们可以直接在view中从this.props中获取graphModel
|
||||
* 或者model中直接this.graphModel获取model的方法。
|
||||
* @example
|
||||
* lf.register('custom', ({ RectNode, RectModel }) => {
|
||||
* class CustomView extends RectNode {}
|
||||
* class CustomModel extends RectModel {}
|
||||
* return {
|
||||
* view: CustomView,
|
||||
* model: CustomModel
|
||||
* }
|
||||
* })
|
||||
*/
|
||||
register(type: string | RegisterConfig, fn?: RegisterElementFn, isObserverView?: boolean): void;
|
||||
private registerElement;
|
||||
private defaultRegister;
|
||||
/**
|
||||
* 将图形选中
|
||||
* @param id 选择元素ID
|
||||
* @param multiple 是否允许多选,如果为true,不会将上一个选中的元素重置
|
||||
*/
|
||||
selectElementById(id: string, multiple?: boolean): void;
|
||||
/**
|
||||
* 定位到画布视口中心
|
||||
* 支持用户传入图形当前的坐标或id,可以通过type来区分是节点还是边的id,也可以不传(兜底)
|
||||
* @param focusOnArgs.id 如果传入的是id, 则画布视口中心移动到此id的元素中心点。
|
||||
* @param focusOnArgs.coordinate 如果传入的是坐标,则画布视口中心移动到此坐标。
|
||||
*/
|
||||
focusOn(focusOnArgs: FocusOnArgs): void;
|
||||
/**
|
||||
* 设置主题样式
|
||||
* @param { object } style 自定义主题样式
|
||||
* todo docs link
|
||||
*/
|
||||
setTheme(style: Theme): void;
|
||||
/**
|
||||
* 重新设置画布的宽高
|
||||
*/
|
||||
resize(width: number, height: number): void;
|
||||
/**
|
||||
* 设置默认的边类型。
|
||||
* 也就是设置在节点直接有用户手动绘制的连线类型。
|
||||
* @param type Options.EdgeType
|
||||
*/
|
||||
setDefaultEdgeType(type: Options.EdgeType): void;
|
||||
/**
|
||||
* 更新节点或边的文案
|
||||
* @param id 节点或者边id
|
||||
* @param value 文案内容
|
||||
*/
|
||||
updateText(id: string, value: string): void;
|
||||
/**
|
||||
* 删除元素,在不确定当前id是节点还是边时使用
|
||||
* @param id 元素id
|
||||
*/
|
||||
deleteElement(id: any): boolean;
|
||||
/**
|
||||
* 获取节点或边对象
|
||||
* @param id id
|
||||
*/
|
||||
getModelById(id: string): _Model.BaseNodeModel | _Model.BaseEdgeModel;
|
||||
/**
|
||||
* 获取节点或边的数据
|
||||
* @param id id
|
||||
*/
|
||||
getDataById(id: string): NodeConfig | EdgeConfig;
|
||||
/**
|
||||
* 修改指定节点类型
|
||||
* @param id 节点id
|
||||
* @param type 节点类型
|
||||
*/
|
||||
changeNodeType(id: string, type: string): void;
|
||||
/**
|
||||
* 切换边的类型
|
||||
* @param id 边Id
|
||||
* @param type 边类型
|
||||
*/
|
||||
changeEdgeType(id: string, type: string): void;
|
||||
/**
|
||||
* 获取节点连接的所有边的model
|
||||
* @param nodeId 节点ID
|
||||
* @returns model数组
|
||||
*/
|
||||
getNodeEdges(nodeId: any): _Model.BaseEdgeModel[];
|
||||
/**
|
||||
* 添加节点
|
||||
* @param nodeConfig 节点配置
|
||||
*/
|
||||
addNode(nodeConfig: NodeConfig): _Model.BaseNodeModel;
|
||||
/**
|
||||
* 删除节点
|
||||
* @param {string} nodeId 节点Id
|
||||
*/
|
||||
deleteNode(nodeId: string): boolean;
|
||||
/**
|
||||
* 克隆节点
|
||||
* @param nodeId 节点Id
|
||||
*/
|
||||
cloneNode(nodeId: string): _Model.BaseNodeModel;
|
||||
/**
|
||||
* 修改节点的id, 如果不传新的id,会内部自动创建一个。
|
||||
* @param { string } oldId 将要被修改的id
|
||||
* @param { string } newId 可选,修改后的id
|
||||
* @returns 修改后的节点id, 如果传入的oldId不存在,返回空字符串
|
||||
*/
|
||||
changeNodeId<T extends string>(oldId: string, newId?: T): T | string;
|
||||
/**
|
||||
* 获取节点对象
|
||||
* @param nodeId 节点Id
|
||||
*/
|
||||
getNodeModelById(nodeId: string): _Model.BaseNodeModel;
|
||||
/**
|
||||
* 获取节点数据
|
||||
* @param nodeId 节点
|
||||
*/
|
||||
getNodeDataById(nodeId: string): NodeConfig;
|
||||
/**
|
||||
* 给两个节点之间添加一条边
|
||||
* @example
|
||||
* lf.addEdge({
|
||||
* type: 'polygon'
|
||||
* sourceNodeId: 'node_id_1',
|
||||
* targetNodeId: 'node_id_2',
|
||||
* })
|
||||
* @param {object} edgeConfig
|
||||
*/
|
||||
addEdge(edgeConfig: EdgeConfig): _Model.BaseEdgeModel;
|
||||
/**
|
||||
* 删除边
|
||||
* @param {string} edgeId 边Id
|
||||
*/
|
||||
deleteEdge(edgeId: string): boolean;
|
||||
/**
|
||||
* 删除指定类型的边, 基于边起点和终点,可以只传其一。
|
||||
* @param config.sourceNodeId 边的起点节点ID
|
||||
* @param config.targetNodeId 边的终点节点ID
|
||||
*/
|
||||
deleteEdgeByNodeId(config: {
|
||||
sourceNodeId?: string;
|
||||
targetNodeId?: string;
|
||||
}): void;
|
||||
/**
|
||||
* 修改边的id, 如果不传新的id,会内部自动创建一个。
|
||||
* @param { string } oldId 将要被修改的id
|
||||
* @param { string } newId 可选,修改后的id
|
||||
* @returns 修改后的节点id, 如果传入的oldId不存在,返回空字符串
|
||||
*/
|
||||
changeEdgeId<T extends string>(oldId: string, newId?: T): T | string;
|
||||
/**
|
||||
* 基于边Id获取边的model
|
||||
* @param edgeId 边的Id
|
||||
* @return model
|
||||
*/
|
||||
getEdgeModelById(edgeId: string): _Model.BaseEdgeModel;
|
||||
/**
|
||||
* 获取满足条件边的model
|
||||
* @param edgeFilter 过滤条件
|
||||
* @example
|
||||
* 获取所有起点为节点A的边的model
|
||||
* lf.getEdgeModels({
|
||||
* sourceNodeId: 'nodeA_id'
|
||||
* })
|
||||
* 获取所有终点为节点B的边的model
|
||||
* lf.getEdgeModels({
|
||||
* targetNodeId: 'nodeB_id'
|
||||
* })
|
||||
* 获取起点为节点A,终点为节点B的边
|
||||
* lf.getEdgeModels({
|
||||
* sourceNodeId: 'nodeA_id',
|
||||
* targetNodeId: 'nodeB_id'
|
||||
* })
|
||||
* @return model数组
|
||||
*/
|
||||
getEdgeModels(edgeFilter: EdgeFilter): _Model.BaseEdgeModel[];
|
||||
/**
|
||||
* 基于id获取边数据
|
||||
* @param edgeId 边Id
|
||||
* @returns EdgeData
|
||||
*/
|
||||
getEdgeDataById(edgeId: string): EdgeData;
|
||||
/**
|
||||
* 获取所有以此节点为终点的边
|
||||
*/
|
||||
getNodeIncomingEdge(nodeId: any): any[];
|
||||
/**
|
||||
* 获取所有以此节点为起点的边
|
||||
*/
|
||||
getNodeOutgoingEdge(nodeId: any): any[];
|
||||
/**
|
||||
* 获取节点连接到的所有起始节点
|
||||
*/
|
||||
getNodeIncomingNode(nodeId: any): any[];
|
||||
/**
|
||||
* 获取节点连接到的所有目标节点
|
||||
*/
|
||||
getNodeOutgoingNode(nodeId: any): any[];
|
||||
/**
|
||||
* 显示节点、连线文本编辑框
|
||||
* @param id 元素id
|
||||
*/
|
||||
editText(id: string): void;
|
||||
/**
|
||||
* 设置元素的自定义属性
|
||||
* @see todo docs link
|
||||
* @param id 元素的id
|
||||
* @param properties 自定义属性
|
||||
*/
|
||||
setProperties(id: string, properties: Object): void;
|
||||
/**
|
||||
* 获取元素的自定义属性
|
||||
* @param id 元素的id
|
||||
* @returns 自定义属性
|
||||
*/
|
||||
getProperties(id: string): Object;
|
||||
/**
|
||||
* 将某个元素放置到顶部。
|
||||
* 如果堆叠模式为默认模式,则将原置顶元素重新恢复原有层级。
|
||||
* 如果堆叠模式为递增模式,则将需指定元素zIndex设置为当前最大zIndex + 1。
|
||||
* @see todo link 堆叠模式
|
||||
* @param id 元素Id
|
||||
*/
|
||||
toFront(id: any): void;
|
||||
/**
|
||||
* 设置元素的zIndex.
|
||||
* 注意:默认堆叠模式下,不建议使用此方法。
|
||||
* @see todo link 堆叠模式
|
||||
* @param id 元素id
|
||||
* @param zIndex zIndex的值,可以传数字,也支持传入'top' 和 'bottom'
|
||||
*/
|
||||
setElementZIndex(id: string, zIndex: number | 'top' | 'bottom'): void;
|
||||
/**
|
||||
* 添加多个元素, 包括边和节点。
|
||||
*/
|
||||
addElements({ nodes, edges }: GraphConfigData): GraphConfigModel;
|
||||
/**
|
||||
* 获取指定区域内的所有元素,此区域必须是DOM层。
|
||||
* 例如鼠标绘制选区后,获取选区内的所有元素。
|
||||
* @see todo 分层
|
||||
* @param leftTopPoint 区域左上角坐标, dom层坐标
|
||||
* @param rightBottomPoint 区域右下角坐标,dom层坐标
|
||||
*/
|
||||
getAreaElement(leftTopPoint: PointTuple, rightBottomPoint: PointTuple, wholeEdge?: boolean, wholeNode?: boolean): any[];
|
||||
/**
|
||||
* 获取选中的元素数据
|
||||
* @param isIgnoreCheck 是否包括sourceNode和targetNode没有被选中的边,默认包括。
|
||||
* 注意:复制的时候不能包括此类边, 因为复制的时候不允许悬空的边。
|
||||
*/
|
||||
getSelectElements(isIgnoreCheck?: boolean): GraphConfigData;
|
||||
/**
|
||||
* 将所有选中的元素设置为非选中
|
||||
*/
|
||||
clearSelectElements(): void;
|
||||
/**
|
||||
* 获取流程绘图数据
|
||||
* 注意: getGraphData返回的数据受到adapter影响,所以其数据格式不一定是logicflow内部图数据格式。
|
||||
* 如果实现通用插件,请使用getGraphRawData
|
||||
*/
|
||||
getGraphData(): GraphConfigData | any;
|
||||
/**
|
||||
* 获取流程绘图原始数据
|
||||
* 在存在adapter时,可以使用getGraphRawData获取图原始数据
|
||||
*/
|
||||
getGraphRawData(): GraphConfigData;
|
||||
/**
|
||||
* 清空画布
|
||||
*/
|
||||
clearData(): void;
|
||||
/**
|
||||
* 更新流程图编辑相关设置
|
||||
* @param {object} config 编辑配置
|
||||
* @see todo docs link
|
||||
*/
|
||||
updateEditConfig(config: EditConfigInterface): void;
|
||||
/**
|
||||
* 获取流程图当前编辑相关设置
|
||||
* @see todo docs link
|
||||
*/
|
||||
getEditConfig(): Partial<_Model.EditConfigModel>;
|
||||
/**
|
||||
* 获取事件位置相对于画布左上角的坐标
|
||||
* 画布所在的位置可以是页面任何地方,原生事件返回的坐标是相对于页面左上角的,该方法可以提供以画布左上角为原点的准确位置。
|
||||
* @see todo link
|
||||
* @param {number} x 事件x坐标
|
||||
* @param {number} y 事件y坐标
|
||||
* @returns {object} Point 事件位置的坐标
|
||||
* @returns {object} Point.domOverlayPosition HTML层上的坐标
|
||||
* @returns {object} Point.canvasOverlayPosition SVG层上的坐标
|
||||
*/
|
||||
getPointByClient(x: number, y: number): {
|
||||
domOverlayPosition: {
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
canvasOverlayPosition: {
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
};
|
||||
/**
|
||||
* 历史记录操作
|
||||
* 返回上一步
|
||||
*/
|
||||
undo(): void;
|
||||
/**
|
||||
* 历史记录操作
|
||||
* 恢复下一步
|
||||
*/
|
||||
redo(): void;
|
||||
/**
|
||||
* 放大缩小图形
|
||||
* @param zoomSize 放大缩小的值,支持传入0-n之间的数字。小于1表示缩小,大于1表示放大。也支持传入true和false按照内置的刻度放大缩小
|
||||
* @param point 缩放的原点
|
||||
* @returns {string} -放大缩小的比例
|
||||
*/
|
||||
zoom(zoomSize?: ZoomParam, point?: PointTuple): string;
|
||||
/**
|
||||
* 重置图形的放大缩写比例为默认
|
||||
*/
|
||||
resetZoom(): void;
|
||||
/**
|
||||
* 设置图形缩小时,能缩放到的最小倍数。参数为0-1自己。默认0.2
|
||||
* @param size 图形缩小的最小值
|
||||
*/
|
||||
setZoomMiniSize(size: number): void;
|
||||
/**
|
||||
* 设置图形放大时,能放大到的最大倍数,默认16
|
||||
* @param size 图形放大的最大值
|
||||
*/
|
||||
setZoomMaxSize(size: number): void;
|
||||
/**
|
||||
* 获取缩放的值和平移的值。
|
||||
*/
|
||||
getTransform(): {
|
||||
SCALE_X: number;
|
||||
SCALE_Y: number;
|
||||
TRANSLATE_X: number;
|
||||
TRANSLATE_Y: number;
|
||||
};
|
||||
/**
|
||||
* 平移图
|
||||
* @param x 向x轴移动距离
|
||||
* @param y 向y轴移动距离
|
||||
*/
|
||||
translate(x: number, y: number): void;
|
||||
/**
|
||||
* 还原图形为初始位置
|
||||
*/
|
||||
resetTranslate(): void;
|
||||
/**
|
||||
* 图形画布居中显示
|
||||
*/
|
||||
translateCenter(): void;
|
||||
/**
|
||||
* 图形适应屏幕大小
|
||||
* @param offset number 距离盒子四周的距离, 默认为20
|
||||
*/
|
||||
fitView(offset: number): void;
|
||||
/**
|
||||
* 监听事件
|
||||
* 事件详情见 @see todo
|
||||
* 支持同时监听多个事件
|
||||
* @example
|
||||
* lf.on('node:click,node:contextmenu', (data) => {
|
||||
* });
|
||||
*/
|
||||
on(evt: string, callback: CallbackType): void;
|
||||
/**
|
||||
* 撤销监听事件
|
||||
*/
|
||||
off(evt: string, callback: CallbackType): void;
|
||||
/**
|
||||
* 监听事件,只监听一次
|
||||
*/
|
||||
once(evt: string, callback: CallbackType): void;
|
||||
/**
|
||||
* 触发监听事件
|
||||
*/
|
||||
emit(evt: string, arg: any): void;
|
||||
/**
|
||||
* 添加扩展, 待讨论,这里是不是静态方法好一些?
|
||||
* 重复添加插件的时候,把上一次添加的插件的销毁。
|
||||
* @param plugin 插件
|
||||
*/
|
||||
static use(extension: Extension): void;
|
||||
private installPlugins;
|
||||
/**
|
||||
* 加载插件-内部方法
|
||||
*/
|
||||
private installPlugin;
|
||||
/**
|
||||
* 修改对应元素 model 中的属性
|
||||
* 注意:此方法慎用,除非您对logicflow内部有足够的了解。
|
||||
* 大多数情况下,请使用setProperties、updateText、changeNodeId等方法。
|
||||
* 例如直接使用此方法修改节点的id,那么就是会导致连接到此节点的边的sourceNodeId出现找不到的情况。
|
||||
* @param {string} id 元素id
|
||||
* @param {object} attributes 需要更新的属性
|
||||
*/
|
||||
updateAttributes(id: string, attributes: object): void;
|
||||
/**
|
||||
* 内部保留方法
|
||||
* 创建一个fakerNode,用于dnd插件拖动节点进画布的时候使用。
|
||||
*/
|
||||
createFakerNode(nodeConfig: any): any;
|
||||
/**
|
||||
* 内部保留方法
|
||||
* 移除fakerNode
|
||||
*/
|
||||
removeFakerNode(): void;
|
||||
/**
|
||||
* 内部保留方法
|
||||
* 用于fakerNode显示对齐线
|
||||
*/
|
||||
setNodeSnapLine(data: any): void;
|
||||
/**
|
||||
* 内部保留方法
|
||||
* 用于fakerNode移除对齐线
|
||||
*/
|
||||
removeNodeSnapLine(): void;
|
||||
/**
|
||||
* 内部保留方法
|
||||
* 用于fakerNode移除对齐线
|
||||
*/
|
||||
setView(type: string, component: any): void;
|
||||
renderRawData(graphRawData: any): void;
|
||||
/**
|
||||
* 渲染图
|
||||
* @example
|
||||
* lf.render({
|
||||
* nodes: [
|
||||
* {
|
||||
* id: 'node_1',
|
||||
* type: 'rect',
|
||||
* x: 100,
|
||||
* y: 100
|
||||
* },
|
||||
* {
|
||||
* id: 'node_2',
|
||||
* type: 'circel',
|
||||
* x: 300,
|
||||
* y: 200
|
||||
* }
|
||||
* ],
|
||||
* edges: [
|
||||
* {
|
||||
* sourceNodeId: 'node_1',
|
||||
* targetNodeId: 'node_2',
|
||||
* type: 'polyline'
|
||||
* }
|
||||
* ]
|
||||
* })
|
||||
* @param graphData 图数据
|
||||
*/
|
||||
render(graphData?: {}): void;
|
||||
/**
|
||||
* 内部保留方法
|
||||
* 获取指定类型的view
|
||||
*/
|
||||
getView: (type: string) => any;
|
||||
}
|
||||
export {};
|
||||
@@ -0,0 +1,6 @@
|
||||
import { Point } from '../type/index';
|
||||
export declare const getCorssPointOfLine: (a: Point, b: Point, c: Point, d: Point) => false | {
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
export declare const isInSegment: (point: any, start: any, end: any) => boolean;
|
||||
@@ -0,0 +1,6 @@
|
||||
export declare const getVerticalPointOfLine: (config: any) => {
|
||||
leftX: number;
|
||||
leftY: number;
|
||||
rightX: number;
|
||||
rightY: number;
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
export declare const getNodeOutline: ({ x, y, width, height, }: {
|
||||
x: any;
|
||||
y: any;
|
||||
width: any;
|
||||
height: any;
|
||||
}) => {
|
||||
x: number;
|
||||
y: number;
|
||||
x1: any;
|
||||
y1: any;
|
||||
};
|
||||
export declare const getLineOutline: (edge: any) => {
|
||||
x: number;
|
||||
y: number;
|
||||
x1: number;
|
||||
y1: number;
|
||||
};
|
||||
export declare const getPolylineOutline: (edge: any) => {
|
||||
x: number;
|
||||
y: number;
|
||||
x1: number;
|
||||
y1: number;
|
||||
};
|
||||
export declare const getBezierOutline: (edge: any) => {
|
||||
x: number;
|
||||
y: number;
|
||||
x1: number;
|
||||
y1: number;
|
||||
};
|
||||
export declare const getEdgeOutline: (edge: any) => {
|
||||
x: number;
|
||||
y: number;
|
||||
x1: number;
|
||||
y1: number;
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
export declare type AnimationConfig = {
|
||||
edge: boolean;
|
||||
node: boolean;
|
||||
};
|
||||
export declare type Animation = {
|
||||
stroke: string;
|
||||
strokeDasharray: string;
|
||||
className: string;
|
||||
};
|
||||
export declare const defaultAnimationCloseConfig: AnimationConfig;
|
||||
export declare const defaultAnimationOpenConfig: AnimationConfig;
|
||||
export declare const defaultAnimationData: Animation;
|
||||
@@ -0,0 +1,262 @@
|
||||
/**
|
||||
* 颜色
|
||||
* CSS属性用颜色
|
||||
* 如#000000,reg(0,0,0,0)
|
||||
* 如果是透明,可以传'none'
|
||||
*/
|
||||
export declare type Color = string;
|
||||
/**
|
||||
* svg虚线
|
||||
* 格式为逗号分割字符串,如
|
||||
* @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Attribute/stroke-dasharray
|
||||
*/
|
||||
export declare type DashArray = string;
|
||||
export declare type CommonTheme = {
|
||||
/**
|
||||
* 填充颜色
|
||||
*/
|
||||
fill?: Color;
|
||||
/**
|
||||
* 边框颜色
|
||||
*/
|
||||
stroke?: Color;
|
||||
/**
|
||||
* 边框宽度
|
||||
*/
|
||||
strokeWidth?: number;
|
||||
/**
|
||||
* 其他属性
|
||||
* 我们会把你定义的所有属性最终传递到DOM上
|
||||
* 详情请参考svg属性规范
|
||||
* https://developer.mozilla.org/zh-CN/docs/Web/SVG/Attribute
|
||||
*/
|
||||
[key: string]: any;
|
||||
};
|
||||
/**
|
||||
* rect主题样式
|
||||
* svg基础图形-矩形
|
||||
* https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/rect
|
||||
*/
|
||||
export declare type RectTheme = {
|
||||
/**
|
||||
* 矩形的默认宽度
|
||||
*/
|
||||
width?: number;
|
||||
/**
|
||||
* 矩形的默认高度
|
||||
*/
|
||||
height?: number;
|
||||
/**
|
||||
* 圆角
|
||||
* 注意,矩形圆角请使用radius
|
||||
* 不要使用rx和ry
|
||||
*/
|
||||
radius?: number;
|
||||
} & CommonTheme;
|
||||
/**
|
||||
* circle主题样式
|
||||
* svg基础图形-圆形
|
||||
* https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/circle
|
||||
*/
|
||||
export declare type CircleTheme = {
|
||||
/**
|
||||
* 默认半径
|
||||
*/
|
||||
r?: number;
|
||||
} & CommonTheme;
|
||||
/**
|
||||
* polygon主题样式
|
||||
* svg基础图形-多边形
|
||||
* https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/polygon
|
||||
*/
|
||||
export declare type PolygonTheme = CommonTheme;
|
||||
/**
|
||||
* ellipse主题样式
|
||||
* svg基础图形-椭圆
|
||||
* https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/ellipse
|
||||
*/
|
||||
export declare type EllipseTheme = CommonTheme;
|
||||
/**
|
||||
* 锚点样式
|
||||
* svg基础图形-圆
|
||||
*/
|
||||
export declare type AnchorTheme = {
|
||||
r?: number;
|
||||
hover?: {
|
||||
r: number;
|
||||
} & CommonTheme;
|
||||
} & CommonTheme;
|
||||
/**
|
||||
* 文本样式
|
||||
* svg文本
|
||||
* https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/text
|
||||
*/
|
||||
export declare type TextTheme = {
|
||||
/**
|
||||
* 文本颜色
|
||||
*/
|
||||
color?: Color;
|
||||
/**
|
||||
* 文本大小
|
||||
*/
|
||||
fontSize?: number;
|
||||
} & CommonTheme;
|
||||
/**
|
||||
* 文本节点样式
|
||||
*/
|
||||
export declare type TextNodeTheme = {
|
||||
background?: RectTheme;
|
||||
} & TextTheme;
|
||||
/**
|
||||
* 节点上文本样式
|
||||
*/
|
||||
export declare type NodeTextTheme = {
|
||||
/**
|
||||
* 文本超出指定宽度处理方式
|
||||
* default: 不特殊处理,允许超出
|
||||
* autoWrap: 超出自动换行
|
||||
* ellipsis: 超出省略
|
||||
*/
|
||||
overflowMode?: string;
|
||||
background?: RectTheme;
|
||||
} & TextTheme;
|
||||
/**
|
||||
* 边上文本样式
|
||||
*/
|
||||
export declare type EdgeTextTheme = {
|
||||
/**
|
||||
* 文本超出指定宽度处理方式
|
||||
* default: 不特殊处理,允许超出
|
||||
* autoWrap: 超出自动换行
|
||||
* ellipsis: 超出省略
|
||||
*/
|
||||
overflowMode?: string;
|
||||
/**
|
||||
* 文本一行最大宽度
|
||||
*/
|
||||
textWidth?: number;
|
||||
/**
|
||||
* 文本背景样式
|
||||
*/
|
||||
background?: {
|
||||
wrapPadding?: string;
|
||||
} & RectTheme;
|
||||
/**
|
||||
* hover状态下文本样式
|
||||
*/
|
||||
hover?: EdgeTextTheme;
|
||||
} & TextTheme;
|
||||
export declare type EdgeTheme = CommonTheme;
|
||||
export declare type EdgePolylineTheme = EdgeTheme;
|
||||
export declare type EdgeBezierTheme = {
|
||||
/**
|
||||
* 贝塞尔调整线主题
|
||||
*/
|
||||
adjustLine?: EdgeTheme;
|
||||
/**
|
||||
* 贝塞尔调整锚点主题
|
||||
*/
|
||||
adjustAnchor?: CircleTheme;
|
||||
} & EdgeTheme;
|
||||
/**
|
||||
* 箭头主题
|
||||
*/
|
||||
export declare type ArrowTheme = {
|
||||
/**
|
||||
* 箭头长度.
|
||||
* 以符号"->"为例, offset表示箭头大于号的宽度。
|
||||
*/
|
||||
offset?: number;
|
||||
/**
|
||||
* 箭头垂直于边的距离
|
||||
* 以符号"->"为例, verticalLength表示箭头大于号的高度
|
||||
*/
|
||||
verticalLength?: number;
|
||||
} & CommonTheme;
|
||||
export declare type OutlineTheme = {
|
||||
/**
|
||||
* hover状态下样式
|
||||
*/
|
||||
hover?: CommonTheme;
|
||||
} & CommonTheme;
|
||||
export declare type Theme = {
|
||||
/**
|
||||
* 所有节点的通用主题设置
|
||||
*/
|
||||
baseNode?: CommonTheme;
|
||||
/**
|
||||
* 基础图形-矩形样式
|
||||
*/
|
||||
rect?: RectTheme;
|
||||
/**
|
||||
* 基础图形-圆形样式
|
||||
*/
|
||||
circle?: CircleTheme;
|
||||
/**
|
||||
* 基础图形-菱形样式
|
||||
*/
|
||||
diamond?: PolygonTheme;
|
||||
/**
|
||||
* 基础图形-椭圆样式
|
||||
*/
|
||||
ellipse?: EllipseTheme;
|
||||
/**
|
||||
* 基础图形-多边形样式
|
||||
*/
|
||||
polygon?: PolygonTheme;
|
||||
/**
|
||||
* 所有边的通用主题设置
|
||||
*/
|
||||
baseEdge?: EdgeTheme;
|
||||
/**
|
||||
* 基础图形-直线样式
|
||||
*/
|
||||
line?: EdgeTheme;
|
||||
/**
|
||||
* 基础图形-折现样式
|
||||
*/
|
||||
polyline?: EdgePolylineTheme;
|
||||
/**
|
||||
* 基础图形-贝塞尔曲线样式
|
||||
*/
|
||||
bezier?: EdgeBezierTheme;
|
||||
/**
|
||||
* 锚点样式
|
||||
*/
|
||||
anchor?: AnchorTheme;
|
||||
/**
|
||||
* 文本节点样式
|
||||
*/
|
||||
text?: TextTheme;
|
||||
/**
|
||||
* 节点文本样式
|
||||
*/
|
||||
nodeText?: NodeTextTheme;
|
||||
/**
|
||||
* 边文本样式
|
||||
*/
|
||||
edgeText?: EdgeTextTheme;
|
||||
/**
|
||||
* 边上箭头的样式
|
||||
*/
|
||||
arrow?: ArrowTheme;
|
||||
/**
|
||||
* 从锚点拉出的边的样式
|
||||
*/
|
||||
anchorLine?: EdgeTheme;
|
||||
/**
|
||||
* 对齐线样式
|
||||
*/
|
||||
snapline?: EdgeTheme;
|
||||
/**
|
||||
* 当开启了跳转边的起点和终点(adjustEdgeStartAndEnd:true)后
|
||||
* 边的两端会出现调整按钮
|
||||
* 边连段的调整点样式
|
||||
*/
|
||||
edgeAdjust?: CircleTheme;
|
||||
/**
|
||||
* 节点选择状态下外侧的选框样式
|
||||
*/
|
||||
outline?: OutlineTheme;
|
||||
};
|
||||
export declare const defaultTheme: Theme;
|
||||
@@ -0,0 +1,91 @@
|
||||
export declare enum ElementState {
|
||||
DEFAULT = 1,
|
||||
TEXT_EDIT = 2,
|
||||
SHOW_MENU = 3,
|
||||
ALLOW_CONNECT = 4,
|
||||
NOT_ALLOW_CONNECT = 5
|
||||
}
|
||||
export declare enum ClipBoardInfo {
|
||||
KEY = "logic-flow",
|
||||
NODE_NAME = "lf-node",
|
||||
EDGE_NAME = "lf-edge"
|
||||
}
|
||||
export declare enum ModelType {
|
||||
NODE = "node",
|
||||
CIRCLE_NODE = "circle-node",
|
||||
POLYGON_NODE = "polygon-node",
|
||||
RECT_NODE = "rect-node",
|
||||
TEXT_NODE = "text-node",
|
||||
ELLIPSE_NODE = "ellipse-node",
|
||||
DIAMOND_NODE = "diamond-node",
|
||||
HTML_NODE = "html-node",
|
||||
EDGE = "edge",
|
||||
LINE_EDGE = "line-edge",
|
||||
POLYLINE_EDGE = "polyline-edge",
|
||||
BEZIER_EDGE = "bezier-edge",
|
||||
GRAPH = "graph"
|
||||
}
|
||||
export declare enum ElementType {
|
||||
NODE = "node",
|
||||
EDGE = "edge",
|
||||
GRAPH = "graph"
|
||||
}
|
||||
export declare enum EventType {
|
||||
ELEMENT_CLICK = "element:click",
|
||||
NODE_CLICK = "node:click",
|
||||
NODE_DBCLICK = "node:dbclick",
|
||||
NODE_DELETE = "node:delete",
|
||||
NODE_ADD = "node:add",
|
||||
NODE_DND_ADD = "node:dnd-add",
|
||||
NODE_DND_DRAG = "node:dnd-drag",
|
||||
NODE_MOUSEDOWN = "node:mousedown",
|
||||
NODE_DRAGSTART = "node:dragstart",
|
||||
NODE_DRAG = "node:drag",
|
||||
NODE_DROP = "node:drop",
|
||||
NODE_MOUSEUP = "node:mouseup",
|
||||
NODE_MOUSEMOVE = "node:mousemove",
|
||||
NODE_MOUSEENTER = "node:mouseenter",
|
||||
NODE_MOUSELEAVE = "node:mouseleave",
|
||||
NODE_CONTEXTMENU = "node:contextmenu",
|
||||
EDGE_DELETE = "edge:delete",
|
||||
EDGE_ADD = "edge:add",
|
||||
EDGE_CLICK = "edge:click",
|
||||
EDGE_DBCLICK = "edge:dbclick",
|
||||
EDGE_MOUSEENTER = "edge:mouseenter",
|
||||
EDGE_MOUSELEAVE = "edge:mouseleave",
|
||||
EDGE_CONTEXTMENU = "edge:contextmenu",
|
||||
EDGE_ADJUST = "edge:adjust",
|
||||
EDGE_EXCHANGE_NODE = "edge:exchange-node",
|
||||
ANCHOR_DRAGSTART = "anchor:dragstart",
|
||||
ANCHOR_DRAG = "anchor:drag",
|
||||
ANCHOR_DROP = "anchor:drop",
|
||||
BLANK_MOUSEDOWN = "blank:mousedown",
|
||||
BLANK_DRAGSTART = "blank:dragstart",
|
||||
BLANK_DRAG = "blank:drag",
|
||||
BLANK_DROP = "blank:drop",
|
||||
BLANK_MOUSEMOVE = "blank:mousemove",
|
||||
BLANK_MOUSEUP = "blank:mouseup",
|
||||
BLANK_CLICK = "blank:click",
|
||||
BLANK_CONTEXTMENU = "blank:contextmenu",
|
||||
SELECTION_MOUSEDOWN = "selection:mousedown",
|
||||
SELECTION_DRAGSTART = "selection:dragstart",
|
||||
SELECTION_DRAG = "selection:drag",
|
||||
SELECTION_DROP = "selection:drop",
|
||||
SELECTION_MOUSEMOVE = "selection:mousemove",
|
||||
SELECTION_MOUSEUP = "selection:mouseup",
|
||||
SELECTION_CONTEXTMENU = "selection:contextmenu",
|
||||
CONNECTION_NOT_ALLOWED = "connection:not-allowed",
|
||||
HISTORY_CHANGE = "history:change",
|
||||
TEXT_UPDATE = "text:update",
|
||||
GRAPH_TRANSFORM = "graph:transform",
|
||||
GRAPH_RENDERED = "graph:rendered"
|
||||
}
|
||||
export declare enum SegmentDirection {
|
||||
HORIZONTAL = "horizontal",
|
||||
VERTICAL = "vertical"
|
||||
}
|
||||
export declare const ElementMaxzIndex = 9999;
|
||||
export declare enum OverlapMode {
|
||||
DEFAULT = 0,
|
||||
INCREASE = 1
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { EventArgs } from '../type';
|
||||
export interface EventType {
|
||||
readonly callback: Function;
|
||||
readonly once: boolean;
|
||||
}
|
||||
export declare type CallbackType = (...args: any[]) => void;
|
||||
export { EventEmitter };
|
||||
export default class EventEmitter {
|
||||
private _events;
|
||||
/**
|
||||
* 监听一个事件
|
||||
* @param evt 事件名称
|
||||
* @param callback
|
||||
* @param once
|
||||
*/
|
||||
on(evt: string, callback: CallbackType, once?: boolean): this;
|
||||
/**
|
||||
* 监听一个事件一次
|
||||
* @param evt
|
||||
* @param callback
|
||||
*/
|
||||
once(evt: string, callback: CallbackType): void;
|
||||
/**
|
||||
* 触发一个事件
|
||||
* @param evt
|
||||
* @param args
|
||||
*/
|
||||
emit(evts: string, eventArgs: EventArgs): void;
|
||||
/**
|
||||
* 取消监听一个事件,或者一个channel
|
||||
* @param evt
|
||||
* @param callback
|
||||
*/
|
||||
off(evts?: string, callback?: CallbackType): this;
|
||||
getEvents(): Record<string, EventType[]>;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import EventEmitter from '../event/eventEmitter';
|
||||
declare class History {
|
||||
undos: any[];
|
||||
redos: any[];
|
||||
callbacks: any[];
|
||||
stopWatch: any;
|
||||
curData: any;
|
||||
maxSize: number;
|
||||
waitTime: number;
|
||||
eventCenter: EventEmitter;
|
||||
constructor(eventCenter: any);
|
||||
add(data: any): void;
|
||||
undoAble(): boolean;
|
||||
undo(): any;
|
||||
redoAble(): boolean;
|
||||
redo(): any;
|
||||
watch(model: any): void;
|
||||
}
|
||||
export { History };
|
||||
export default History;
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
import { h } from 'preact';
|
||||
import LogicFlow from './LogicFlow';
|
||||
import * as LogicFlowUtil from './util';
|
||||
export declare function observer<P>(props: P): any;
|
||||
export { LogicFlow, h };
|
||||
export { LogicFlowUtil };
|
||||
export * from './type/index';
|
||||
export * from './view';
|
||||
export * from './model';
|
||||
export * from './keyboard';
|
||||
export * from './options';
|
||||
export default LogicFlow;
|
||||
@@ -0,0 +1,32 @@
|
||||
import { MousetrapInstance } from 'mousetrap';
|
||||
import LogicFlow from '../LogicFlow';
|
||||
export declare type Action = 'keypress' | 'keydown' | 'keyup';
|
||||
export declare type Handler = (e: KeyboardEvent) => void;
|
||||
export interface KeyboardDef {
|
||||
enabled: boolean;
|
||||
shortcuts?: Array<{
|
||||
keys: string | string[];
|
||||
callback: Handler;
|
||||
action?: Action;
|
||||
}>;
|
||||
}
|
||||
export interface Options {
|
||||
lf: LogicFlow;
|
||||
keyboard?: KeyboardDef;
|
||||
}
|
||||
declare class Keyboard {
|
||||
readonly mousetrap: MousetrapInstance;
|
||||
options: Options;
|
||||
private target;
|
||||
constructor(options: Options);
|
||||
initShortcuts(): void;
|
||||
on(keys: string | string[], callback: Handler, action?: Action): void;
|
||||
get disabled(): boolean;
|
||||
off(keys: string | string[], action?: Action): void;
|
||||
enable(force: boolean): void;
|
||||
disable(): void;
|
||||
private getKeys;
|
||||
protected formatkey(key: string): string;
|
||||
}
|
||||
export { Keyboard };
|
||||
export default Keyboard;
|
||||
@@ -0,0 +1,3 @@
|
||||
import LogicFlow from '../LogicFlow';
|
||||
import GraphModel from '../model/GraphModel';
|
||||
export declare function initDefaultShortcut(lf: LogicFlow, graph: GraphModel): void;
|
||||
@@ -0,0 +1,86 @@
|
||||
import { ElementState } from '../constant/constant';
|
||||
import { TextConfig, AdditionData } from '../type';
|
||||
interface IBaseModel {
|
||||
/**
|
||||
* 节点或者边的id.
|
||||
* 默认情况下,使用uuidv4生成。
|
||||
* 如果想要自定义,可以重写createId生成。
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* 不可自定义
|
||||
* model对应的图形外观类型(eg: 圆形、矩形、多边形等)
|
||||
* 用于logicflow内部计算使用。
|
||||
*/
|
||||
modelType: string;
|
||||
/**
|
||||
* 请勿直接修改属性,如果想要将一个节点类型修改为另一个类型。请使用
|
||||
* `lf.graphModel.changeEdgeType`和`lf.graphModel.changeNodeType`
|
||||
*
|
||||
* 流程图元素类型,自定义元素时对应的标识。
|
||||
* 在logicflow/core中对应着rect、circle、polyline这种。
|
||||
* 在实际项目中,我们会基于业务类型进行自定义type.
|
||||
* 例如BPMN应用场景,我们会定义开始节点的类型为bpmn:start-event
|
||||
*
|
||||
* 和modelType的区别是,type更多的是业务上的类型,而modelType则是外观上的类型。
|
||||
* 例如bpmnjs的开始节点和结束节点type分别为'bpmn:start-event'和'bpmn:end-event'。
|
||||
* 但是他们的modelType都是circle-node, 因为他们外观都是基于圆形自定义而来。
|
||||
*/
|
||||
type: string;
|
||||
/**
|
||||
* 元素状态
|
||||
* 不同的状态对应着元素显示效果。
|
||||
* 请勿直接修改。
|
||||
* logicflow内部将元素状态分为5种:
|
||||
* DEFAULT = 1 默认显示
|
||||
* TEXT_EDIT = 2 此元素正在进行文本编辑
|
||||
* SHOW_MENU = 3, 显示菜单,废弃请使用菜单插件
|
||||
* ALLOW_CONNECT = 4, 此元素允许作为当前边的目标节点
|
||||
* NOT_ALLOW_CONNECT = 5, 此元素不允许作为当前边的目标节点
|
||||
*/
|
||||
state: ElementState;
|
||||
additionStateData: AdditionData;
|
||||
/**
|
||||
* 元素上的文本
|
||||
* logicflow中存在两种文本
|
||||
* 一种是脱离边和节点单独存在的文本
|
||||
* 一种是必须和边、节点关联的文本。
|
||||
* 此属性控制的是第二种。
|
||||
* 节点和边删除、调整的时候,其关联的文本也会对应删除、调整。
|
||||
*/
|
||||
text: TextConfig;
|
||||
/**
|
||||
* 元素是否被选中
|
||||
*/
|
||||
isSelected: boolean;
|
||||
visible: boolean;
|
||||
/**
|
||||
* 元素堆叠是层级,默认情况下节点zIndex值为1,边zIndex为0。
|
||||
* todo:写完善
|
||||
*/
|
||||
zIndex: number;
|
||||
/**
|
||||
* 创建节点ID
|
||||
* 默认情况下,logicflow内部使用uuidv4生成id。
|
||||
* 在自定义节点的时候,可以重写此方法基于自己的规则生成id。
|
||||
* 注意,此方法必须是同步的。
|
||||
* 如果想要异步修改Id,建议删除此节点后再同一位置创建一个新的节点。
|
||||
* @overridable 可以重写
|
||||
* @returns string
|
||||
*/
|
||||
createId(): string;
|
||||
moveText(deltaX: number, deltaY: number): void;
|
||||
updateText(value: string): void;
|
||||
setSelected(flag: boolean): void;
|
||||
setZIndex(zindex?: number): void;
|
||||
/**
|
||||
* 设置Node|Edge等model的状态
|
||||
* @param state 状态
|
||||
*/
|
||||
setElementState(state: ElementState, additionStateData?: AdditionData): void;
|
||||
getProperties(): Object;
|
||||
setProperties(properties: Object): void;
|
||||
updateAttributes(attributes: Object): void;
|
||||
getTextStyle(): Record<string, any>;
|
||||
}
|
||||
export { IBaseModel, };
|
||||
@@ -0,0 +1,99 @@
|
||||
export interface EditConfigInterface {
|
||||
/**
|
||||
* 是否为静默模式
|
||||
*/
|
||||
isSilentMode?: boolean;
|
||||
/**
|
||||
* 禁止缩放画布
|
||||
*/
|
||||
stopZoomGraph?: boolean;
|
||||
/**
|
||||
* 禁止鼠标滚动移动画布
|
||||
*/
|
||||
stopScrollGraph?: boolean;
|
||||
/**
|
||||
* 禁止拖动画布
|
||||
*/
|
||||
stopMoveGraph?: boolean;
|
||||
/**
|
||||
* 允许调整边
|
||||
*/
|
||||
adjustEdge?: boolean;
|
||||
/**
|
||||
* 允许调整边起点和终点
|
||||
*/
|
||||
adjustEdgeStartAndEnd?: boolean;
|
||||
/**
|
||||
* 允许拖动节点
|
||||
*/
|
||||
adjustNodePosition?: boolean;
|
||||
/**
|
||||
* 隐藏节点所有锚点
|
||||
*/
|
||||
hideAnchors?: boolean;
|
||||
/**
|
||||
* 显示节点悬浮时的外框
|
||||
*/
|
||||
hoverOutline?: boolean;
|
||||
/**
|
||||
* 节点被选中时是否显示outline
|
||||
*/
|
||||
nodeSelectedOutline?: boolean;
|
||||
/**
|
||||
* 边被选中时是否显示outline
|
||||
*/
|
||||
edgeSelectedOutline?: boolean;
|
||||
/**
|
||||
* 允许节点文本可以编辑
|
||||
*/
|
||||
nodeTextEdit?: boolean;
|
||||
/**
|
||||
* 允许边文本可以编辑
|
||||
*/
|
||||
edgeTextEdit?: boolean;
|
||||
/**
|
||||
* 允许文本编辑
|
||||
*/
|
||||
textEdit?: boolean;
|
||||
/**
|
||||
* 允许节点文本可以拖拽
|
||||
*/
|
||||
nodeTextDraggable?: boolean;
|
||||
/**
|
||||
* 允许边文本可以拖拽
|
||||
*/
|
||||
edgeTextDraggable?: boolean;
|
||||
/**
|
||||
* 多选按键, 支持meta(cmd)、shift、alt
|
||||
* 不支持ctrl,ctrl会触发contextmenu
|
||||
*/
|
||||
multipleSelectKey?: string;
|
||||
}
|
||||
/**
|
||||
* 页面编辑配置
|
||||
*/
|
||||
export default class EditConfigModel {
|
||||
isSilentMode: boolean;
|
||||
stopZoomGraph: boolean;
|
||||
stopScrollGraph: boolean;
|
||||
stopMoveGraph: boolean;
|
||||
adjustEdge: boolean;
|
||||
adjustEdgeMiddle: boolean;
|
||||
adjustEdgeStartAndEnd: boolean;
|
||||
adjustNodePosition: boolean;
|
||||
hideAnchors: boolean;
|
||||
hoverOutline: boolean;
|
||||
nodeSelectedOutline: boolean;
|
||||
edgeSelectedOutline: boolean;
|
||||
nodeTextEdit: boolean;
|
||||
edgeTextEdit: boolean;
|
||||
nodeTextDraggable: boolean;
|
||||
edgeTextDraggable: boolean;
|
||||
multipleSelectKey: string;
|
||||
defaultConfig: {};
|
||||
constructor(config: EditConfigInterface);
|
||||
updateEditConfig(config: any): void;
|
||||
getConfigDetail(config: any): Pick<any, string>;
|
||||
getConfig(): Partial<this>;
|
||||
}
|
||||
export { EditConfigModel };
|
||||
@@ -0,0 +1,441 @@
|
||||
import BaseNodeModel from './node/BaseNodeModel';
|
||||
import BaseEdgeModel from './edge/BaseEdgeModel';
|
||||
import EditConfigModel from './EditConfigModel';
|
||||
import TransfromModel from './TransformModel';
|
||||
import { OverlapMode } from '../constant/constant';
|
||||
import { AdditionData, Point, NodeConfig, EdgeConfig, PointTuple, NodeMoveRule, GraphConfigData, VirtualRectSize } from '../type';
|
||||
import EventEmitter from '../event/eventEmitter';
|
||||
import { Theme } from '../constant/DefaultTheme';
|
||||
import { Definition } from '../options';
|
||||
import { AnimationConfig } from '../constant/DefaultAnimation';
|
||||
declare type BaseNodeModelId = string;
|
||||
declare type ElementModeId = string;
|
||||
declare class GraphModel {
|
||||
/**
|
||||
* LogicFlow画布挂载元素
|
||||
* 也就是初始化LogicFlow实例时传入的container
|
||||
*/
|
||||
rootEl: HTMLElement;
|
||||
/**
|
||||
* LogicFlow画布宽度
|
||||
*/
|
||||
width: number;
|
||||
/**
|
||||
* LogicFlow画布高度
|
||||
*/
|
||||
height: number;
|
||||
/**
|
||||
* 主题配置
|
||||
* @see todo docs link
|
||||
*/
|
||||
theme: Theme;
|
||||
/**
|
||||
* 事件中心
|
||||
* @see todo docs link
|
||||
*/
|
||||
eventCenter: EventEmitter;
|
||||
/**
|
||||
* 维护所有节点和边类型对应的model
|
||||
*/
|
||||
modelMap: Map<any, any>;
|
||||
/**
|
||||
* 位于当前画布顶部的元素。
|
||||
* 此元素只在堆叠模式为默认模式下存在。
|
||||
* 用于在默认模式下将之前的顶部元素恢复初始高度。
|
||||
*/
|
||||
topElement: BaseNodeModel | BaseEdgeModel;
|
||||
/**
|
||||
* 控制是否开启动画
|
||||
*/
|
||||
animation: AnimationConfig;
|
||||
/**
|
||||
* 自定义全局id生成器
|
||||
* @see todo docs link
|
||||
*/
|
||||
idGenerator: (type?: string) => string;
|
||||
/**
|
||||
* 节点移动规则判断
|
||||
* 在节点移动的时候,会出发此数组中的所有规则判断
|
||||
*/
|
||||
nodeMoveRules: NodeMoveRule[];
|
||||
/**
|
||||
* 在图上操作创建边时,默认使用的边类型.
|
||||
*/
|
||||
edgeType: string;
|
||||
/**
|
||||
* 当前图上所有节点的model
|
||||
*/
|
||||
nodes: BaseNodeModel[];
|
||||
/**
|
||||
* 当前图上所有边的model
|
||||
*/
|
||||
edges: BaseEdgeModel[];
|
||||
/**
|
||||
* 元素重合时堆叠模式
|
||||
* 默认模式,节点和边被选中,会被显示在最上面。当取消选中后,元素会恢复之前的层级。
|
||||
* 递增模式,节点和边被选中,会被显示在最上面。当取消选中后,元素会保持层级。
|
||||
* @see todo link
|
||||
*/
|
||||
overlapMode: OverlapMode;
|
||||
/**
|
||||
* 背景配置
|
||||
* @see todo link
|
||||
*/
|
||||
background: any;
|
||||
/**
|
||||
* 控制画布的缩放、平移
|
||||
* @see todo link
|
||||
*/
|
||||
transformModel: TransfromModel;
|
||||
/**
|
||||
* 控制流程图编辑相关配置
|
||||
* @see todo link
|
||||
*/
|
||||
editConfigModel: EditConfigModel;
|
||||
/**
|
||||
* 网格大小
|
||||
* @see todo link
|
||||
*/
|
||||
gridSize: number;
|
||||
/**
|
||||
* 局部渲染
|
||||
* @see todo logicflow性能
|
||||
*/
|
||||
partial: boolean;
|
||||
/**
|
||||
* 外部拖动节点进入画布的过程中,用fakerNode来和画布上正是的节点区分开
|
||||
*/
|
||||
fakerNode: BaseNodeModel;
|
||||
[key: string]: any;
|
||||
constructor(options: Definition);
|
||||
get nodesMap(): {
|
||||
[key: string]: {
|
||||
index: number;
|
||||
model: BaseNodeModel;
|
||||
};
|
||||
};
|
||||
get edgesMap(): {
|
||||
[key: string]: {
|
||||
index: number;
|
||||
model: BaseEdgeModel;
|
||||
};
|
||||
};
|
||||
get modelsMap(): {
|
||||
[key: string]: BaseNodeModel | BaseEdgeModel;
|
||||
};
|
||||
/**
|
||||
* 基于zIndex对元素进行排序。
|
||||
* todo: 性能优化
|
||||
*/
|
||||
get sortElements(): any[];
|
||||
/**
|
||||
* 当前编辑的元素,低频操作,先循环找。
|
||||
*/
|
||||
get textEditElement(): BaseNodeModel | BaseEdgeModel;
|
||||
/**
|
||||
* 当前画布所有被选中的元素
|
||||
*/
|
||||
get selectElements(): Map<any, any>;
|
||||
/**
|
||||
* 获取指定区域内的所有元素
|
||||
* @param leftTopPoint 表示区域左上角的点
|
||||
* @param rightBottomPoint 表示区域右下角的点
|
||||
* @param wholeEdge 是否要整个边都在区域内部
|
||||
* @param wholeNode 是否要整个节点都在区域内部
|
||||
*/
|
||||
getAreaElement(leftTopPoint: PointTuple, rightBottomPoint: PointTuple, wholeEdge?: boolean, wholeNode?: boolean): any[];
|
||||
/**
|
||||
* 获取指定类型元素对应的Model
|
||||
*/
|
||||
getModel(type: string): any;
|
||||
/**
|
||||
* 基于Id获取节点的model
|
||||
*/
|
||||
getNodeModelById(nodeId: BaseNodeModelId): BaseNodeModel;
|
||||
/**
|
||||
* 因为流程图所在的位置可以是页面任何地方
|
||||
* 当内部事件需要获取触发事件时,其相对于画布左上角的位置
|
||||
* 需要事件触发位置减去画布相对于client的位置
|
||||
*/
|
||||
getPointByClient({ x: x1, y: y1 }: Point): {
|
||||
domOverlayPosition: {
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
canvasOverlayPosition: {
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
};
|
||||
/**
|
||||
* 判断一个元素是否在指定矩形区域内。
|
||||
* @param element 节点或者边
|
||||
* @param lt 左上角点
|
||||
* @param rb 右下角点
|
||||
* @param wholeEdge 边的起点和终点都在区域内才算
|
||||
* @param wholeNode 节点的box都在区域内才算
|
||||
*/
|
||||
isElementInArea(element: any, lt: PointTuple, rb: PointTuple, wholeEdge?: boolean, wholeNode?: boolean): boolean;
|
||||
/**
|
||||
* 使用新的数据重新设置整个画布的元素
|
||||
* 注意:将会清除画布上所有已有的节点和边
|
||||
* @param { object } graphData 图数据
|
||||
*/
|
||||
graphDataToModel(graphData: GraphConfigData): void;
|
||||
/**
|
||||
* 获取画布数据
|
||||
*/
|
||||
modelToGraphData(): GraphConfigData;
|
||||
modelToHistoryData(): false | {
|
||||
nodes: any[];
|
||||
edges: any[];
|
||||
};
|
||||
/**
|
||||
* 获取边的model
|
||||
*/
|
||||
getEdgeModelById(edgeId: string): BaseEdgeModel | undefined;
|
||||
/**
|
||||
* 获取节点或者边的model
|
||||
*/
|
||||
getElement(id: string): BaseNodeModel | BaseEdgeModel | undefined;
|
||||
/**
|
||||
* 所有节点上所有边的model
|
||||
*/
|
||||
getNodeEdges(nodeId: any): BaseEdgeModel[];
|
||||
/**
|
||||
* 获取选中的元素数据
|
||||
* @param isIgnoreCheck 是否包括sourceNode和targetNode没有被选中的边,默认包括。
|
||||
* 复制的时候不能包括此类边, 因为复制的时候不允许悬空的边
|
||||
*/
|
||||
getSelectElements(isIgnoreCheck?: boolean): GraphConfigData;
|
||||
/**
|
||||
* 修改对应元素 model 中的属性
|
||||
* 注意:此方法慎用,除非您对logicflow内部有足够的了解。
|
||||
* 大多数情况下,请使用setProperties、updateText、changeNodeId等方法。
|
||||
* 例如直接使用此方法修改节点的id,那么就是会导致连接到此节点的边的sourceNodeId出现找不到的情况。
|
||||
* @param {string} id 元素id
|
||||
* @param {object} attributes 需要更新的属性
|
||||
*/
|
||||
updateAttributes(id: string, attributes: object): void;
|
||||
/**
|
||||
* 修改节点的id, 如果不传新的id,会内部自动创建一个。
|
||||
* @param { string } oldId 将要被修改的id
|
||||
* @param { string } newId 可选,修改后的id
|
||||
* @returns 修改后的节点id, 如果传入的oldId不存在,返回空字符串
|
||||
*/
|
||||
changeNodeId<T extends string>(oldId: any, newId?: T | string): T | string;
|
||||
/**
|
||||
* 修改边的id, 如果不传新的id,会内部自动创建一个。
|
||||
* @param { string } oldId 将要被修改的id
|
||||
* @param { string } newId 可选,修改后的id
|
||||
* @returns 修改后的节点id, 如果传入的oldId不存在,返回空字符串
|
||||
*/
|
||||
changeEdgeId<T extends string>(oldId: string, newId?: string): T | string;
|
||||
/**
|
||||
* 内部保留方法,请勿直接使用
|
||||
*/
|
||||
setFakerNode(nodeModel: BaseNodeModel): void;
|
||||
/**
|
||||
* 内部保留方法,请勿直接使用
|
||||
*/
|
||||
removeFakerNode(): void;
|
||||
/**
|
||||
* 设置指定类型的Model,请勿直接使用
|
||||
*/
|
||||
setModel(type: string, ModelClass: any): Map<any, any>;
|
||||
/**
|
||||
* 将某个元素放置到顶部。
|
||||
* 如果堆叠模式为默认模式,则将原置顶元素重新恢复原有层级。
|
||||
* 如果堆叠模式为递增模式,则将需指定元素zIndex设置为当前最大zIndex + 1。
|
||||
* @see todo link 堆叠模式
|
||||
* @param id 元素Id
|
||||
*/
|
||||
toFront(id: any): void;
|
||||
/**
|
||||
* 设置元素的zIndex.
|
||||
* 注意:默认堆叠模式下,不建议使用此方法。
|
||||
* @see todo link 堆叠模式
|
||||
* @param id 元素id
|
||||
* @param zIndex zIndex的值,可以传数字,也支持传入'top' 和 'bottom'
|
||||
*/
|
||||
setElementZIndex(id: string, zIndex: number | 'top' | 'bottom'): void;
|
||||
/**
|
||||
* 删除节点
|
||||
* @param {string} nodeId 节点Id
|
||||
*/
|
||||
deleteNode(id: any): void;
|
||||
/**
|
||||
* 添加节点
|
||||
* @param nodeConfig 节点配置
|
||||
*/
|
||||
addNode(nodeConfig: NodeConfig): any;
|
||||
/**
|
||||
* 克隆节点
|
||||
* @param nodeId 节点Id
|
||||
*/
|
||||
cloneNode(nodeId: string): BaseNodeModel;
|
||||
/**
|
||||
* 移动节点-相对位置
|
||||
* @param nodeModel 节点Id
|
||||
* @param deltaX X轴移动距离
|
||||
* @param deltaY Y轴移动距离
|
||||
* @param isignoreRule 是否忽略移动规则限制
|
||||
*/
|
||||
moveNode(nodeId: BaseNodeModelId, deltaX: number, deltaY: number, isignoreRule?: boolean): void;
|
||||
/**
|
||||
* 移动节点-绝对位置
|
||||
* @param nodeModel 节点Id
|
||||
* @param x X轴目标位置
|
||||
* @param y Y轴目标位置
|
||||
*/
|
||||
moveNode2Coordinate(nodeId: BaseNodeModelId, x: number, y: number, isignoreRule?: boolean): void;
|
||||
/**
|
||||
* 显示节点、连线文本编辑框
|
||||
* @param elementId 节点id
|
||||
*/
|
||||
editText(id: ElementModeId): void;
|
||||
/**
|
||||
* 给两个节点之间添加一条边
|
||||
* @param {object} edgeConfig
|
||||
*/
|
||||
addEdge(edgeConfig: EdgeConfig): BaseEdgeModel;
|
||||
/**
|
||||
* 移动边,内部方法,请勿直接使用
|
||||
*/
|
||||
moveEdge(nodeId: BaseNodeModelId, deltaX: number, deltaY: number): void;
|
||||
/**
|
||||
* 删除两节点之间的边
|
||||
* @param sourceNodeId 边的起始节点
|
||||
* @param targetNodeId 边的目的节点
|
||||
*/
|
||||
deleteEdgeBySourceAndTarget(sourceNodeId: any, targetNodeId: any): void;
|
||||
/**
|
||||
* 基于边Id删除边
|
||||
*/
|
||||
deleteEdgeById(id: any): void;
|
||||
/**
|
||||
* 删除以节点Id为起点的所有边
|
||||
*/
|
||||
deleteEdgeBySource(sourceNodeId: any): void;
|
||||
/**
|
||||
* 删除以节点Id为终点的所有边
|
||||
*/
|
||||
deleteEdgeByTarget(targetNodeId: any): void;
|
||||
/**
|
||||
* 设置元素的状态,在需要保证整个画布上所有的元素只有一个元素拥有此状态时可以调用此方法。
|
||||
* 例如文本编辑、菜单显示等。
|
||||
* additionStateData: 传递的额外值,如菜单显示的时候,需要传递期望菜单显示的位置。
|
||||
*/
|
||||
setElementStateById(id: ElementModeId, state: number, additionStateData?: AdditionData): void;
|
||||
/**
|
||||
* 更新节点或边的文案
|
||||
* @param id 节点或者边id
|
||||
* @param value 文案内容
|
||||
*/
|
||||
updateText(id: ElementModeId, value: string): void;
|
||||
/**
|
||||
* 选中节点
|
||||
* @param id 节点Id
|
||||
* @param multiple 是否为多选,如果为多选,则不去掉原有已选择节点的选中状态
|
||||
*/
|
||||
selectNodeById(id: string, multiple?: boolean): void;
|
||||
/**
|
||||
* 选中边
|
||||
* @param id 边Id
|
||||
* @param multiple 是否为多选,如果为多选,则不去掉原已选中边的状态
|
||||
*/
|
||||
selectEdgeById(id: string, multiple?: boolean): void;
|
||||
/**
|
||||
* 将图形选中
|
||||
* @param id 选择元素ID
|
||||
* @param multiple 是否允许多选,如果为true,不会将上一个选中的元素重置
|
||||
*/
|
||||
selectElementById(id: string, multiple?: boolean): void;
|
||||
/**
|
||||
* 将所有选中的元素设置为非选中
|
||||
*/
|
||||
clearSelectElements(): void;
|
||||
/**
|
||||
* 批量移动节点,节点移动的时候,会动态计算所有节点与未移动节点的边位置
|
||||
* 移动的节点之间的边会保持相对位置
|
||||
*/
|
||||
moveNodes(nodeIds: string[], deltaX: number, deltaY: number, isignoreRule?: boolean): void;
|
||||
/**
|
||||
* 添加节点移动限制规则,在节点移动的时候触发。
|
||||
* 如果方法返回false, 则会阻止节点移动。
|
||||
* @param fn function
|
||||
* @example
|
||||
*
|
||||
* graphModel.addNodeMoveRules((nodeModel, x, y) => {
|
||||
* if (nodeModel.properties.disabled) {
|
||||
* return false
|
||||
* }
|
||||
* return true
|
||||
* })
|
||||
*
|
||||
*/
|
||||
addNodeMoveRules(fn: NodeMoveRule): void;
|
||||
/**
|
||||
* 设置默认的边类型
|
||||
* 也就是设置在节点直接有用户手动绘制的连线类型。
|
||||
* @param type Options.EdgeType
|
||||
*/
|
||||
setDefaultEdgeType(type: string): void;
|
||||
/**
|
||||
* 修改指定节点类型
|
||||
* @param id 节点id
|
||||
* @param type 节点类型
|
||||
*/
|
||||
changeNodeType(id: any, type: string): void;
|
||||
/**
|
||||
* 切换边的类型
|
||||
* @param id 边Id
|
||||
* @param type 边类型
|
||||
*/
|
||||
changeEdgeType(id: any, type: any): void;
|
||||
/**
|
||||
* 获取所有以此节点为终点的边
|
||||
*/
|
||||
getNodeIncomingEdge(nodeId: any): any[];
|
||||
/**
|
||||
* 获取所有以此节点为起点的边
|
||||
*/
|
||||
getNodeOutgoingEdge(nodeId: any): any[];
|
||||
/**
|
||||
* 获取节点连接到的所有起始节点
|
||||
*/
|
||||
getNodeIncomingNode(nodeId: any): any[];
|
||||
/**
|
||||
* 获取节点连接到的所有目标节点
|
||||
*/
|
||||
getNodeOutgoingNode(nodeId: any): any[];
|
||||
/**
|
||||
* 设置主题
|
||||
* todo docs link
|
||||
*/
|
||||
setTheme(style: Theme): void;
|
||||
/**
|
||||
* 重新设置画布的宽高
|
||||
*/
|
||||
resize(width: number, height: number): void;
|
||||
/**
|
||||
* 清空画布
|
||||
*/
|
||||
clearData(): void;
|
||||
/**
|
||||
* 获取图形区域虚拟矩型的尺寸和中心坐标
|
||||
* @returns
|
||||
*/
|
||||
getVirtualRectSize(): VirtualRectSize;
|
||||
/**
|
||||
* 将图形整体移动到画布中心
|
||||
*/
|
||||
translateCenter(): void;
|
||||
/**
|
||||
* 画布图形适应屏幕大小
|
||||
* @param offset number 距离盒子四周的距离, 默认为20
|
||||
*/
|
||||
fitView(offset?: number): void;
|
||||
}
|
||||
export { GraphModel };
|
||||
export default GraphModel;
|
||||
@@ -0,0 +1,33 @@
|
||||
import GraphModel from './GraphModel';
|
||||
import { NodeData } from '../type/index';
|
||||
import BaseNodeModel from './node/BaseNodeModel';
|
||||
export declare type SnaplineInfo = {
|
||||
isShowHorizontal?: boolean;
|
||||
isShowVertical?: boolean;
|
||||
position?: SnaplinePosition;
|
||||
};
|
||||
export declare type SnaplinePosition = {
|
||||
x?: number;
|
||||
y?: number;
|
||||
};
|
||||
export default class SnaplineModel {
|
||||
graphModel: GraphModel;
|
||||
isShowHorizontal: boolean;
|
||||
isShowVertical: boolean;
|
||||
position: SnaplinePosition;
|
||||
constructor(graphModel: any);
|
||||
getStyle(): {
|
||||
[x: string]: any;
|
||||
fill?: string;
|
||||
stroke?: string;
|
||||
strokeWidth?: number;
|
||||
};
|
||||
private getCenterSnapLine;
|
||||
private getHorizontalSnapline;
|
||||
private getVerticalSnapline;
|
||||
getSnapLinePosition(dragingNode: NodeData, nodes: BaseNodeModel[]): SnaplineInfo;
|
||||
private setSnaplineInfo;
|
||||
clearSnapline(): void;
|
||||
setNodeSnapLine(nodeData: NodeData): void;
|
||||
}
|
||||
export { SnaplineModel };
|
||||
@@ -0,0 +1,83 @@
|
||||
import EventEmitter from '../event/eventEmitter';
|
||||
import { PointTuple, ZoomParam } from '../type';
|
||||
export interface TransfromInterface {
|
||||
SCALE_X: number;
|
||||
SKEW_Y: number;
|
||||
SKEW_X: number;
|
||||
SCALE_Y: number;
|
||||
TRANSLATE_X: number;
|
||||
TRANSLATE_Y: number;
|
||||
ZOOM_SIZE: number;
|
||||
MINI_SCALE_SIZE: number;
|
||||
MAX_SCALE_SIZE: number;
|
||||
zoom: (isZoomout: ZoomParam) => string;
|
||||
HtmlPointToCanvasPoint: (point: PointTuple) => PointTuple;
|
||||
CanvasPointToHtmlPoint: (point: PointTuple) => PointTuple;
|
||||
moveCanvasPointByHtml: (point: PointTuple, x: number, y: number) => PointTuple;
|
||||
getTransformStyle: () => {
|
||||
transform: string;
|
||||
};
|
||||
}
|
||||
export default class TransfromModel implements TransfromInterface {
|
||||
MINI_SCALE_SIZE: number;
|
||||
MAX_SCALE_SIZE: number;
|
||||
SCALE_X: number;
|
||||
SKEW_Y: number;
|
||||
SKEW_X: number;
|
||||
SCALE_Y: number;
|
||||
TRANSLATE_X: number;
|
||||
TRANSLATE_Y: number;
|
||||
ZOOM_SIZE: number;
|
||||
eventCenter: EventEmitter;
|
||||
constructor(eventCenter: any);
|
||||
setZoomMiniSize(size: number): void;
|
||||
setZoomMaxSize(size: number): void;
|
||||
/**
|
||||
* 将最外层graph上的点基于缩放转换为canvasOverlay层上的点。
|
||||
* @param param0 HTML点
|
||||
*/
|
||||
HtmlPointToCanvasPoint([x, y]: PointTuple): PointTuple;
|
||||
/**
|
||||
* 将最外层canvasOverlay层上的点基于缩放转换为graph上的点。
|
||||
* @param param0 HTML点
|
||||
*/
|
||||
CanvasPointToHtmlPoint([x, y]: PointTuple): PointTuple;
|
||||
/**
|
||||
* 将一个在canvas上的点,向x轴方向移动directionX距离,向y轴方向移动dirctionY距离。
|
||||
* 因为canvas可能被缩小或者放大了,所以其在canvas层移动的距离需要计算上缩放的量。
|
||||
* @param point 点
|
||||
* @param directionX x轴距离
|
||||
* @param directionY y轴距离
|
||||
*/
|
||||
moveCanvasPointByHtml([x, y]: PointTuple, directionX: number, directionY: number): PointTuple;
|
||||
/**
|
||||
* 根据缩放情况,获取缩放后的delta距离
|
||||
* @param deltaX x轴距离变化
|
||||
* @param deltaY y轴距离变化
|
||||
*/
|
||||
fixDeltaXY(deltaX: number, deltaY: number): PointTuple;
|
||||
/**
|
||||
* 基于当前的缩放,获取画布渲染样式transform值
|
||||
*/
|
||||
getTransformStyle(): {
|
||||
transform: string;
|
||||
};
|
||||
/**
|
||||
* 放大缩小图形
|
||||
* @param zoomSize 放大缩小的值,支持传入0-n之间的数字。小于1表示缩小,大于1表示放大。也支持传入true和false按照内置的刻度放大缩小
|
||||
* @param point 缩放的原点
|
||||
* @returns {string} -放大缩小的比例
|
||||
*/
|
||||
zoom(zoomSize?: ZoomParam, point?: PointTuple): string;
|
||||
private emitGraphTransform;
|
||||
resetZoom(): void;
|
||||
translate(x: number, y: number): void;
|
||||
/**
|
||||
* 将图形定位到画布中心
|
||||
* @param targetX 图形当前x坐标
|
||||
* @param targetY 图形当前y坐标
|
||||
* @param width 画布宽
|
||||
* @param height 画布高
|
||||
*/
|
||||
focusOn(targetX: number, targetY: number, width: number, height: number): void;
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
import { IBaseModel } from '../BaseModel';
|
||||
import GraphModel from '../GraphModel';
|
||||
import { Point, AdditionData, EdgeData, MenuConfig, EdgeConfig } from '../../type/index';
|
||||
import { ModelType, ElementType } from '../../constant/constant';
|
||||
import { OutlineTheme } from '../../constant/DefaultTheme';
|
||||
declare class BaseEdgeModel implements IBaseModel {
|
||||
id: string;
|
||||
type: string;
|
||||
sourceNodeId: string;
|
||||
targetNodeId: string;
|
||||
startPoint: any;
|
||||
endPoint: any;
|
||||
text: {
|
||||
value: string;
|
||||
x: number;
|
||||
y: number;
|
||||
draggable: boolean;
|
||||
editable: boolean;
|
||||
};
|
||||
properties: Record<string, any>;
|
||||
points: string;
|
||||
pointsList: any[];
|
||||
isSelected: boolean;
|
||||
isHovered: boolean;
|
||||
isHitable: boolean;
|
||||
draggable: boolean;
|
||||
visible: boolean;
|
||||
graphModel: GraphModel;
|
||||
zIndex: number;
|
||||
readonly BaseType = ElementType.EDGE;
|
||||
modelType: ModelType;
|
||||
state: number;
|
||||
additionStateData: AdditionData;
|
||||
sourceAnchorId: string;
|
||||
targetAnchorId: string;
|
||||
menu?: MenuConfig[];
|
||||
customTextPosition: boolean;
|
||||
animationData: import("../../constant/DefaultAnimation").Animation;
|
||||
[propName: string]: any;
|
||||
constructor(data: EdgeConfig, graphModel: GraphModel);
|
||||
/**
|
||||
* @overridable 支持重写
|
||||
* 初始化边数据
|
||||
* initNodeData和setAttributes的区别在于
|
||||
* initNodeData只在节点初始化的时候调用,用于初始化节点的所有属性。
|
||||
* setAttributes除了初始化调用外,还会在properties发生变化了调用。
|
||||
*/
|
||||
initEdgeData(data: any): void;
|
||||
/**
|
||||
* 设置model属性,每次properties发生变化会触发
|
||||
* @overridable 支持重写
|
||||
*/
|
||||
setAttributes(): void;
|
||||
/**
|
||||
* @overridable 支持重写,自定义此类型节点默认生成方式
|
||||
* @returns string
|
||||
*/
|
||||
createId(): any;
|
||||
/**
|
||||
* @overridable 支持重写
|
||||
* 获取当前节点样式
|
||||
* @returns 自定义边样式
|
||||
*/
|
||||
getEdgeStyle(): import("../../constant/DefaultTheme").CommonTheme;
|
||||
/**
|
||||
* @overridable 支持重写
|
||||
* 获取当前节点文本样式
|
||||
*/
|
||||
getTextStyle(): import("../../constant/DefaultTheme").EdgeTextTheme;
|
||||
/**
|
||||
* @overridable 支持重写
|
||||
* 获取当前边的动画样式
|
||||
* @returns 自定义边动画样式
|
||||
*/
|
||||
getAnimation(): import("../../constant/DefaultAnimation").Animation;
|
||||
/**
|
||||
* @overridable 支持重写
|
||||
* 获取outline样式,重写可以定义此类型边outline样式, 默认使用主题样式
|
||||
* @returns 自定义outline样式
|
||||
*/
|
||||
getOutlineStyle(): OutlineTheme;
|
||||
/**
|
||||
* @overridable 支持重新,重新自定义文本位置
|
||||
* @returns 文本位置
|
||||
*/
|
||||
getTextPosition(): Point;
|
||||
get sourceNode(): import("..").BaseNodeModel;
|
||||
get targetNode(): import("..").BaseNodeModel;
|
||||
get textPosition(): Point;
|
||||
/**
|
||||
* 内部方法,计算两个节点相连是起点位置
|
||||
*/
|
||||
getBeginAnchor(sourceNode: any, targetNode: any): Point;
|
||||
/**
|
||||
* 内部方法,计算两个节点相连是终点位置
|
||||
*/
|
||||
getEndAnchor(targetNode: any): Point;
|
||||
/**
|
||||
* 获取当前边的properties
|
||||
*/
|
||||
getProperties(): Record<string, any>;
|
||||
/**
|
||||
* 获取被保存时返回的数据
|
||||
*/
|
||||
getData(): EdgeData;
|
||||
/**
|
||||
* 用于在历史记录时获取节点数据,
|
||||
* 在某些情况下,如果希望某个属性变化不引起history的变化,
|
||||
* 可以重写此方法。
|
||||
*/
|
||||
getHistoryData(): EdgeData;
|
||||
setProperty(key: any, val: any): void;
|
||||
setProperties(properties: any): void;
|
||||
/**
|
||||
* 内部方法,处理初始化文本格式
|
||||
*/
|
||||
formatText(data: any): void;
|
||||
/**
|
||||
* 重置文本位置
|
||||
*/
|
||||
resetTextPosition(): void;
|
||||
/**
|
||||
* 移动边上的文本
|
||||
*/
|
||||
moveText(deltaX: number, deltaY: number): void;
|
||||
/**
|
||||
* 设置文本位置和值
|
||||
*/
|
||||
setText(textConfig: any): void;
|
||||
/**
|
||||
* 更新文本的值
|
||||
*/
|
||||
updateText(value: string): void;
|
||||
/**
|
||||
* 内部方法,计算边的起点和终点和其对于的锚点Id
|
||||
*/
|
||||
setAnchors(): void;
|
||||
setSelected(flag?: boolean): void;
|
||||
setHovered(flag?: boolean): void;
|
||||
setHitable(flag?: boolean): void;
|
||||
setElementState(state: number, additionStateData?: AdditionData): void;
|
||||
updateStartPoint(anchor: any): void;
|
||||
moveStartPoint(deltaX: any, deltaY: any): void;
|
||||
updateEndPoint(anchor: any): void;
|
||||
moveEndPoint(deltaX: any, deltaY: any): void;
|
||||
setZIndex(zindex?: number): void;
|
||||
initPoints(): void;
|
||||
updateAttributes(attributes: any): void;
|
||||
getAdjustStart(): any;
|
||||
getAdjustEnd(): any;
|
||||
updateAfterAdjustStartAndEnd({ startPoint, endPoint }: {
|
||||
startPoint: any;
|
||||
endPoint: any;
|
||||
}): void;
|
||||
}
|
||||
export { BaseEdgeModel };
|
||||
export default BaseEdgeModel;
|
||||
@@ -0,0 +1,51 @@
|
||||
import BaseEdgeModel from './BaseEdgeModel';
|
||||
import { Point } from '../../type';
|
||||
import { ModelType } from '../../constant/constant';
|
||||
export { BezierEdgeModel };
|
||||
export default class BezierEdgeModel extends BaseEdgeModel {
|
||||
modelType: ModelType;
|
||||
path: string;
|
||||
initEdgeData(data: any): void;
|
||||
getEdgeStyle(): {
|
||||
[x: string]: any;
|
||||
adjustLine?: import("../../constant/DefaultTheme").CommonTheme;
|
||||
adjustAnchor?: import("../../constant/DefaultTheme").CircleTheme;
|
||||
fill?: string;
|
||||
stroke?: string;
|
||||
strokeWidth?: number;
|
||||
};
|
||||
getTextPosition(): Point;
|
||||
getData(): {
|
||||
pointsList: {
|
||||
x: any;
|
||||
y: any;
|
||||
}[];
|
||||
id: string;
|
||||
type: string;
|
||||
sourceNodeId: string;
|
||||
startPoint: Point;
|
||||
targetNodeId: string;
|
||||
endPoint: Point;
|
||||
text?: import("../../type").TextConfig;
|
||||
properties: Record<string, unknown>;
|
||||
zIndex?: number;
|
||||
};
|
||||
private getControls;
|
||||
private getPath;
|
||||
initPoints(): void;
|
||||
updatePoints(): void;
|
||||
updatePath(sNext: any, ePre: any): void;
|
||||
updateStartPoint(anchor: any): void;
|
||||
updateEndPoint(anchor: any): void;
|
||||
moveStartPoint(deltaX: any, deltaY: any): void;
|
||||
moveEndPoint(deltaX: any, deltaY: any): void;
|
||||
updateAdjustAnchor(anchor: Point, type: string): void;
|
||||
getAdjustStart(): any;
|
||||
getAdjustEnd(): any;
|
||||
updateAfterAdjustStartAndEnd({ startPoint, endPoint, sourceNode, targetNode }: {
|
||||
startPoint: any;
|
||||
endPoint: any;
|
||||
sourceNode: any;
|
||||
targetNode: any;
|
||||
}): void;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import BaseEdgeModel from './BaseEdgeModel';
|
||||
import { Point } from '../../type';
|
||||
import { ModelType } from '../../constant/constant';
|
||||
export { LineEdgeModel };
|
||||
export default class LineEdgeModel extends BaseEdgeModel {
|
||||
modelType: ModelType;
|
||||
getEdgeStyle(): {
|
||||
[x: string]: any;
|
||||
fill?: string;
|
||||
stroke?: string;
|
||||
strokeWidth?: number;
|
||||
};
|
||||
getTextPosition(): Point;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
import { ModelType } from '../../constant/constant';
|
||||
import { Point } from '../../type';
|
||||
import BaseEdgeModel from './BaseEdgeModel';
|
||||
export { PolylineEdgeModel };
|
||||
export default class PolylineEdgeModel extends BaseEdgeModel {
|
||||
modelType: ModelType;
|
||||
draginngPointList: any;
|
||||
dbClickPosition: Point;
|
||||
initEdgeData(data: any): void;
|
||||
getEdgeStyle(): {
|
||||
[x: string]: any;
|
||||
fill?: string;
|
||||
stroke?: string;
|
||||
strokeWidth?: number;
|
||||
};
|
||||
getTextPosition(): {
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
getAfterAnchor(direction: any, position: any, anchorList: any): any;
|
||||
getCorssPoint(direction: any, start: any, end: any): any;
|
||||
removeCrossPoints(startIndex: any, endIndex: any, pointList: any): any;
|
||||
getDragingPoints(direction: any, positioType: any, position: any, anchorList: any, draginngPointList: any): any;
|
||||
updateCrossPoints(pointList: any): any;
|
||||
getData(): import("../../type").EdgeData & {
|
||||
pointsList: {
|
||||
x: any;
|
||||
y: any;
|
||||
}[];
|
||||
};
|
||||
initPoints(): void;
|
||||
updatePoints(): void;
|
||||
updateStartPoint(anchor: any): void;
|
||||
moveStartPoint(deltaX: any, deltaY: any): void;
|
||||
updateEndPoint(anchor: any): void;
|
||||
moveEndPoint(deltaX: any, deltaY: any): void;
|
||||
dragAppendStart(): void;
|
||||
dragAppendSimple(appendInfo: any, dragInfo: any): {
|
||||
start: any;
|
||||
end: any;
|
||||
startIndex: any;
|
||||
endIndex: any;
|
||||
direction: any;
|
||||
};
|
||||
dragAppend(appendInfo: any, dragInfo: any): {
|
||||
start: any;
|
||||
end: any;
|
||||
startIndex: any;
|
||||
endIndex: any;
|
||||
direction: any;
|
||||
};
|
||||
dragAppendEnd(): void;
|
||||
updatePointsAfterDrage(pointsList: any): void;
|
||||
getAdjustStart(): any;
|
||||
getAdjustEnd(): any;
|
||||
updateAfterAdjustStartAndEnd({ startPoint, endPoint, sourceNode, targetNode }: {
|
||||
startPoint: any;
|
||||
endPoint: any;
|
||||
sourceNode: any;
|
||||
targetNode: any;
|
||||
}): void;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export * from './BaseEdgeModel';
|
||||
export * from './BezierEdgeModel';
|
||||
export * from './LineEdgeModel';
|
||||
export * from './PolylineEdgeModel';
|
||||
@@ -0,0 +1,7 @@
|
||||
export * from './edge';
|
||||
export * from './node';
|
||||
export * from './BaseModel';
|
||||
export * from './EditConfigModel';
|
||||
export * from './GraphModel';
|
||||
export * from './SnaplineModel';
|
||||
export * from './TransformModel';
|
||||
@@ -0,0 +1,197 @@
|
||||
import { OutlineTheme } from '../../constant/DefaultTheme';
|
||||
import { ModelType, ElementType } from '../../constant/constant';
|
||||
import { AdditionData, NodeData, NodeConfig, NodeMoveRule, Bounds, AnchorConfig, PointAnchor, AnchorsOffsetItem, ShapeStyleAttribute, IsAllowMove } from '../../type';
|
||||
import GraphModel from '../GraphModel';
|
||||
import { IBaseModel } from '../BaseModel';
|
||||
import { BaseEdgeModel } from '../edge';
|
||||
export declare type ConnectRule = {
|
||||
message: string;
|
||||
validate: (source?: BaseNodeModel, target?: BaseNodeModel, sourceAnchor?: AnchorConfig, targetAnchor?: AnchorConfig) => boolean;
|
||||
};
|
||||
export declare type ConnectRuleResult = {
|
||||
isAllPass: boolean;
|
||||
msg?: string;
|
||||
};
|
||||
interface IBaseNodeModel extends IBaseModel {
|
||||
/**
|
||||
* model基础类型,固定为node
|
||||
*/
|
||||
readonly BaseType: ElementType.NODE;
|
||||
}
|
||||
export { BaseNodeModel };
|
||||
export default class BaseNodeModel implements IBaseNodeModel {
|
||||
id: string;
|
||||
type: string;
|
||||
x: number;
|
||||
y: number;
|
||||
text: {
|
||||
value: string;
|
||||
x: number;
|
||||
y: number;
|
||||
draggable: boolean;
|
||||
editable: boolean;
|
||||
};
|
||||
properties: Record<string, any>;
|
||||
private _width;
|
||||
get width(): number;
|
||||
set width(value: number);
|
||||
private _height;
|
||||
get height(): number;
|
||||
set height(value: number);
|
||||
anchorsOffset: AnchorsOffsetItem[];
|
||||
isSelected: boolean;
|
||||
isHovered: boolean;
|
||||
isDragging: boolean;
|
||||
isHitable: boolean;
|
||||
draggable: boolean;
|
||||
visible: boolean;
|
||||
graphModel: GraphModel;
|
||||
zIndex: number;
|
||||
state: number;
|
||||
autoToFront: boolean;
|
||||
readonly BaseType = ElementType.NODE;
|
||||
modelType: ModelType;
|
||||
additionStateData: AdditionData;
|
||||
targetRules: ConnectRule[];
|
||||
sourceRules: ConnectRule[];
|
||||
moveRules: NodeMoveRule[];
|
||||
hasSetTargetRules: boolean;
|
||||
hasSetSourceRules: boolean;
|
||||
[propName: string]: any;
|
||||
constructor(data: NodeConfig, graphModel: GraphModel);
|
||||
/**
|
||||
* 获取进入当前节点的边和节点
|
||||
*/
|
||||
get incoming(): {
|
||||
nodes: BaseNodeModel[];
|
||||
edges: BaseEdgeModel[];
|
||||
};
|
||||
get outgoing(): {
|
||||
nodes: BaseNodeModel[];
|
||||
edges: BaseEdgeModel[];
|
||||
};
|
||||
/**
|
||||
* @overridable 可以重写
|
||||
* 初始化节点数据
|
||||
* initNodeData和setAttributes的区别在于
|
||||
* initNodeData只在节点初始化的时候调用,用于初始化节点的所有属性。
|
||||
* setAttributes除了初始化调用外,还会在properties发生变化了调用。
|
||||
*/
|
||||
initNodeData(data: any): void;
|
||||
/**
|
||||
* 设置model属性,每次properties发生变化会触发
|
||||
* 例如设置节点的宽度
|
||||
* @example
|
||||
*
|
||||
* setAttributes () {
|
||||
* this.width = 300
|
||||
* this.height = 200
|
||||
* }
|
||||
*
|
||||
* @overridable 支持重写
|
||||
*/
|
||||
setAttributes(): void;
|
||||
/**
|
||||
* @overridable 支持重写,自定义此类型节点默认生成方式
|
||||
* @returns string
|
||||
*/
|
||||
createId(): string;
|
||||
/**
|
||||
* 初始化文本属性
|
||||
*/
|
||||
private formatText;
|
||||
/**
|
||||
* 获取被保存时返回的数据
|
||||
* @overridable 支持重写
|
||||
*/
|
||||
getData(): NodeData;
|
||||
/**
|
||||
* 用于在历史记录时获取节点数据,
|
||||
* 在某些情况下,如果希望某个属性变化不引起history的变化,
|
||||
* 可以重写此方法。
|
||||
*/
|
||||
getHistoryData(): NodeData;
|
||||
/**
|
||||
* 获取当前节点的properties
|
||||
*/
|
||||
getProperties(): Record<string, any>;
|
||||
/**
|
||||
* @overridable 支持重写
|
||||
* 获取当前节点样式
|
||||
* @returns 自定义节点样式
|
||||
*/
|
||||
getNodeStyle(): ShapeStyleAttribute;
|
||||
/**
|
||||
* @overridable 支持重写
|
||||
* 获取当前节点文本样式
|
||||
*/
|
||||
getTextStyle(): import("../../constant/DefaultTheme").NodeTextTheme;
|
||||
/**
|
||||
* @overridable 支持重写
|
||||
* 获取当前节点锚点样式
|
||||
* @returns 自定义样式
|
||||
*/
|
||||
getAnchorStyle(anchorInfo: any): Record<string, any>;
|
||||
/**
|
||||
* @overridable 支持重写
|
||||
* 获取当前节点锚点拖出连线样式
|
||||
* @returns 自定义锚点拖出样式
|
||||
*/
|
||||
getAnchorLineStyle(): import("../../constant/DefaultTheme").CommonTheme;
|
||||
/**
|
||||
* @overridable 支持重写
|
||||
* 获取outline样式,重写可以定义此类型节点outline样式, 默认使用主题样式
|
||||
* @returns 自定义outline样式
|
||||
*/
|
||||
getOutlineStyle(): OutlineTheme;
|
||||
/**
|
||||
* @over
|
||||
* 在边的时候,是否允许这个节点为source节点,边到target节点。
|
||||
*/
|
||||
isAllowConnectedAsSource(target: BaseNodeModel, soureAnchor: AnchorConfig, targetAnchor: AnchorConfig): ConnectRuleResult | Boolean;
|
||||
/**
|
||||
* 获取当前节点作为连接的起始节点规则。
|
||||
*/
|
||||
getConnectedSourceRules(): ConnectRule[];
|
||||
/**
|
||||
* 在连线的时候,是否允许这个节点为target节点
|
||||
*/
|
||||
isAllowConnectedAsTarget(source: BaseNodeModel, soureAnchor: AnchorConfig, targetAnchor: AnchorConfig): ConnectRuleResult | Boolean;
|
||||
/**
|
||||
* 内部方法
|
||||
* 是否允许移动节点到新的位置
|
||||
*/
|
||||
isAllowMoveNode(deltaX: any, deltaY: any): boolean | IsAllowMove;
|
||||
/**
|
||||
* 获取作为连线终点时的所有规则。
|
||||
*/
|
||||
getConnectedTargetRules(): ConnectRule[];
|
||||
/**
|
||||
* @returns Point[] 锚点坐标构成的数组
|
||||
*/
|
||||
getAnchorsByOffset(): PointAnchor[];
|
||||
/**
|
||||
* @overridable 子类重写此方法设置默认锚点
|
||||
* 获取节点默认情况下的锚点
|
||||
*/
|
||||
getDefaultAnchor(): PointAnchor[];
|
||||
/**
|
||||
* 获取节点BBox
|
||||
*/
|
||||
getBounds(): Bounds;
|
||||
get anchors(): PointAnchor[];
|
||||
getAnchorInfo(anchorId: string): PointAnchor;
|
||||
addNodeMoveRules(fn: NodeMoveRule): void;
|
||||
move(deltaX: any, deltaY: any, isignoreRule?: boolean): boolean;
|
||||
moveTo(x: any, y: any, isignoreRule?: boolean): boolean;
|
||||
moveText(deltaX: any, deltaY: any): void;
|
||||
updateText(value: string): void;
|
||||
setSelected(flag?: boolean): void;
|
||||
setHovered(flag?: boolean): void;
|
||||
setHitable(flag?: boolean): void;
|
||||
setElementState(state: number, additionStateData?: AdditionData): void;
|
||||
setProperty(key: any, val: any): void;
|
||||
setProperties(properties: any): void;
|
||||
setZIndex(zindex?: number): void;
|
||||
updateAttributes(attributes: any): void;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import BaseNodeModel from './BaseNodeModel';
|
||||
import { ModelType } from '../../constant/constant';
|
||||
declare class CircleNodeModel extends BaseNodeModel {
|
||||
modelType: ModelType;
|
||||
r: number;
|
||||
get width(): number;
|
||||
get height(): number;
|
||||
getNodeStyle(): {
|
||||
[x: string]: any;
|
||||
r?: number;
|
||||
fill?: string;
|
||||
stroke?: string;
|
||||
strokeWidth?: number;
|
||||
};
|
||||
getDefaultAnchor(): {
|
||||
x: number;
|
||||
y: number;
|
||||
id: string;
|
||||
}[];
|
||||
}
|
||||
export { CircleNodeModel };
|
||||
export default CircleNodeModel;
|
||||
@@ -0,0 +1,25 @@
|
||||
import { Point, PointTuple } from '../../type';
|
||||
import BaseNodeModel from './BaseNodeModel';
|
||||
import { ModelType } from '../../constant/constant';
|
||||
declare class DiamondNodeModel extends BaseNodeModel {
|
||||
modelType: ModelType;
|
||||
rx: number;
|
||||
ry: number;
|
||||
getNodeStyle(): {
|
||||
[x: string]: any;
|
||||
fill?: string;
|
||||
stroke?: string;
|
||||
strokeWidth?: number;
|
||||
};
|
||||
get points(): PointTuple[];
|
||||
get pointsPosition(): Point[];
|
||||
get width(): number;
|
||||
get height(): number;
|
||||
getDefaultAnchor(): {
|
||||
x: number;
|
||||
y: number;
|
||||
id: string;
|
||||
}[];
|
||||
}
|
||||
export { DiamondNodeModel };
|
||||
export default DiamondNodeModel;
|
||||
@@ -0,0 +1,22 @@
|
||||
import BaseNodeModel from './BaseNodeModel';
|
||||
import { ModelType } from '../../constant/constant';
|
||||
declare class EllipseNodeModel extends BaseNodeModel {
|
||||
modelType: ModelType;
|
||||
rx: number;
|
||||
ry: number;
|
||||
getNodeStyle(): {
|
||||
[x: string]: any;
|
||||
fill?: string;
|
||||
stroke?: string;
|
||||
strokeWidth?: number;
|
||||
};
|
||||
get width(): number;
|
||||
get height(): number;
|
||||
getDefaultAnchor(): {
|
||||
x: number;
|
||||
y: number;
|
||||
id: string;
|
||||
}[];
|
||||
}
|
||||
export { EllipseNodeModel };
|
||||
export default EllipseNodeModel;
|
||||
@@ -0,0 +1,12 @@
|
||||
import BaseNodeModel from './BaseNodeModel';
|
||||
import { ModelType } from '../../constant/constant';
|
||||
declare class HtmlNodeModel extends BaseNodeModel {
|
||||
modelType: ModelType;
|
||||
getDefaultAnchor(): {
|
||||
x: number;
|
||||
y: number;
|
||||
id: string;
|
||||
}[];
|
||||
}
|
||||
export { HtmlNodeModel };
|
||||
export default HtmlNodeModel;
|
||||
@@ -0,0 +1,28 @@
|
||||
import { Point, PointTuple } from '../../type';
|
||||
import BaseNodeModel from './BaseNodeModel';
|
||||
import { ModelType } from '../../constant/constant';
|
||||
declare class PolygonNodeModel extends BaseNodeModel {
|
||||
modelType: ModelType;
|
||||
points: PointTuple[];
|
||||
getNodeStyle(): {
|
||||
[x: string]: any;
|
||||
fill?: string;
|
||||
stroke?: string;
|
||||
strokeWidth?: number;
|
||||
};
|
||||
/**
|
||||
* 由于大多数情况下,我们初始化拿到的多边形坐标都是基于原点的(例如绘图工具到处的svg)。
|
||||
* 在logicflow中对多边形进行移动,我们不需要去更新points,
|
||||
* 而是去更新多边形中心点即可。
|
||||
*/
|
||||
get pointsPosition(): Point[];
|
||||
get width(): number;
|
||||
get height(): number;
|
||||
getDefaultAnchor(): {
|
||||
x: number;
|
||||
y: number;
|
||||
id: string;
|
||||
}[];
|
||||
}
|
||||
export { PolygonNodeModel };
|
||||
export default PolygonNodeModel;
|
||||
@@ -0,0 +1,22 @@
|
||||
import BaseNodeModel from './BaseNodeModel';
|
||||
import { ModelType } from '../../constant/constant';
|
||||
declare class RectNodeModel extends BaseNodeModel {
|
||||
modelType: ModelType;
|
||||
radius: number;
|
||||
getDefaultAnchor(): {
|
||||
x: number;
|
||||
y: number;
|
||||
id: string;
|
||||
}[];
|
||||
getNodeStyle(): {
|
||||
[x: string]: any;
|
||||
width?: number;
|
||||
height?: number;
|
||||
radius?: number;
|
||||
fill?: string;
|
||||
stroke?: string;
|
||||
strokeWidth?: number;
|
||||
};
|
||||
}
|
||||
export { RectNodeModel };
|
||||
export default RectNodeModel;
|
||||
@@ -0,0 +1,19 @@
|
||||
import BaseNodeModel from './BaseNodeModel';
|
||||
import { ModelType } from '../../constant/constant';
|
||||
declare class TextNodeModel extends BaseNodeModel {
|
||||
modelType: ModelType;
|
||||
getTextStyle(): {
|
||||
[x: string]: any;
|
||||
color?: string;
|
||||
fontSize?: number;
|
||||
fill?: string;
|
||||
stroke?: string;
|
||||
strokeWidth?: number;
|
||||
overflowMode?: string;
|
||||
background?: import("../../constant/DefaultTheme").RectTheme;
|
||||
};
|
||||
get width(): number;
|
||||
get height(): number;
|
||||
}
|
||||
export { TextNodeModel };
|
||||
export default TextNodeModel;
|
||||
@@ -0,0 +1,8 @@
|
||||
export * from './BaseNodeModel';
|
||||
export * from './CircleNodeModel';
|
||||
export * from './DiamondNodeModel';
|
||||
export * from './EllipseNodeModel';
|
||||
export * from './PolygonNodeModel';
|
||||
export * from './RectNodeModel';
|
||||
export * from './TextNodeModel';
|
||||
export * from './HtmlNodeModel';
|
||||
+202
@@ -0,0 +1,202 @@
|
||||
import { GridOptions } from './view/overlay/Grid';
|
||||
import { BackgroundConfig } from './view/overlay/BackgroundOverlay';
|
||||
import { NodeData, EdgeData, Extension, GraphConfigData } from './type';
|
||||
import { KeyboardDef } from './keyboard';
|
||||
import { EditConfigInterface } from './model/EditConfigModel';
|
||||
import { Theme } from './constant/DefaultTheme';
|
||||
import { AnimationConfig } from './constant/DefaultAnimation';
|
||||
export declare type EdgeType = 'line' | 'polyline' | 'bezier' | any;
|
||||
declare type DefaultOverlapMode = 0;
|
||||
declare type IncreaseOverlapMode = 1;
|
||||
/**
|
||||
* 元素重叠处理方式
|
||||
* 0:表示节点在上,边在下,点击元素时选择元素显示在最顶部。
|
||||
* 1:表示安装元素创建顺序排序,点击元素也不会将其置顶。要置顶需要调用置顶API。
|
||||
*/
|
||||
export declare type OverlapMode = DefaultOverlapMode | IncreaseOverlapMode;
|
||||
export declare type Definition = {
|
||||
/**
|
||||
* 画布初始化容器
|
||||
* 注意,在不传入width和height的情况下,container元素本身应该存在高度和高度。
|
||||
*/
|
||||
container: HTMLElement;
|
||||
/**
|
||||
* 画布宽度,不传则默认100%
|
||||
*/
|
||||
width?: number;
|
||||
/**
|
||||
* 画布高度,不传则默认100%
|
||||
*/
|
||||
height?: number;
|
||||
/**
|
||||
* 背景图
|
||||
*/
|
||||
background?: false | BackgroundConfig;
|
||||
/**
|
||||
* 网格
|
||||
*/
|
||||
grid?: boolean | GridOptions;
|
||||
/**
|
||||
* 键盘快捷操作
|
||||
*/
|
||||
keyboard?: KeyboardDef;
|
||||
/**
|
||||
* 主题配置
|
||||
*/
|
||||
style?: Theme;
|
||||
/**
|
||||
* 禁止初始化的插件名称
|
||||
*/
|
||||
disabledPlugins?: string[];
|
||||
/**
|
||||
* 默认边类型
|
||||
*/
|
||||
edgeType?: EdgeType;
|
||||
/**
|
||||
* 是否开启对齐线,默认开启
|
||||
*/
|
||||
snapline?: boolean;
|
||||
/**
|
||||
* 是否开启历史记录功能,默认开启
|
||||
*/
|
||||
history?: boolean;
|
||||
/**
|
||||
* 是否开启局部渲染,默认不开启
|
||||
*/
|
||||
partial?: boolean;
|
||||
/**
|
||||
* 删除和克隆之前的判断函数
|
||||
* todo: 目前不完善,仅支持同步
|
||||
*/
|
||||
guards?: GuardsTypes;
|
||||
/**
|
||||
* 表示节点在上,边在下,点击元素时选择元素显示在最顶部。
|
||||
* 表示安装元素创建顺序排序,点击元素也不会将其置顶。要置顶需要调用置顶API。
|
||||
*/
|
||||
overlapMode?: OverlapMode;
|
||||
/**
|
||||
* 自定义创建节点、连线时生成id规则。
|
||||
* @param type 节点、连线类型
|
||||
*/
|
||||
idGenerator?: (type?: string) => string;
|
||||
/**
|
||||
* 禁止启用的内置工具
|
||||
* 有些场景下,需要自定义多选效果或者文本编辑效果,则需要禁用这些内置的工具
|
||||
* multipleSelect和textEdit
|
||||
* todo: 将multipleSelect放到插件中
|
||||
*/
|
||||
disabledTools?: string[];
|
||||
/**
|
||||
* 是否配置个性插件,覆盖全局配置的插件
|
||||
*/
|
||||
plugins?: Extension[];
|
||||
/**
|
||||
* 控制是否开启动画
|
||||
* false: 关闭所有动画
|
||||
* true: 开启所有动画
|
||||
* AnimationConfig: 配置部分动画开启
|
||||
*/
|
||||
animation?: boolean | Partial<AnimationConfig>;
|
||||
[key: string]: any;
|
||||
} & EditConfigInterface;
|
||||
export interface GuardsTypes {
|
||||
beforeClone?: (data: NodeData | GraphConfigData) => boolean;
|
||||
beforeDelete?: (data: NodeData | EdgeData) => boolean;
|
||||
}
|
||||
export declare function get(options: Definition): {
|
||||
background: boolean;
|
||||
grid: boolean;
|
||||
textEdit: boolean;
|
||||
disabledTools: any[];
|
||||
} & {
|
||||
[key: string]: any;
|
||||
/**
|
||||
* 画布初始化容器
|
||||
* 注意,在不传入width和height的情况下,container元素本身应该存在高度和高度。
|
||||
*/
|
||||
container: HTMLElement;
|
||||
/**
|
||||
* 画布宽度,不传则默认100%
|
||||
*/
|
||||
width?: number;
|
||||
/**
|
||||
* 画布高度,不传则默认100%
|
||||
*/
|
||||
height?: number;
|
||||
/**
|
||||
* 背景图
|
||||
*/
|
||||
background?: false | BackgroundConfig;
|
||||
/**
|
||||
* 网格
|
||||
*/
|
||||
grid?: boolean | GridOptions;
|
||||
/**
|
||||
* 键盘快捷操作
|
||||
*/
|
||||
keyboard?: KeyboardDef;
|
||||
/**
|
||||
* 主题配置
|
||||
*/
|
||||
style?: Theme;
|
||||
/**
|
||||
* 禁止初始化的插件名称
|
||||
*/
|
||||
disabledPlugins?: string[];
|
||||
/**
|
||||
* 默认边类型
|
||||
*/
|
||||
edgeType?: any;
|
||||
/**
|
||||
* 是否开启对齐线,默认开启
|
||||
*/
|
||||
snapline?: boolean;
|
||||
/**
|
||||
* 是否开启历史记录功能,默认开启
|
||||
*/
|
||||
history?: boolean;
|
||||
/**
|
||||
* 是否开启局部渲染,默认不开启
|
||||
*/
|
||||
partial?: boolean;
|
||||
/**
|
||||
* 删除和克隆之前的判断函数
|
||||
* todo: 目前不完善,仅支持同步
|
||||
*/
|
||||
guards?: GuardsTypes;
|
||||
/**
|
||||
* 表示节点在上,边在下,点击元素时选择元素显示在最顶部。
|
||||
* 表示安装元素创建顺序排序,点击元素也不会将其置顶。要置顶需要调用置顶API。
|
||||
*/
|
||||
overlapMode?: OverlapMode;
|
||||
/**
|
||||
* 自定义创建节点、连线时生成id规则。
|
||||
* @param type 节点、连线类型
|
||||
*/
|
||||
idGenerator?: (type?: string) => string;
|
||||
/**
|
||||
* 禁止启用的内置工具
|
||||
* 有些场景下,需要自定义多选效果或者文本编辑效果,则需要禁用这些内置的工具
|
||||
* multipleSelect和textEdit
|
||||
* todo: 将multipleSelect放到插件中
|
||||
*/
|
||||
disabledTools?: string[];
|
||||
/**
|
||||
* 是否配置个性插件,覆盖全局配置的插件
|
||||
*/
|
||||
plugins?: Extension[];
|
||||
/**
|
||||
* 控制是否开启动画
|
||||
* false: 关闭所有动画
|
||||
* true: 开启所有动画
|
||||
* AnimationConfig: 配置部分动画开启
|
||||
*/
|
||||
animation?: boolean | Partial<AnimationConfig>;
|
||||
} & EditConfigInterface;
|
||||
export declare const defaults: {
|
||||
background: boolean;
|
||||
grid: boolean;
|
||||
textEdit: boolean;
|
||||
disabledTools: any[];
|
||||
};
|
||||
export {};
|
||||
@@ -0,0 +1,20 @@
|
||||
import { h, Component } from 'preact';
|
||||
import LogicFlow from '../LogicFlow';
|
||||
import GraphModel from '../model/GraphModel';
|
||||
declare type IProps = {
|
||||
graphModel: GraphModel;
|
||||
logicFlow: LogicFlow;
|
||||
};
|
||||
export default class MultipleSelect extends Component<IProps> {
|
||||
static toolName: string;
|
||||
stepDrag: any;
|
||||
constructor(props: any);
|
||||
handleMouseDown: (ev: MouseEvent) => void;
|
||||
onDraging: ({ deltaX, deltaY }: {
|
||||
deltaX: any;
|
||||
deltaY: any;
|
||||
}) => void;
|
||||
handleContextMenu: (ev: MouseEvent) => void;
|
||||
render(): h.JSX.Element;
|
||||
}
|
||||
export {};
|
||||
@@ -0,0 +1,3 @@
|
||||
import EventEmitter from '../event/eventEmitter';
|
||||
import SnaplineModel from '../model/SnaplineModel';
|
||||
export declare function snaplineTool(eventCenter: EventEmitter, snaplineModel: SnaplineModel): void;
|
||||
@@ -0,0 +1,34 @@
|
||||
import { h, Component } from 'preact';
|
||||
import LogicFlow from '../LogicFlow';
|
||||
import GraphModel from '../model/GraphModel';
|
||||
declare type Style = {
|
||||
left: number;
|
||||
top: number;
|
||||
};
|
||||
declare type IProps = {
|
||||
graphModel: GraphModel;
|
||||
logicFlow: LogicFlow;
|
||||
};
|
||||
declare type IState = {
|
||||
style: Style;
|
||||
};
|
||||
export default class TextEdit extends Component<IProps, IState> {
|
||||
static toolName: string;
|
||||
ref: import("preact").RefObject<any>;
|
||||
__prevText: {
|
||||
type: string;
|
||||
text: string;
|
||||
id: string;
|
||||
};
|
||||
constructor();
|
||||
componentDidMount(): void;
|
||||
static getDerivedStateFromProps(props: any): {
|
||||
style: any;
|
||||
};
|
||||
componentDidUpdate(): void;
|
||||
keyupHandler: (ev: any) => void;
|
||||
inputHandler: (ev: any) => void;
|
||||
placeCaretAtEnd(el: any): void;
|
||||
render(): h.JSX.Element;
|
||||
}
|
||||
export {};
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
import { Component } from 'preact';
|
||||
import LogicFlow from '../LogicFlow';
|
||||
export default class Tool {
|
||||
tools: Component[];
|
||||
components: Component[];
|
||||
toolMap: Map<any, any>;
|
||||
instance: LogicFlow;
|
||||
constructor(instance: LogicFlow);
|
||||
private isDisabledTool;
|
||||
registerTool(name: any, component: any): void;
|
||||
getTools(): any[];
|
||||
getInstance(): LogicFlow;
|
||||
}
|
||||
+385
@@ -0,0 +1,385 @@
|
||||
import { h } from 'preact';
|
||||
import LogicFlow from '../LogicFlow';
|
||||
import BaseEdge from '../view/edge/BaseEdge';
|
||||
import BaseEdgeModel from '../model/edge/BaseEdgeModel';
|
||||
import BaseNode from '../view/node/BaseNode';
|
||||
import BaseNodeModel from '../model/node/BaseNodeModel';
|
||||
import RectNodeModel from '../model/node/RectNodeModel';
|
||||
import RectNode from '../view/node/RectNode';
|
||||
import CircleNode from '../view/node/CircleNode';
|
||||
import CircleNodeModel from '../model/node/CircleNodeModel';
|
||||
import DiamondNode from '../view/node/DiamondNode';
|
||||
import DiamondNodeModel from '../model/node/DiamondNodeModel';
|
||||
import PolygonNode from '../view/node/PolygonNode';
|
||||
import PolygonNodeModel from '../model/node/PolygonNodeModel';
|
||||
import TextNodeModel from '../model/node/TextNodeModel';
|
||||
import TextNode from '../view/node/TextNode';
|
||||
import LineEdge from '../view/edge/LineEdge';
|
||||
import LineEdgeModel from '../model/edge/LineEdgeModel';
|
||||
import PolylineEdge from '../view/edge/PolylineEdge';
|
||||
import PolylineEdgeModel from '../model/edge/PolylineEdgeModel';
|
||||
import EllipseNode from '../view/node/EllipseNode';
|
||||
import EllipseNodeModel from '../model/node/EllipseNodeModel';
|
||||
import HtmlNode from '../view/node/HtmlNode';
|
||||
import HtmlNodeModel from '../model/node/HtmlNodeModel';
|
||||
import * as Options from '../options';
|
||||
import { CommonTheme, EdgeTextTheme } from '../constant/DefaultTheme';
|
||||
export declare type PointTuple = [number, number];
|
||||
export declare type Point = {
|
||||
id?: string;
|
||||
x: number;
|
||||
y: number;
|
||||
[key: string]: unknown;
|
||||
};
|
||||
/**
|
||||
* 锚点坐标
|
||||
* 为了方便计算
|
||||
* 锚点的位置都是相对于节点中心点的偏移量。
|
||||
*/
|
||||
export declare type PointAnchor = {
|
||||
/**
|
||||
* 锚点x轴相对于中心点的偏移量
|
||||
*/
|
||||
x: number;
|
||||
/**
|
||||
* 锚点y轴相对于中心点的偏移量
|
||||
*/
|
||||
y: number;
|
||||
/**
|
||||
* 锚点Id
|
||||
*/
|
||||
id?: string;
|
||||
[key: string]: unknown;
|
||||
};
|
||||
export declare type AnchorsOffsetItem = PointTuple | PointAnchor;
|
||||
export declare type Size = {
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
export declare type TextConfig = {
|
||||
value: string;
|
||||
} & Point;
|
||||
export declare type GraphConfigData = {
|
||||
nodes: NodeConfig[];
|
||||
edges: EdgeConfig[];
|
||||
};
|
||||
export declare type NodeConfig = {
|
||||
id?: string;
|
||||
type: string;
|
||||
x: number;
|
||||
y: number;
|
||||
text?: TextConfig | string;
|
||||
zIndex?: number;
|
||||
properties?: Record<string, unknown>;
|
||||
};
|
||||
export declare type NodeData = {
|
||||
id: string;
|
||||
type: string;
|
||||
x: number;
|
||||
y: number;
|
||||
text?: TextConfig;
|
||||
properties: Record<string, unknown>;
|
||||
zIndex?: number;
|
||||
[key: string]: any;
|
||||
};
|
||||
export declare type NodeAttribute = {
|
||||
id: string;
|
||||
type?: string;
|
||||
x?: number;
|
||||
y?: number;
|
||||
text?: TextConfig;
|
||||
properties?: Record<string, unknown>;
|
||||
};
|
||||
export declare type MenuConfig = {
|
||||
text?: string;
|
||||
className?: string;
|
||||
icon?: boolean;
|
||||
callback: (id: any) => void;
|
||||
};
|
||||
export declare type AdditionData = Record<string, unknown>;
|
||||
export declare type EdgeData = {
|
||||
id: string;
|
||||
type: string;
|
||||
sourceNodeId: string;
|
||||
startPoint: Point;
|
||||
targetNodeId: string;
|
||||
endPoint: Point;
|
||||
text?: TextConfig;
|
||||
properties: Record<string, unknown>;
|
||||
zIndex?: number;
|
||||
pointsList?: Point[];
|
||||
};
|
||||
export declare type EdgeAttribute = {
|
||||
id: string;
|
||||
type?: string;
|
||||
sourceNodeId?: string;
|
||||
startPoint?: Point;
|
||||
targetNodeId?: string;
|
||||
endPoint?: Point;
|
||||
text?: TextConfig;
|
||||
properties?: Record<string, unknown>;
|
||||
};
|
||||
export declare type EdgeFilter = {
|
||||
id?: string;
|
||||
sourceNodeId?: string;
|
||||
targetNodeId?: string;
|
||||
};
|
||||
export declare type EdgeConfig = {
|
||||
id?: string;
|
||||
/**
|
||||
* 边的类型,不传默认为lf.setDefaultEdgeType(type)传入的类型。
|
||||
* LogicFlow内部默认为polyline
|
||||
*/
|
||||
type?: string;
|
||||
sourceNodeId: string;
|
||||
sourceAnchorId?: string;
|
||||
targetNodeId: string;
|
||||
targetAnchorId?: string;
|
||||
startPoint?: {
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
endPoint?: {
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
text?: {
|
||||
x: number;
|
||||
y: number;
|
||||
value: string;
|
||||
} | string;
|
||||
pointsList?: Point[];
|
||||
zIndex?: number;
|
||||
properties?: Record<string, unknown>;
|
||||
};
|
||||
declare type LeftTopX = number;
|
||||
declare type LeftTopY = number;
|
||||
declare type RightBottomX = number;
|
||||
declare type RightBottomY = number;
|
||||
export declare type Bounds = {
|
||||
x1: LeftTopX;
|
||||
y1: LeftTopY;
|
||||
x2: RightBottomX;
|
||||
y2: RightBottomY;
|
||||
};
|
||||
export declare type CommonStyle = {
|
||||
fill?: string;
|
||||
stroke?: string;
|
||||
strokeWidth?: number;
|
||||
fillOpacity?: number;
|
||||
strokeOpacity?: number;
|
||||
opacity?: number;
|
||||
outlineColor?: string;
|
||||
outlineStrokeDashArray?: string;
|
||||
};
|
||||
export declare type RectStyle = CommonStyle & {
|
||||
width?: number;
|
||||
height?: number;
|
||||
radius?: number;
|
||||
};
|
||||
export declare type CircleStyle = CommonStyle & {
|
||||
r?: number;
|
||||
};
|
||||
export declare type EllipseStyle = CommonStyle & {
|
||||
rx?: number;
|
||||
ry?: number;
|
||||
};
|
||||
export declare type DiamondStyle = CommonStyle;
|
||||
export declare type PolygonStyle = CommonStyle;
|
||||
export declare type AnchorStyle = CommonStyle & {
|
||||
stroke?: string;
|
||||
strokeWidth?: number;
|
||||
r?: number;
|
||||
};
|
||||
export declare type AnchorLineStyle = {
|
||||
stroke?: string;
|
||||
strokeWidth?: number;
|
||||
strokeDasharray?: string;
|
||||
};
|
||||
export declare type AnchorHoverStyle = {
|
||||
fill?: string;
|
||||
fillOpacity?: number;
|
||||
stroke?: string;
|
||||
strokeWidth?: number;
|
||||
r?: number;
|
||||
};
|
||||
export declare type EdgeStyle = {
|
||||
stroke?: string;
|
||||
strokeWidth?: number;
|
||||
strokeDashArray?: string;
|
||||
hoverStroke?: string;
|
||||
selectedStroke?: string;
|
||||
outlineColor?: string;
|
||||
outlineStrokeDashArray?: string;
|
||||
};
|
||||
export declare type LineStyle = EdgeStyle;
|
||||
export declare type PolylineStyle = EdgeStyle & {
|
||||
offset?: number;
|
||||
};
|
||||
export declare type BezierStyle = EdgeStyle & {
|
||||
offset?: number;
|
||||
adjustLineColor?: string;
|
||||
adjustAnchorStroke?: string;
|
||||
adjustAnchorFill?: string;
|
||||
adjustAnchorFillOpacity?: number;
|
||||
};
|
||||
export declare type TextStyle = {
|
||||
color?: string;
|
||||
fontSize?: number;
|
||||
fontWeight?: string;
|
||||
fontFamily?: string;
|
||||
};
|
||||
export declare type NodeTextStyle = TextStyle & {
|
||||
lineHeight?: number;
|
||||
wrapPadding?: string;
|
||||
};
|
||||
export declare type EdgeTextStyle = TextStyle & EdgeTextTheme;
|
||||
export declare type ArrowStyle = {
|
||||
offset?: number;
|
||||
verticalLength?: number;
|
||||
};
|
||||
export declare type EdgeAdjustStyle = {
|
||||
r: number;
|
||||
fill?: string;
|
||||
stroke?: string;
|
||||
};
|
||||
export declare type GraphTransform = {
|
||||
transform: string;
|
||||
transformOrigin: string;
|
||||
};
|
||||
export declare type EventArgs = Record<string, number | object | string>;
|
||||
export declare type FocusOnArgs = {
|
||||
id?: string;
|
||||
coordinate?: {
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
};
|
||||
export declare type ComponentRender = (lf: LogicFlow, container: HTMLElement) => void;
|
||||
export interface Extension {
|
||||
pluginName: string;
|
||||
install?: (lf: LogicFlow, LogicFlow: LogicFlowContractor) => void;
|
||||
render?: ComponentRender;
|
||||
destroy?: () => void;
|
||||
[props: string]: any;
|
||||
}
|
||||
export declare type Direction = 'vertical' | 'horizontal';
|
||||
export declare type AppendInfo = {
|
||||
start: Point;
|
||||
end: Point;
|
||||
startIndex?: number;
|
||||
endIndex?: number;
|
||||
direction?: string;
|
||||
dragAble?: boolean;
|
||||
};
|
||||
export declare type ArrowInfo = {
|
||||
start: Point;
|
||||
end: Point;
|
||||
hover: Boolean;
|
||||
isSelected: Boolean;
|
||||
};
|
||||
export declare type IEdgeState = {
|
||||
hover: boolean;
|
||||
};
|
||||
export interface ModelContractor {
|
||||
new (data: any, graphModel: any): unknown;
|
||||
}
|
||||
export interface LogicFlowContractor {
|
||||
new (option: Options.Definition): LogicFlow;
|
||||
}
|
||||
export interface ExtensionContractor {
|
||||
pluginName: string;
|
||||
new ({ lf: LogicFlow, LogicFlow: LogicFlowContractor, }: {
|
||||
lf: any;
|
||||
LogicFlow: any;
|
||||
}): any;
|
||||
render?: Function;
|
||||
}
|
||||
export declare type RegisterBack = {
|
||||
view: Function;
|
||||
model: Function;
|
||||
};
|
||||
export interface RegisterParam {
|
||||
h: typeof h;
|
||||
BaseEdge: typeof BaseEdge;
|
||||
BaseEdgeModel: typeof BaseEdgeModel;
|
||||
BaseNode: typeof BaseNode;
|
||||
BaseNodeModel: typeof BaseNodeModel;
|
||||
RectNode: typeof RectNode;
|
||||
RectNodeModel: typeof RectNodeModel;
|
||||
CircleNode: typeof CircleNode;
|
||||
CircleNodeModel: typeof CircleNodeModel;
|
||||
DiamondNode: typeof DiamondNode;
|
||||
DiamondNodeModel: typeof DiamondNodeModel;
|
||||
PolygonNode: typeof PolygonNode;
|
||||
PolygonNodeModel: typeof PolygonNodeModel;
|
||||
TextNode: typeof TextNode;
|
||||
TextNodeModel: typeof TextNodeModel;
|
||||
LineEdge: typeof LineEdge;
|
||||
LineEdgeModel: typeof LineEdgeModel;
|
||||
PolylineEdge: typeof PolylineEdge;
|
||||
PolylineEdgeModel: typeof PolylineEdgeModel;
|
||||
EllipseNode: typeof EllipseNode;
|
||||
EllipseNodeModel: typeof EllipseNodeModel;
|
||||
HtmlNode: typeof HtmlNode;
|
||||
HtmlNodeModel: typeof HtmlNodeModel;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
export declare type RegisterElementFn = (params: RegisterParam) => RegisterBack;
|
||||
export declare type RegisterConfig = {
|
||||
type: string;
|
||||
view: any;
|
||||
model: any;
|
||||
isObserverView?: boolean;
|
||||
};
|
||||
export declare type AnchorConfig = {
|
||||
id?: string;
|
||||
x: number;
|
||||
y: number;
|
||||
[key: string]: any;
|
||||
};
|
||||
/**
|
||||
* 移动规则结果,可以支持允许水平移动,不允许垂直移动。
|
||||
* 在分组移动到边缘时有用到。
|
||||
*/
|
||||
export declare type IsAllowMove = {
|
||||
x: boolean;
|
||||
y: boolean;
|
||||
};
|
||||
/**
|
||||
* 限制节点移动规则
|
||||
* model: 移动节点的model
|
||||
* deltaX: 移动的x轴距离
|
||||
* deltaY: 移动的y轴距离
|
||||
*/
|
||||
export declare type NodeMoveRule = (model: BaseNodeModel, deltaX: number, deltaY: number) => Boolean | IsAllowMove;
|
||||
export declare type ZoomParam = boolean | number;
|
||||
export declare type NodeAttributes = {
|
||||
id: string;
|
||||
properties: Record<string, any>;
|
||||
type: string;
|
||||
x: number;
|
||||
y: number;
|
||||
isSelected: boolean;
|
||||
isHovered: boolean;
|
||||
width: number;
|
||||
height: number;
|
||||
text: {
|
||||
x: number;
|
||||
y: number;
|
||||
value: string;
|
||||
[key: string]: any;
|
||||
};
|
||||
[key: string]: any;
|
||||
};
|
||||
export declare type DiamondAttributes = {
|
||||
points: PointTuple[];
|
||||
} & NodeAttributes;
|
||||
export declare type ShapeStyleAttribute = CommonTheme;
|
||||
export declare type VirtualRectSize = {
|
||||
virtualRectWidth: number;
|
||||
virtualRectHeight: number;
|
||||
virtualRectCenterPositionX: number;
|
||||
virtualRectCenterPositionY: number;
|
||||
};
|
||||
export {};
|
||||
@@ -0,0 +1,2 @@
|
||||
import { AnimationConfig } from '../constant/DefaultAnimation';
|
||||
export declare const updateAnimation: (config: boolean | Partial<AnimationConfig>) => AnimationConfig;
|
||||
@@ -0,0 +1 @@
|
||||
export declare const isIe: boolean;
|
||||
@@ -0,0 +1 @@
|
||||
export declare const formatData: (data: any) => any;
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
import EventEmitter from '../event/eventEmitter';
|
||||
import BaseEdgeModel from '../model/edge/BaseEdgeModel';
|
||||
import BaseNodeModel from '../model/node/BaseNodeModel';
|
||||
declare function createDrag({ onDragStart, onDraging, onDragEnd, step, isStopPropagation, }: {
|
||||
onDragStart?: (...args: any[]) => void;
|
||||
onDraging?: (...args: any[]) => void;
|
||||
onDragEnd?: (...args: any[]) => void;
|
||||
step?: number;
|
||||
isStopPropagation?: boolean;
|
||||
}): (e: MouseEvent) => void;
|
||||
declare class StepDrag {
|
||||
onDragStart: Function;
|
||||
onDraging: Function;
|
||||
onDragEnd: Function;
|
||||
step: number;
|
||||
isStopPropagation: boolean;
|
||||
isDraging: boolean;
|
||||
isStartDraging: boolean;
|
||||
startX: number;
|
||||
startY: number;
|
||||
sumDeltaX: number;
|
||||
sumDeltaY: number;
|
||||
eventType: string;
|
||||
eventCenter: EventEmitter | null;
|
||||
model?: BaseNodeModel | BaseEdgeModel;
|
||||
startTime?: number;
|
||||
isGrag: boolean;
|
||||
constructor({ onDragStart, onDraging, onDragEnd, eventType, eventCenter, step, isStopPropagation, model, }: {
|
||||
onDragStart?: (...args: any[]) => void;
|
||||
onDraging?: (...args: any[]) => void;
|
||||
onDragEnd?: (...args: any[]) => void;
|
||||
eventType?: string;
|
||||
eventCenter?: any;
|
||||
step?: number;
|
||||
isStopPropagation?: boolean;
|
||||
model?: any;
|
||||
});
|
||||
setStep(step: number): void;
|
||||
handleMouseDown: (e: MouseEvent) => void;
|
||||
handleMouseMove: (e: MouseEvent) => void;
|
||||
handleMouseUp: (e: MouseEvent) => void;
|
||||
cancelDrag: () => void;
|
||||
}
|
||||
export { createDrag, StepDrag, };
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
import BaseNode from '../model/node/BaseNodeModel';
|
||||
import { Point, Direction, EdgeConfig } from '../type/index';
|
||||
export declare const setupEdgeModel: (edge: any, graphModel: any) => any;
|
||||
declare type PolyPoint = {
|
||||
x: number;
|
||||
y: number;
|
||||
id?: string;
|
||||
};
|
||||
declare type PolyPointMap = {
|
||||
[key: string]: PolyPoint;
|
||||
};
|
||||
declare type PolyPointLink = Record<PolyPoint['id'], PolyPoint['id']>;
|
||||
declare type PBBox = Partial<{
|
||||
x: number;
|
||||
y: number;
|
||||
minX: number;
|
||||
minY: number;
|
||||
maxX: number;
|
||||
maxY: number;
|
||||
height: number;
|
||||
width: number;
|
||||
centerX: number;
|
||||
centerY: number;
|
||||
}>;
|
||||
export declare const isBboxOverLapping: (b1: PBBox, b2: PBBox) => boolean;
|
||||
export declare const filterRepeatPoints: (points: PolyPoint[]) => PolyPoint[];
|
||||
export declare const getSimplePolyline: (sPoint: PolyPoint, tPoint: PolyPoint) => PolyPoint[];
|
||||
export declare const getExpandedBBox: (bbox: PBBox, offset: number) => PBBox;
|
||||
export declare const pointDirection: (point: PolyPoint, bbox: PBBox) => Direction;
|
||||
export declare const getExpandedBBoxPoint: (bbox: PBBox, point: PolyPoint) => PolyPoint;
|
||||
export declare const mergeBBox: (b1: PBBox, b2: PBBox) => PBBox;
|
||||
export declare const getBBoxOfPoints: (points?: PolyPoint[], offset?: number) => PBBox;
|
||||
export declare const getPointsFromBBox: (bbox: PBBox) => PolyPoint[];
|
||||
export declare const isPointOutsideBBox: (point: PolyPoint, bbox: PBBox) => boolean;
|
||||
export declare const getBBoxXCrossPoints: (bbox: PBBox, x: number) => PolyPoint[];
|
||||
export declare const getBBoxYCrossPoints: (bbox: PBBox, y: number) => PolyPoint[];
|
||||
export declare const getBBoxCrossPointsByPoint: (bbox: PBBox, point: PolyPoint) => PolyPoint[];
|
||||
export declare const estimateDistance: (p1: PolyPoint, p2: PolyPoint) => number;
|
||||
export declare const costByPoints: (p: PolyPoint, points: PolyPoint[]) => number;
|
||||
export declare const heuristicCostEstimate: (p: PolyPoint, ps: PolyPoint, pt: PolyPoint, source?: PolyPoint, target?: PolyPoint) => number;
|
||||
export declare const rebuildPath: (pathPoints: PolyPoint[], pointById: PolyPointMap, cameFrom: PolyPointLink, currentId: string, iterator?: number) => void;
|
||||
export declare const removeClosePointFromOpenList: (arr: PolyPoint[], item: PolyPoint) => void;
|
||||
export declare const isSegmentsIntersected: (p0: PolyPoint, p1: PolyPoint, p2: PolyPoint, p3: PolyPoint) => boolean;
|
||||
export declare const isSegmentCrossingBBox: (p1: PolyPoint, p2: PolyPoint, bbox: PBBox) => boolean;
|
||||
export declare const getNextNeighborPoints: (points: PolyPoint[], point: PolyPoint, bbox1: PBBox, bbox2: PBBox) => PolyPoint[];
|
||||
export declare const pathFinder: (points: PolyPoint[], start: PolyPoint, goal: PolyPoint, sBBox: PBBox, tBBox: PBBox, os: PolyPoint, ot: PolyPoint) => PolyPoint[];
|
||||
export declare const getBoxByOriginNode: (node: BaseNode) => PBBox;
|
||||
export declare const pointFilter: (points: PolyPoint[]) => PolyPoint[];
|
||||
export declare const getPolylinePoints: (start: PolyPoint, end: PolyPoint, sNode: BaseNode, tNode: BaseNode, offset: number) => PolyPoint[];
|
||||
/**
|
||||
* 获取折线中最长的一个线
|
||||
* @param pointsList 多个点组成的数组
|
||||
*/
|
||||
export declare const getLongestEdge: (pointsList: PolyPoint[]) => [PolyPoint, PolyPoint];
|
||||
export declare const isSegmentsInNode: (start: Point, end: Point, node: BaseNode) => boolean;
|
||||
export declare const isSegmentsCrossNode: (start: Point, end: Point, node: BaseNode) => boolean;
|
||||
export declare const getCrossPointInRect: (start: Point, end: Point, node: BaseNode) => Point;
|
||||
export declare const segmentDirection: (start: Point, end: Point) => Direction;
|
||||
export declare const points2PointsList: (points: string) => PolyPoint[];
|
||||
export declare const getSimplePoints: (start: any, end: any, sPoint: any, tPoint: any) => Point[];
|
||||
export declare const getBytesLength: (word: string) => number;
|
||||
export declare const getTextWidth: (text: any, font: any) => any;
|
||||
declare type AppendAttributesType = {
|
||||
d: string;
|
||||
fill: string;
|
||||
stroke: string;
|
||||
strokeWidth: number;
|
||||
strokeDasharray: string;
|
||||
};
|
||||
export declare const getAppendAttributes: (appendInfo: any) => AppendAttributesType;
|
||||
export declare type IBezierControls = {
|
||||
sNext: Point;
|
||||
ePre: Point;
|
||||
};
|
||||
export declare const getBezierControlPoints: ({ start, end, sourceNode, targetNode, offset, }: {
|
||||
start: any;
|
||||
end: any;
|
||||
sourceNode: any;
|
||||
targetNode: any;
|
||||
offset: any;
|
||||
}) => IBezierControls;
|
||||
export declare type IBezierPoints = {
|
||||
start: Point;
|
||||
sNext: Point;
|
||||
ePre: Point;
|
||||
end: Point;
|
||||
};
|
||||
export declare const getBezierPoints: (path: string) => Point[];
|
||||
export declare const getEndTangent: (path: string) => Point[];
|
||||
/**
|
||||
* 获取移动边后,文本位置距离边上的最近的一点
|
||||
* @param point 边上文本的位置
|
||||
* @param points 边的各个拐点
|
||||
*/
|
||||
export declare const getClosestPointOfPolyline: (point: Point, points: string) => Point;
|
||||
export declare const pickEdgeConfig: (data: any) => EdgeConfig;
|
||||
declare type Position = {
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
export declare const twoPointDistance: (source: Position, target: Position) => number;
|
||||
export {};
|
||||
@@ -0,0 +1,2 @@
|
||||
export declare function snapToGrid(distance: number, gridSize: number): number;
|
||||
export declare function getGridOffset(distance: number, gridSize: number): number;
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
export declare const getById: (id: any, data: any) => any;
|
||||
/**
|
||||
* 判断一个点是否在指定区域
|
||||
* @param point 当前点
|
||||
* @param leftTopPoint 区域左上角点
|
||||
* @param rightBottomPoint 区域的右下角点
|
||||
*/
|
||||
export declare const isPointInArea: ([x, y]: [any, any], [leftTopX, leftTopY]: [any, any], [rightBottomX, rightBottomY]: [any, any]) => boolean;
|
||||
/**
|
||||
* 判断鼠标点击选中元素的时候,是否为多选
|
||||
*/
|
||||
export declare const isMultipleSelect: (e: MouseEvent, editConfigModel: any) => boolean;
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './uuid';
|
||||
export * from './drag';
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
import BaseNode from '../model/node/BaseNodeModel';
|
||||
import { Point, Direction, NodeConfig, AnchorConfig } from '../type';
|
||||
import { GraphModel } from '..';
|
||||
export declare const getAnchors: (data: any) => Point[];
|
||||
declare type NodeContaint = {
|
||||
node: BaseNode;
|
||||
anchorIndex: number;
|
||||
anchor: AnchorConfig;
|
||||
};
|
||||
export declare const targetNodeInfo: (position: Point, graphModel: GraphModel) => NodeContaint;
|
||||
export declare const distance: (x1: number, y1: number, x2: number, y2: number) => number;
|
||||
export declare const isInNode: (position: Point, node: BaseNode) => boolean;
|
||||
export declare const isInNodeBbox: (position: Point, node: any) => boolean;
|
||||
export declare type NodeBBox = {
|
||||
x: number;
|
||||
y: number;
|
||||
width: number;
|
||||
height: number;
|
||||
minX: number;
|
||||
minY: number;
|
||||
maxX: number;
|
||||
maxY: number;
|
||||
centerX: number;
|
||||
centerY: number;
|
||||
};
|
||||
export declare const getNodeBBox: (node: BaseNode) => NodeBBox;
|
||||
declare type RadiusCircle = {
|
||||
x: number;
|
||||
y: number;
|
||||
r: number;
|
||||
};
|
||||
export declare const getRectRadiusCircle: (node: BaseNode) => RadiusCircle[];
|
||||
export declare const getClosestRadiusCenter: (point: Point, direction: Direction, node: BaseNode) => Point;
|
||||
export declare const getCrossPointWithCircle: (point: Point, direction: Direction, node: BaseNode) => Point;
|
||||
export declare const pointEdgeDirection: (point: Point, node: BaseNode) => Direction;
|
||||
export declare const inStraightLineOfRect: (point: Point, node: BaseNode) => boolean;
|
||||
export declare const getCrossPointWithEllipse: (point: Point, direction: Direction, node: BaseNode) => any;
|
||||
export declare const getCrossPointWithPolyone: (point: Point, direction: Direction, node: BaseNode) => Point;
|
||||
export declare const pickNodeConfig: (data: any) => NodeConfig;
|
||||
/**
|
||||
* 基于节点的边,重新获取新的节点
|
||||
*/
|
||||
export declare const getNodeAnchorPosition: (center: any, point: any, width: any, height: any) => {
|
||||
x: any;
|
||||
y: any;
|
||||
};
|
||||
export declare const getHtmlTextHeight: ({ rows, style, rowsLength, className }: {
|
||||
rows: any;
|
||||
style: any;
|
||||
rowsLength: any;
|
||||
className: any;
|
||||
}) => number;
|
||||
export declare const getSvgTextWidthHeight: ({ rows, rowsLength, fontSize }: {
|
||||
rows: any;
|
||||
rowsLength: any;
|
||||
fontSize: any;
|
||||
}) => {
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
/**
|
||||
* @description 格式化边校验信息
|
||||
*/
|
||||
export declare const formateAnchorConnectValidateData: (data: any) => any;
|
||||
export {};
|
||||
@@ -0,0 +1,2 @@
|
||||
export declare const createRaf: (callback: any) => string;
|
||||
export declare const cancelRaf: (rafId: any) => void;
|
||||
@@ -0,0 +1,2 @@
|
||||
import { Theme } from '../constant/DefaultTheme';
|
||||
export declare const updateTheme: (style: Theme) => Theme;
|
||||
@@ -0,0 +1,6 @@
|
||||
import { GraphConfigData } from '..';
|
||||
export declare const createUuid: () => string;
|
||||
/**
|
||||
* 重新刷新流程图的所有id
|
||||
*/
|
||||
export declare const refreshGraphId: (graphData: GraphConfigData, prefix?: string) => GraphConfigData;
|
||||
@@ -0,0 +1,2 @@
|
||||
export declare const getZIndex: () => number;
|
||||
export declare const getMinIndex: () => number;
|
||||
@@ -0,0 +1,46 @@
|
||||
import { h, Component } from 'preact';
|
||||
import { StepDrag } from '../util/drag';
|
||||
import BaseNodeModel, { ConnectRuleResult } from '../model/node/BaseNodeModel';
|
||||
import GraphModel from '../model/GraphModel';
|
||||
import { AnchorConfig } from '../type';
|
||||
import { BaseNode } from './node';
|
||||
declare type TargetNodeId = string;
|
||||
interface IProps {
|
||||
anchorData: AnchorConfig;
|
||||
node: BaseNode;
|
||||
style?: Record<string, any>;
|
||||
hoverStyle?: Record<string, any>;
|
||||
edgeStyle?: Record<string, any>;
|
||||
anchorIndex: number;
|
||||
graphModel: GraphModel;
|
||||
nodeModel: BaseNodeModel;
|
||||
setHoverOFF: Function;
|
||||
}
|
||||
interface IState {
|
||||
startX: number;
|
||||
startY: number;
|
||||
endX: number;
|
||||
endY: number;
|
||||
draging: boolean;
|
||||
}
|
||||
declare class Anchor extends Component<IProps, IState> {
|
||||
preTargetNode: BaseNodeModel;
|
||||
sourceRuleResults: Map<TargetNodeId, ConnectRuleResult>;
|
||||
targetRuleResults: Map<TargetNodeId, ConnectRuleResult>;
|
||||
dragHandler: StepDrag;
|
||||
t: any;
|
||||
constructor();
|
||||
getAnchorShape(): h.JSX.Element;
|
||||
onDragStart: ({ event }: {
|
||||
event: any;
|
||||
}) => void;
|
||||
onDraging: ({ event }: {
|
||||
event: any;
|
||||
}) => void;
|
||||
onDragEnd: (event: any) => void;
|
||||
checkEnd: () => void;
|
||||
moveAnchorEnd(endX: number, endY: number): void;
|
||||
isShowLine(): boolean;
|
||||
render(): h.JSX.Element;
|
||||
}
|
||||
export default Anchor;
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
import { Component, h } from 'preact';
|
||||
import GraphModel from '../model/GraphModel';
|
||||
import Tool from '../tool';
|
||||
import * as Options from '../options';
|
||||
import DnD from './behavior/DnD';
|
||||
import BaseEdgeModel from '../model/edge/BaseEdgeModel';
|
||||
import BaseNodeModel from '../model/node/BaseNodeModel';
|
||||
import SnaplineModel from '../model/SnaplineModel';
|
||||
declare type IProps = {
|
||||
getView: (type: string) => typeof Component;
|
||||
tool: Tool;
|
||||
options: Options.Definition;
|
||||
dnd: DnD;
|
||||
snaplineModel: SnaplineModel;
|
||||
graphModel: GraphModel;
|
||||
};
|
||||
declare class Graph extends Component<IProps> {
|
||||
getComponent(model: BaseEdgeModel | BaseNodeModel, graphModel: GraphModel, overlay?: string): h.JSX.Element;
|
||||
render(): h.JSX.Element;
|
||||
}
|
||||
export default Graph;
|
||||
@@ -0,0 +1,2 @@
|
||||
import { h } from 'preact';
|
||||
export default function Circle(props: any): h.JSX.Element;
|
||||
@@ -0,0 +1,2 @@
|
||||
import { h } from 'preact';
|
||||
export default function Ellipse(props: any): h.JSX.Element;
|
||||
@@ -0,0 +1,3 @@
|
||||
import { h } from 'preact';
|
||||
declare function Line(props: any): h.JSX.Element;
|
||||
export default Line;
|
||||
@@ -0,0 +1 @@
|
||||
export default function Rect(props: any): void;
|
||||
@@ -0,0 +1,7 @@
|
||||
import { h } from 'preact';
|
||||
declare type IProps = {
|
||||
d: string;
|
||||
[key: string]: any;
|
||||
};
|
||||
declare function Path(props: IProps): h.JSX.Element;
|
||||
export default Path;
|
||||
@@ -0,0 +1,2 @@
|
||||
import { h } from 'preact';
|
||||
export default function Polygon(props: any): h.JSX.Element;
|
||||
@@ -0,0 +1,3 @@
|
||||
import { h } from 'preact';
|
||||
declare function Polyline(props: any): h.JSX.Element;
|
||||
export default Polyline;
|
||||
@@ -0,0 +1,14 @@
|
||||
import { h } from 'preact';
|
||||
import * as type from '../../type';
|
||||
declare type IProps = {
|
||||
className?: string;
|
||||
radius?: number;
|
||||
} & type.Point & type.Size;
|
||||
declare function Rect(props: IProps): h.JSX.Element;
|
||||
declare namespace Rect {
|
||||
var defaultProps: {
|
||||
className: string;
|
||||
radius: string;
|
||||
};
|
||||
}
|
||||
export default Rect;
|
||||
@@ -0,0 +1,2 @@
|
||||
import { h } from 'preact';
|
||||
export default function Text(props: any): h.JSX.Element;
|
||||
@@ -0,0 +1 @@
|
||||
export default function Rect(props: any): void;
|
||||
@@ -0,0 +1,35 @@
|
||||
import LogicFlow from '../../LogicFlow';
|
||||
import { BaseNodeModel } from '../../model';
|
||||
import { TextConfig } from '../../type';
|
||||
export declare type NewNodeConfig = {
|
||||
type: string;
|
||||
text?: TextConfig | string;
|
||||
properties?: Record<string, unknown>;
|
||||
[key: string]: any;
|
||||
};
|
||||
export default class Dnd {
|
||||
nodeConfig: NewNodeConfig;
|
||||
lf: LogicFlow;
|
||||
fakerNode: BaseNodeModel;
|
||||
constructor(params: any);
|
||||
clientToLocalPoint({ x, y }: {
|
||||
x: any;
|
||||
y: any;
|
||||
}): {
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
startDrag(nodeConfig: NewNodeConfig): void;
|
||||
stopDrag: () => void;
|
||||
dragEnter: (e: any) => void;
|
||||
onDragOver: (e: any) => boolean;
|
||||
onDragLeave: () => void;
|
||||
onDrop: (e: any) => void;
|
||||
eventMap(): {
|
||||
onMouseEnter: (e: any) => void;
|
||||
onMouseOver: (e: any) => void;
|
||||
onMouseMove: (e: any) => boolean;
|
||||
onMouseLeave: () => void;
|
||||
onMouseUp: (e: any) => void;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import { h, Component } from 'preact';
|
||||
export default class TransfromGraph extends Component {
|
||||
render(): h.JSX.Element;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import { h, Component } from 'preact';
|
||||
export default class TransfromGraph extends Component {
|
||||
render(): h.JSX.Element;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
import { h, Component } from 'preact';
|
||||
import { BaseEdgeModel } from '../../model/edge';
|
||||
import GraphModel from '../../model/GraphModel';
|
||||
import { Point } from '../../type';
|
||||
interface IProps {
|
||||
x: number;
|
||||
y: number;
|
||||
type: AdjustType;
|
||||
id?: string;
|
||||
graphModel: GraphModel;
|
||||
edgeModel: BaseEdgeModel;
|
||||
}
|
||||
interface IState {
|
||||
draging: boolean;
|
||||
endX: number;
|
||||
endY: number;
|
||||
}
|
||||
interface OldEdge {
|
||||
startPoint: Point;
|
||||
endPoint: Point;
|
||||
pointsList: Point[];
|
||||
}
|
||||
declare enum AdjustType {
|
||||
SOURCE = "SOURCE",
|
||||
TARGET = "TARGET"
|
||||
}
|
||||
export default class AdjustPoint extends Component<IProps, IState> {
|
||||
dragHandler: Function;
|
||||
oldEdge: OldEdge;
|
||||
preTargetNode: any;
|
||||
targetRuleResults: Map<any, any>;
|
||||
sourceRuleResults: Map<any, any>;
|
||||
constructor();
|
||||
onDragStart: () => void;
|
||||
onDraging: ({ deltaX, deltaY }: {
|
||||
deltaX: any;
|
||||
deltaY: any;
|
||||
}) => void;
|
||||
onDragEnd: () => void;
|
||||
recoveryEdge: () => void;
|
||||
getAdjustPointStyle: () => import("../../constant/DefaultTheme").CircleTheme;
|
||||
isAllowAdjust(info: any): any;
|
||||
render(): h.JSX.Element;
|
||||
}
|
||||
export {};
|
||||
@@ -0,0 +1,22 @@
|
||||
import { h, Component } from 'preact';
|
||||
import { ArrowInfo } from '../../type/index';
|
||||
export declare type ArrowStyle = {
|
||||
stroke?: string;
|
||||
fill?: string;
|
||||
strokeWidth?: number;
|
||||
offset: number;
|
||||
verticalLength: number;
|
||||
};
|
||||
declare type ArrowAttributesType = {
|
||||
d: string;
|
||||
} & ArrowStyle;
|
||||
declare type IProps = {
|
||||
arrowInfo: ArrowInfo;
|
||||
style: ArrowStyle;
|
||||
};
|
||||
export default class Arrow extends Component<IProps> {
|
||||
getArrowAttributes(): ArrowAttributesType;
|
||||
getShape(): h.JSX.Element;
|
||||
render(): h.JSX.Element;
|
||||
}
|
||||
export {};
|
||||
@@ -0,0 +1,34 @@
|
||||
import { h, Component } from 'preact';
|
||||
import { ArrowStyle } from './Arrow';
|
||||
import BaseEdgeModel from '../../model/edge/BaseEdgeModel';
|
||||
import GraphModel from '../../model/GraphModel';
|
||||
import { ArrowInfo } from '../../type/index';
|
||||
declare type IProps = {
|
||||
model: BaseEdgeModel;
|
||||
graphModel: GraphModel;
|
||||
};
|
||||
export default class BaseEdge extends Component<IProps> {
|
||||
startTime: number;
|
||||
contextMenuTime: number;
|
||||
clickTimer: number;
|
||||
getShape(): void;
|
||||
getTextStyle(): void;
|
||||
getText(): "" | h.JSX.Element;
|
||||
getArrowInfo(): ArrowInfo;
|
||||
getArrowStyle(): ArrowStyle;
|
||||
getArrow(): h.JSX.Element;
|
||||
getAdjustPoints(): h.JSX.Element;
|
||||
getAnimation(): void;
|
||||
getAppendWidth(): h.JSX.Element;
|
||||
getAppend(): h.JSX.Element;
|
||||
handleHover: (hovered: any, ev: any) => void;
|
||||
setHoverON: (ev: any) => void;
|
||||
setHoverOFF: (ev: any) => void;
|
||||
handleContextMenu: (ev: MouseEvent) => void;
|
||||
handleMouseDown: (e: any) => void;
|
||||
handleMouseUp: (e: MouseEvent) => void;
|
||||
getIsDraging: () => boolean;
|
||||
toFront(): void;
|
||||
render(): h.JSX.Element;
|
||||
}
|
||||
export {};
|
||||
@@ -0,0 +1,10 @@
|
||||
import { h } from 'preact';
|
||||
import BaseEdge from './BaseEdge';
|
||||
import { ArrowInfo } from '../../type/index';
|
||||
export default class BezierEdge extends BaseEdge {
|
||||
getEdge(): h.JSX.Element;
|
||||
getShape(): h.JSX.Element;
|
||||
getAnimation(): h.JSX.Element;
|
||||
getAppendWidth(): h.JSX.Element;
|
||||
getArrowInfo(): ArrowInfo;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { h } from 'preact';
|
||||
import BaseEdge from './BaseEdge';
|
||||
export default class LineEdge extends BaseEdge {
|
||||
getEdge(): h.JSX.Element;
|
||||
getShape(): h.JSX.Element;
|
||||
getAnimation(): h.JSX.Element;
|
||||
getAppendWidth(): h.JSX.Element;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import { h } from 'preact';
|
||||
import BaseEdge from './BaseEdge';
|
||||
import { AppendInfo, ArrowInfo } from '../../type/index';
|
||||
declare type AppendAttributesType = {
|
||||
d: string;
|
||||
fill: string;
|
||||
stroke: string;
|
||||
strokeWidth: number;
|
||||
strokeDasharray: string;
|
||||
};
|
||||
export default class PolylineEdge extends BaseEdge {
|
||||
drag: any;
|
||||
isDraging: boolean;
|
||||
appendInfo: AppendInfo;
|
||||
dragHandler: (ev: MouseEvent) => void;
|
||||
constructor();
|
||||
onDragStart: () => void;
|
||||
onDraging: ({ deltaX, deltaY }: {
|
||||
deltaX: any;
|
||||
deltaY: any;
|
||||
}) => void;
|
||||
onDragEnd: () => void;
|
||||
beforeDragStart: (e: any, appendInfo: any) => void;
|
||||
getIsDraging: () => boolean;
|
||||
getEdge(): h.JSX.Element;
|
||||
getShape(): h.JSX.Element;
|
||||
getAnimation(): h.JSX.Element;
|
||||
getArrowInfo(): ArrowInfo;
|
||||
getAppendAttributes(appendInfo: AppendInfo): AppendAttributesType;
|
||||
getAppendShape(appendInfo: AppendInfo): h.JSX.Element;
|
||||
getAppendWidth(): h.JSX.Element;
|
||||
}
|
||||
export {};
|
||||
@@ -0,0 +1,6 @@
|
||||
import BaseEdge from './BaseEdge';
|
||||
import LineEdge from './LineEdge';
|
||||
import PolylineEdge from './PolylineEdge';
|
||||
import BezierEdge from './BezierEdge';
|
||||
import Arrow from './Arrow';
|
||||
export { BaseEdge, LineEdge, PolylineEdge, BezierEdge, Arrow };
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './node';
|
||||
export * from './edge';
|
||||
@@ -0,0 +1,52 @@
|
||||
import { h, Component } from 'preact';
|
||||
import GraphModel from '../../model/GraphModel';
|
||||
import BaseNodeModel from '../../model/node/BaseNodeModel';
|
||||
import { StepDrag } from '../../util/drag';
|
||||
declare type IProps = {
|
||||
model: BaseNodeModel;
|
||||
graphModel: GraphModel;
|
||||
};
|
||||
declare type Istate = {
|
||||
isHovered: boolean;
|
||||
isDraging?: boolean;
|
||||
};
|
||||
export default abstract class BaseNode extends Component<IProps, Istate> {
|
||||
t: any;
|
||||
moveOffset: {
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
static getModel(defaultModel: any): any;
|
||||
stepDrag: StepDrag;
|
||||
contextMenuTime: number;
|
||||
startTime: number;
|
||||
clickTimer: number;
|
||||
constructor(props: any);
|
||||
abstract getShape(): any;
|
||||
getAnchorShape(anchorData: any): h.JSX.Element;
|
||||
getAnchors(): h.JSX.Element[];
|
||||
getText(): "" | h.JSX.Element;
|
||||
getStateClassName(): string;
|
||||
onDragStart: ({ event: { clientX, clientY } }: {
|
||||
event: {
|
||||
clientX: any;
|
||||
clientY: any;
|
||||
};
|
||||
}) => void;
|
||||
onDraging: ({ event }: {
|
||||
event: any;
|
||||
}) => void;
|
||||
onDragEnd: () => void;
|
||||
handleClick: (e: MouseEvent) => void;
|
||||
handleContextMenu: (ev: MouseEvent) => void;
|
||||
handleMouseDown: (ev: MouseEvent) => void;
|
||||
setHoverON: (ev: any) => void;
|
||||
setHoverOFF: (ev: any) => void;
|
||||
onMouseOut: (ev: any) => void;
|
||||
/**
|
||||
* 节点置顶,可以被某些不需要置顶的节点重写,如group节点。
|
||||
*/
|
||||
toFront(): void;
|
||||
render(): any;
|
||||
}
|
||||
export {};
|
||||
@@ -0,0 +1,5 @@
|
||||
import { h } from 'preact';
|
||||
import BaseNode from './BaseNode';
|
||||
export default class CircleNode extends BaseNode {
|
||||
getShape(): h.JSX.Element;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { h } from 'preact';
|
||||
import BaseNode from './BaseNode';
|
||||
export default class DiamondNode extends BaseNode {
|
||||
getShape(): h.JSX.Element;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { h } from 'preact';
|
||||
import BaseNode from './BaseNode';
|
||||
export default class EllipseNode extends BaseNode {
|
||||
getShape(): h.JSX.Element;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import { h } from 'preact';
|
||||
import BaseNode from './BaseNode';
|
||||
export default class HtmlNode extends BaseNode {
|
||||
ref: HTMLElement;
|
||||
currrentProperties: string;
|
||||
preProperties: string;
|
||||
setRef: (dom: any) => void;
|
||||
get rootEl(): HTMLElement;
|
||||
/**
|
||||
* @overridable 支持重写
|
||||
* 自定义HTML节点内容
|
||||
* @param {HTMLElement} rootEl 自定义HTML节点内容可以挂载的dom节点
|
||||
* @example
|
||||
* class CustomHtmlNode extends HtmlNode {
|
||||
* setHtml(rootEl) {
|
||||
* const input = document.createElement('input');
|
||||
* rootEl.appendChild(input)
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
setHtml(rootEl: HTMLElement): void;
|
||||
/**
|
||||
* @overridable 支持重写
|
||||
* 和react的shouldComponentUpdate类似,都是为了避免出发不必要的render.
|
||||
* 但是这里不一样的地方在于,setHtml方法,我们只在properties发生变化了后再触发。
|
||||
* 而x,y等这些坐标相关的方法发生了变化,不会再重新触发setHtml.
|
||||
*/
|
||||
shouldUpdate(): boolean;
|
||||
componentDidMount(): void;
|
||||
componentDidUpdate(): void;
|
||||
getShape(): h.JSX.Element;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { h } from 'preact';
|
||||
import BaseNode from './BaseNode';
|
||||
export default class PolygonNode extends BaseNode {
|
||||
getShape(): h.JSX.Element;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { h } from 'preact';
|
||||
import BaseNode from './BaseNode';
|
||||
export default class RectNode extends BaseNode {
|
||||
getShape(): h.JSX.Element;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { h } from 'preact';
|
||||
import BaseNode from './BaseNode';
|
||||
export default class TextNode extends BaseNode {
|
||||
getBackgroud(): h.JSX.Element;
|
||||
getShape(): h.JSX.Element;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import BaseNode from './BaseNode';
|
||||
import RectNode from './RectNode';
|
||||
import CircleNode from './CircleNode';
|
||||
import PolygonNode from './PolygonNode';
|
||||
import DiamondNode from './DiamondNode';
|
||||
import EllipseNode from './EllipseNode';
|
||||
import TextNode from './TextNode';
|
||||
import HtmlNode from './HtmlNode';
|
||||
export { BaseNode, RectNode, CircleNode, PolygonNode, DiamondNode, EllipseNode, TextNode, HtmlNode, };
|
||||
@@ -0,0 +1,28 @@
|
||||
import { h, Component } from 'preact';
|
||||
/**
|
||||
* 背景配置, 支持css属性配置
|
||||
* https://developer.mozilla.org/zh-CN/docs/Web/CSS/background
|
||||
* @example
|
||||
* {
|
||||
* backgroundImage: "url('./img/grid.svg')",
|
||||
backgroundRepeat: 'repeat',
|
||||
* }
|
||||
*/
|
||||
export declare type BackgroundConfig = {
|
||||
/**
|
||||
* 背景图片地址
|
||||
*/
|
||||
backgroundImage?: string;
|
||||
/**
|
||||
* 是否重复
|
||||
*/
|
||||
backgroundRepeat?: string;
|
||||
[key: string]: any;
|
||||
};
|
||||
declare type IProps = {
|
||||
background: BackgroundConfig;
|
||||
};
|
||||
export default class BackgroundOverlay extends Component<IProps> {
|
||||
render(): h.JSX.Element;
|
||||
}
|
||||
export {};
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Component, h } from 'preact';
|
||||
import BezierEdgeModel from '../../model/edge/BezierEdgeModel';
|
||||
import GraphModel from '../../model/GraphModel';
|
||||
declare type IProps = {
|
||||
graphModel: GraphModel;
|
||||
};
|
||||
export default class BezierAdjustOverlay extends Component<IProps> {
|
||||
getBezierAdjust(bezier: BezierEdgeModel, graphModel: GraphModel): any[];
|
||||
selectedBezierEdge(): any[];
|
||||
render(): h.JSX.Element;
|
||||
}
|
||||
export {};
|
||||
@@ -0,0 +1,28 @@
|
||||
import { h, Component } from 'preact';
|
||||
import GraphModel from '../../model/GraphModel';
|
||||
import { StepDrag } from '../../util/drag';
|
||||
import Dnd from '../behavior/DnD';
|
||||
declare type IProps = {
|
||||
graphModel: GraphModel;
|
||||
dnd: Dnd;
|
||||
};
|
||||
declare type Istate = {
|
||||
isDraging: boolean;
|
||||
};
|
||||
declare class CanvasOverlay extends Component<IProps, Istate> {
|
||||
stepDrag: StepDrag;
|
||||
stepScrollX: number;
|
||||
stepScrollY: number;
|
||||
constructor(props: IProps);
|
||||
onDraging: ({ deltaX, deltaY }: {
|
||||
deltaX: any;
|
||||
deltaY: any;
|
||||
}) => void;
|
||||
onDragEnd: () => void;
|
||||
zoomHandler: (ev: WheelEvent) => void;
|
||||
clickHandler: (ev: MouseEvent) => void;
|
||||
handleContextMenu: (ev: MouseEvent) => void;
|
||||
mouseDownHandler: (ev: MouseEvent) => void;
|
||||
render(): h.JSX.Element;
|
||||
}
|
||||
export default CanvasOverlay;
|
||||
@@ -0,0 +1,30 @@
|
||||
import { h, Component } from 'preact';
|
||||
import GraphModel from '../../model/GraphModel';
|
||||
export declare type GridOptions = {
|
||||
/**
|
||||
* 网格格子间距
|
||||
*/
|
||||
size?: number;
|
||||
/**
|
||||
* 网格是否可见
|
||||
*/
|
||||
visible?: boolean;
|
||||
graphModel?: GraphModel;
|
||||
/**
|
||||
* 网格类型
|
||||
* 'dot' || 'mesh'
|
||||
*/
|
||||
type?: string;
|
||||
config?: {
|
||||
color: string;
|
||||
thickness?: number;
|
||||
};
|
||||
};
|
||||
declare type IProps = GridOptions;
|
||||
export default class Grid extends Component<IProps> {
|
||||
readonly id: string;
|
||||
renderDot(): h.JSX.Element;
|
||||
renderMesh(): h.JSX.Element;
|
||||
render(): h.JSX.Element;
|
||||
}
|
||||
export {};
|
||||
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* HtmlOverlay和CanvasOverlay放大,缩小,平移保持一致。
|
||||
* 但是这里是放的是HTML标签而不是SVG。
|
||||
* 目前这里可以放文本。
|
||||
* 之后可以考虑放图片,范围框等。
|
||||
*/
|
||||
import { h, Component } from 'preact';
|
||||
import GraphModel from '../../model/GraphModel';
|
||||
declare type IProps = {
|
||||
graphModel: GraphModel;
|
||||
};
|
||||
declare class HtmlOverlay extends Component<IProps> {
|
||||
render(): h.JSX.Element;
|
||||
}
|
||||
export default HtmlOverlay;
|
||||
@@ -0,0 +1,9 @@
|
||||
import { h, Component } from 'preact';
|
||||
import GraphModel from '../../model/GraphModel';
|
||||
declare type IProps = {
|
||||
graphModel: GraphModel;
|
||||
};
|
||||
export default class ModificationOverlay extends Component<IProps> {
|
||||
render(): h.JSX.Element;
|
||||
}
|
||||
export {};
|
||||
@@ -0,0 +1,17 @@
|
||||
import { Component, h } from 'preact';
|
||||
import { LineEdgeModel } from '../../model';
|
||||
import BezierEdgeModel from '../../model/edge/BezierEdgeModel';
|
||||
import PolylineEdgeModel from '../../model/edge/PolylineEdgeModel';
|
||||
import GraphModel from '../../model/GraphModel';
|
||||
declare type IProps = {
|
||||
graphModel: GraphModel;
|
||||
};
|
||||
export default class OutlineOverlay extends Component<IProps> {
|
||||
getNodesOutline(): any[];
|
||||
getEdgeOutline(): any[];
|
||||
getLineOutline(line: LineEdgeModel): h.JSX.Element;
|
||||
getPolylineOutline(polyline: PolylineEdgeModel): h.JSX.Element;
|
||||
getBezierOutline(bezier: BezierEdgeModel): h.JSX.Element;
|
||||
render(): h.JSX.Element;
|
||||
}
|
||||
export {};
|
||||
@@ -0,0 +1,9 @@
|
||||
import { h, Component } from 'preact';
|
||||
import SnaplineModel from '../../model/SnaplineModel';
|
||||
declare type IProps = {
|
||||
snaplineModel: SnaplineModel;
|
||||
};
|
||||
export default class SnaplineOverlay extends Component<IProps> {
|
||||
render(): h.JSX.Element;
|
||||
}
|
||||
export {};
|
||||
@@ -0,0 +1,15 @@
|
||||
import { h, Component } from 'preact';
|
||||
import GraphModel from '../../model/GraphModel';
|
||||
declare type IProps = {
|
||||
graphModel: GraphModel;
|
||||
tool: any;
|
||||
};
|
||||
export default class ToolOverlay extends Component<IProps> {
|
||||
setToolOverlayRef: (element: any) => void;
|
||||
/**
|
||||
* 外部传入的一般是HTMLElement
|
||||
*/
|
||||
getTools(): any;
|
||||
render(): h.JSX.Element;
|
||||
}
|
||||
export {};
|
||||
@@ -0,0 +1,34 @@
|
||||
import { h, ComponentType } from 'preact';
|
||||
import { GraphTransform } from '../../type';
|
||||
import GraphModel from '../../model/GraphModel';
|
||||
declare type IProps = {
|
||||
graphModel: GraphModel;
|
||||
};
|
||||
export default function getTransform<P>(WrappedComponent: ComponentType<P>): {
|
||||
new (props?: IProps & P, context?: any): {
|
||||
getMatrixString(): GraphTransform;
|
||||
render(): h.JSX.Element;
|
||||
componentWillMount?(): void;
|
||||
componentDidMount?(): void;
|
||||
componentWillUnmount?(): void;
|
||||
getChildContext?(): object;
|
||||
componentWillReceiveProps?(nextProps: Readonly<IProps & P>, nextContext: any): void;
|
||||
shouldComponentUpdate?(nextProps: Readonly<IProps & P>, nextState: Readonly<{}>, nextContext: any): boolean;
|
||||
componentWillUpdate?(nextProps: Readonly<IProps & P>, nextState: Readonly<{}>, nextContext: any): void;
|
||||
getSnapshotBeforeUpdate?(oldProps: Readonly<IProps & P>, oldState: Readonly<{}>): any;
|
||||
componentDidUpdate?(previousProps: Readonly<IProps & P>, previousState: Readonly<{}>, snapshot: any): void;
|
||||
componentDidCatch?(error: any, errorInfo: any): void;
|
||||
state: Readonly<{}>;
|
||||
props: import("preact").RenderableProps<IProps & P, any>;
|
||||
context: any;
|
||||
base?: Element | Text;
|
||||
setState<K extends never>(state: Partial<{}> | ((prevState: Readonly<{}>, props: Readonly<IProps & P>) => Partial<{}> | Pick<{}, K>) | Pick<{}, K>, callback?: () => void): void;
|
||||
forceUpdate(callback?: () => void): void;
|
||||
};
|
||||
displayName?: string;
|
||||
defaultProps?: any;
|
||||
contextType?: import("preact").Context<any>;
|
||||
getDerivedStateFromProps?(props: object, state: object): object;
|
||||
getDerivedStateFromError?(error: any): object;
|
||||
};
|
||||
export {};
|
||||
Loaded 100 of 290 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user