更新logicflow包

This commit is contained in:
Jam committed 2022-11-28 14:55:01 +08:00
1 parent e78ebb747d
commit 2583575725
113 files changed
+41211 -588

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
'use strict'
if (process.env.NODE_ENV === 'production') {
module.exports = require('./logic-flow.min.js');
} else {
module.exports = require('./logic-flow.js');
}
File diff suppressed because it is too large. Load diff
+15
View File
@@ -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 or})),r.d(e,"c",(function(){return Gt})),r.d(e,"d",(function(){return Et})),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 gr})),r.d(e,"i",(function(){return at})),r.d(e,"j",(function(){return wt})),r.d(e,"k",(function(){return te})),r.d(e,"l",(function(){return oe})),r.d(e,"m",(function(){return rt})),r.d(e,"n",(function(){return le})),r.d(e,"o",(function(){return j})),r.d(e,"p",(function(){return Pe})),r.d(e,"q",(function(){return fe})),r.d(e,"r",(function(){return be})),r.d(e,"s",(function(){return vr})),r.d(e,"t",(function(){return ye})),r.d(e,"u",(function(){return re})),r.d(e,"v",(function(){return we})),r.d(e,"w",(function(){return _e})),r.d(e,"x",(function(){return je})),r.d(e,"y",(function(){return er})),r.d(e,"z",(function(){return ir})),r.d(e,"A",(function(){return hr})),r.d(e,"B",(function(){return xe})),r.d(e,"C",(function(){return Z})),r.d(e,"D",(function(){return Ae})),r.d(e,"E",(function(){return ce})),r.d(e,"F",(function(){return ue})),r.d(e,"G",(function(){return ee})),r.d(e,"H",(function(){return Zt})),r.d(e,"I",(function(){return Ne})),r.d(e,"J",(function(){return Re})),r.d(e,"K",(function(){return lt})),r.d(e,"L",(function(){return Se})),r.d(e,"M",(function(){return Ie}));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}(),E=y("Atom",_);function j(t,e,r){void 0===e&&(e=l),void 0===r&&(r=l);var n,o=new _(t);return e!==l&&se("onBecomeObserved",o,e,n),r!==l&&ce(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},P.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;lr(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||hr(t)||er(t)||ir(t)||cr(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 mr(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 Ze(t,K(r),r.name)},map:function(t,e){arguments.length>2&&q("map");var r=F(e);return new or(t,K(r),r.name)},set:function(t,e){arguments.length>2&&q("set");var r=F(e);return new ur(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 fe({},t,e,n);var o=pe(n),i=fe({},void 0,void 0,n),a=Ue(i);return de(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]||{};lr(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 nullLine truncated
+2 -2
View File
@@ -32,9 +32,9 @@
}
.lf-edge-animation {
stroke-dashoffset: 100%;
animation: dash 5s linear infinite;
animation: lf_animate_dash 5s linear infinite;
}
@keyframes dash {
@keyframes lf_animate_dash {
to {
stroke-dashoffset: 0;
}
+9 -6
View File
@@ -1,10 +1,12 @@
{
"name": "@logicflow/core",
"version": "1.1.12",
"version": "1.1.31",
"description": "LogicFlow core, to quickly build flowchart editor",
"main": "dist/logic-flow.js",
"unpkg": "dist/logic-flow.js",
"jsdelivr": "dist/logic-flow.js",
"main": "dist/entry.js",
"module": "dist/logic-flow.js",
"unpkg": "dist/logic-flow.min.js",
"sideEffects": true,
"jsdelivr": "dist/logic-flow.min.js",
"license": "Apache-2.0",
"homepage": "http://logic-flow.org/",
"types": "types/index.d.ts",
@@ -17,12 +19,13 @@
"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:umd": "cross-env NODE_ENV=production webpack --config scripts/webpack.config.build.js && npm run copy",
"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"
"publish-next": "npm run types & npm run clean && npm run build && npm publish --tag next",
"copy": "node ./scripts/copy.js"
},
"files": [
"dist",
+30 -5
View File
@@ -106,13 +106,19 @@ export default class LogicFlow {
*/
register(type: string | RegisterConfig, fn?: RegisterElementFn, isObserverView?: boolean): void;
private registerElement;
/**
* 批量注册
* @param elements 注册的元素
*/
batchRegister(elements?: any[]): void;
private defaultRegister;
/**
* 将图形选中
* @param id 选择元素ID
* @param multiple 是否允许多选,如果为true,不会将上一个选中的元素重置
* @param toFront 是否将选中的元素置顶,默认为true
*/
selectElementById(id: string, multiple?: boolean): void;
selectElementById(id: string, multiple?: boolean, toFront?: boolean): void;
/**
* 定位到画布视口中心
* 支持用户传入图形当前的坐标或id,可以通过type来区分是节点还是边的id,也可以不传(兜底)
@@ -128,8 +134,9 @@ export default class LogicFlow {
setTheme(style: Theme): void;
/**
* 重新设置画布的宽高
* 不传会自动计算画布宽高
*/
resize(width: number, height: number): void;
resize(width?: number, height?: number): void;
/**
* 设置默认的边类型。
* 也就是设置在节点直接有用户手动绘制的连线类型。
@@ -299,6 +306,7 @@ export default class LogicFlow {
* @param properties 自定义属性
*/
setProperties(id: string, properties: Object): void;
deleteProperty(id: string, key: string): void;
/**
* 获取元素的自定义属性
* @param id 元素的id
@@ -332,7 +340,7 @@ export default class LogicFlow {
* @param leftTopPoint 区域左上角坐标, dom层坐标
* @param rightBottomPoint 区域右下角坐标,dom层坐标
*/
getAreaElement(leftTopPoint: PointTuple, rightBottomPoint: PointTuple, wholeEdge?: boolean, wholeNode?: boolean): any[];
getAreaElement(leftTopPoint: PointTuple, rightBottomPoint: PointTuple, wholeEdge?: boolean, wholeNode?: boolean, ignoreHideElement?: boolean): any[];
/**
* 获取选中的元素数据
* @param isIgnoreCheck 是否包括sourceNode和targetNode没有被选中的边,默认包括。
@@ -382,6 +390,12 @@ export default class LogicFlow {
getPointByClient(x: number, y: number): {
domOverlayPosition: {
x: number;
/**
* 将图形选中
* @param id 选择元素ID
* @param multiple 是否允许多选,如果为true,不会将上一个选中的元素重置
* @param toFront 是否将选中的元素置顶,默认为true
*/
y: number;
};
canvasOverlayPosition: {
@@ -445,9 +459,20 @@ export default class LogicFlow {
translateCenter(): void;
/**
* 图形适应屏幕大小
* @param offset number 距离盒子四周的距离, 默认为20
* @param verticalOffset number 距离盒子上下的距离, 默认为20
* @param horizontalOffset number 距离盒子左右的距离, 默认为20
*/
fitView(offset: number): void;
fitView(verticalOffset?: number, horizontalOffset?: number): void;
/**
* 开启边的动画
* @param edgeId any
*/
openEdgeAnimation(edgeId: any): void;
/**
* 关闭边的动画
* @param edgeId any
*/
closeEdgeAnimation(edgeId: any): void;
/**
* 监听事件
* 事件详情见 @see todo
+1 -1
View File
@@ -1,5 +1,5 @@
import { Point } from '../type/index';
export declare const getCorssPointOfLine: (a: Point, b: Point, c: Point, d: Point) => false | {
export declare const getCrossPointOfLine: (a: Point, b: Point, c: Point, d: Point) => false | {
x: number;
y: number;
};
@@ -139,6 +139,10 @@ export declare type EdgeTextTheme = {
* 文本背景样式
*/
background?: {
/**
* 背景区域padding
* wrapPadding: '5px,10px'
*/
wrapPadding?: string;
} & RectTheme;
/**
@@ -179,6 +183,19 @@ export declare type OutlineTheme = {
*/
hover?: CommonTheme;
} & CommonTheme;
/**
* 边动画主题
*/
export declare type EdgeAnimation = {
stroke?: string;
strokeDasharray?: string;
strokeDashoffset?: string;
animationName?: string;
animationDuration?: string;
animationIterationCount?: string;
animationTimingFunction?: string;
animationDirection?: string;
};
export declare type Theme = {
/**
* 所有节点的通用主题设置
@@ -258,5 +275,9 @@ export declare type Theme = {
* 节点选择状态下外侧的选框样式
*/
outline?: OutlineTheme;
/**
* 边动画样式
*/
edgeAnimation?: EdgeAnimation;
};
export declare const defaultTheme: Theme;
@@ -59,6 +59,7 @@ export declare enum EventType {
ANCHOR_DRAGSTART = "anchor:dragstart",
ANCHOR_DRAG = "anchor:drag",
ANCHOR_DROP = "anchor:drop",
ANCHOR_DRAGEND = "anchor:dragend",
BLANK_MOUSEDOWN = "blank:mousedown",
BLANK_DRAGSTART = "blank:dragstart",
BLANK_DRAG = "blank:drag",
+7
View File
@@ -53,7 +53,14 @@ interface IBaseModel {
* 元素是否被选中
*/
isSelected: boolean;
/**
* 节点是否显示
*/
visible: boolean;
/**
* 节点是否可以通过getGraphData获取
*/
virtual: boolean;
/**
* 元素堆叠是层级,默认情况下节点zIndex值为1,边zIndex为0。
* todo:写完善
@@ -89,6 +89,7 @@ export default class EditConfigModel {
edgeTextEdit: boolean;
nodeTextDraggable: boolean;
edgeTextDraggable: boolean;
autoExpand: boolean;
multipleSelectKey: string;
defaultConfig: {};
constructor(config: EditConfigInterface);
+20 -4
View File
@@ -53,6 +53,10 @@ declare class GraphModel {
* @see todo docs link
*/
idGenerator: (type?: string) => string;
/**
* 节点间连线、连线变更时的边的生成规则
*/
edgeGenerator: Definition['edgeGenerator'];
/**
* 节点移动规则判断
* 在节点移动的时候,会出发此数组中的所有规则判断
@@ -142,8 +146,9 @@ declare class GraphModel {
* @param rightBottomPoint 表示区域右下角的点
* @param wholeEdge 是否要整个边都在区域内部
* @param wholeNode 是否要整个节点都在区域内部
* @param ignoreHideElement 是否忽略隐藏的节点
*/
getAreaElement(leftTopPoint: PointTuple, rightBottomPoint: PointTuple, wholeEdge?: boolean, wholeNode?: boolean): any[];
getAreaElement(leftTopPoint: PointTuple, rightBottomPoint: PointTuple, wholeEdge?: boolean, wholeNode?: boolean, ignoreHideElement?: boolean): any[];
/**
* 获取指定类型元素对应的Model
*/
@@ -417,7 +422,7 @@ declare class GraphModel {
/**
* 重新设置画布的宽高
*/
resize(width: number, height: number): void;
resize(width?: number, height?: number): void;
/**
* 清空画布
*/
@@ -433,9 +438,20 @@ declare class GraphModel {
translateCenter(): void;
/**
* 画布图形适应屏幕大小
* @param offset number 距离盒子四周的距离, 默认为20
* @param verticalOffset number 距离盒子上下的距离, 默认为20
* @param horizontalOffset number 距离盒子左右的距离, 默认为20
*/
fitView(offset?: number): void;
fitView(verticalOffset?: number, horizontalOffset?: number): void;
/**
* 开启边的动画
* @param edgeId any
*/
openEdgeAnimation(edgeId: any): void;
/**
* 关闭边的动画
* @param edgeId any
*/
closeEdgeAnimation(edgeId: any): void;
}
export { GraphModel };
export default GraphModel;
@@ -1,6 +1,6 @@
import { IBaseModel } from '../BaseModel';
import GraphModel from '../GraphModel';
import { Point, AdditionData, EdgeData, MenuConfig, EdgeConfig } from '../../type/index';
import { Point, AdditionData, EdgeData, MenuConfig, EdgeConfig, ShapeStyleAttribute } from '../../type/index';
import { ModelType, ElementType } from '../../constant/constant';
import { OutlineTheme } from '../../constant/DefaultTheme';
declare class BaseEdgeModel implements IBaseModel {
@@ -25,6 +25,8 @@ declare class BaseEdgeModel implements IBaseModel {
isHitable: boolean;
draggable: boolean;
visible: boolean;
virtual: boolean;
isAnimation: boolean;
graphModel: GraphModel;
zIndex: number;
readonly BaseType = ElementType.EDGE;
@@ -36,6 +38,11 @@ declare class BaseEdgeModel implements IBaseModel {
menu?: MenuConfig[];
customTextPosition: boolean;
animationData: import("../../constant/DefaultAnimation").Animation;
style: ShapeStyleAttribute;
arrowConfig: {
markerEnd: string;
markerStart: string;
};
[propName: string]: any;
constructor(data: EdgeConfig, graphModel: GraphModel);
/**
@@ -61,7 +68,12 @@ declare class BaseEdgeModel implements IBaseModel {
* 获取当前节点样式
* @returns 自定义边样式
*/
getEdgeStyle(): import("../../constant/DefaultTheme").CommonTheme;
getEdgeStyle(): {
[x: string]: any;
fill?: string;
stroke?: string;
strokeWidth?: number;
};
/**
* @overridable 支持重写
* 获取当前节点文本样式
@@ -73,6 +85,12 @@ declare class BaseEdgeModel implements IBaseModel {
* @returns 自定义边动画样式
*/
getAnimation(): import("../../constant/DefaultAnimation").Animation;
/**
* @overridable 支持重写
* 获取当前边的动画样式
* @returns 自定义边动画样式
*/
getEdgeAnimationStyle(): import("../../constant/DefaultTheme").EdgeAnimation;
/**
* @overridable 支持重写
* 获取outline样式,重写可以定义此类型边outline样式, 默认使用主题样式
@@ -110,7 +128,12 @@ declare class BaseEdgeModel implements IBaseModel {
*/
getHistoryData(): EdgeData;
setProperty(key: any, val: any): void;
deleteProperty(key: string): void;
setProperties(properties: any): void;
changeEdgeId(id: string): void;
setStyle(key: any, val: any): void;
setStyles(styles: any): void;
updateStyles(styles: any): void;
/**
* 内部方法,处理初始化文本格式
*/
@@ -138,6 +161,8 @@ declare class BaseEdgeModel implements IBaseModel {
setSelected(flag?: boolean): void;
setHovered(flag?: boolean): void;
setHitable(flag?: boolean): void;
openEdgeAnimation(): void;
closeEdgeAnimation(): void;
setElementState(state: number, additionStateData?: AdditionData): void;
updateStartPoint(anchor: any): void;
moveStartPoint(deltaX: any, deltaY: any): void;
@@ -50,7 +50,7 @@ export default class PolylineEdgeModel extends BaseEdgeModel {
direction: any;
};
dragAppendEnd(): void;
updatePointsAfterDrage(pointsList: any): void;
updatePointsAfterDrag(pointsList: any): void;
getAdjustStart(): any;
getAdjustEnd(): any;
updateAfterAdjustStartAndEnd({ startPoint, endPoint, sourceNode, targetNode }: {
@@ -41,14 +41,17 @@ export default class BaseNodeModel implements IBaseNodeModel {
anchorsOffset: AnchorsOffsetItem[];
isSelected: boolean;
isHovered: boolean;
isShowAnchor: boolean;
isDragging: boolean;
isHitable: boolean;
draggable: boolean;
visible: boolean;
virtual: boolean;
graphModel: GraphModel;
zIndex: number;
state: number;
autoToFront: boolean;
style: ShapeStyleAttribute;
readonly BaseType = ElementType.NODE;
modelType: ModelType;
additionStateData: AdditionData;
@@ -137,7 +140,7 @@ export default class BaseNodeModel implements IBaseNodeModel {
* 获取当前节点锚点拖出连线样式
* @returns 自定义锚点拖出样式
*/
getAnchorLineStyle(): import("../../constant/DefaultTheme").CommonTheme;
getAnchorLineStyle(anchorInfo: any): import("../../constant/DefaultTheme").CommonTheme;
/**
* @overridable 支持重写
* 获取outline样式,重写可以定义此类型节点outline样式, 默认使用主题样式
@@ -182,16 +185,22 @@ export default class BaseNodeModel implements IBaseNodeModel {
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;
move(deltaX: any, deltaY: any, isIgnoreRule?: boolean): boolean;
getMoveDistance(deltaX: number, deltaY: number, isIgnoreRule?: boolean): [number, number];
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;
setIsShowAnchor(flag?: boolean): void;
setHitable(flag?: boolean): void;
setElementState(state: number, additionStateData?: AdditionData): void;
setProperty(key: any, val: any): void;
setProperties(properties: any): void;
deleteProperty(key: string): void;
setStyle(key: any, val: any): void;
setStyles(styles: any): void;
updateStyles(styles: any): void;
setZIndex(zindex?: number): void;
updateAttributes(attributes: any): void;
}
+22
View File
@@ -97,6 +97,17 @@ export declare type Definition = {
* AnimationConfig: 配置部分动画开启
*/
animation?: boolean | Partial<AnimationConfig>;
/**
* 节点间连线、连线变更时的边的生成规则
* @param sourceNode 起始节点数据
* @param targetNode 终止节点数据
* @param currentEdge 当前边的数据, 仅移动已有边的时候有值
*
* @return undefined: 使用默认边
* string: 自定义边类型
* any: 自定义边及其他数据
*/
edgeGenerator?: (sourceNode: any, targetNode: any, currentEdge?: any) => string | any | undefined;
[key: string]: any;
} & EditConfigInterface;
export interface GuardsTypes {
@@ -192,6 +203,17 @@ export declare function get(options: Definition): {
* AnimationConfig: 配置部分动画开启
*/
animation?: boolean | Partial<AnimationConfig>;
/**
* 节点间连线、连线变更时的边的生成规则
* @param sourceNode 起始节点数据
* @param targetNode 终止节点数据
* @param currentEdge 当前边的数据, 仅移动已有边的时候有值
*
* @return undefined: 使用默认边
* string: 自定义边类型
* any: 自定义边及其他数据
*/
edgeGenerator?: (sourceNode: any, targetNode: any, currentEdge?: any) => any;
} & EditConfigInterface;
export declare const defaults: {
background: boolean;
@@ -28,6 +28,7 @@ export default class TextEdit extends Component<IProps, IState> {
componentDidUpdate(): void;
keyupHandler: (ev: any) => void;
inputHandler: (ev: any) => void;
keydownHandler: (ev: any) => void;
placeCaretAtEnd(el: any): void;
render(): h.JSX.Element;
}
+21
View File
@@ -382,4 +382,25 @@ export declare type VirtualRectSize = {
virtualRectCenterPositionX: number;
virtualRectCenterPositionY: number;
};
export declare type ArrowPath = {
d: string;
stroke?: string;
fill?: string;
transform?: string;
[key: string]: any;
};
export declare type ArrowMarker = {
id: string;
refX?: string | number;
refY?: string | number;
overflow?: string;
orient?: string;
markerUnits?: string;
viewBox?: string;
markerWidth?: number;
markerHeight?: number;
path: ArrowPath;
[key: string]: any;
};
export declare type ArrowMarkerList = ArrowMarker[];
export {};
+6
View File
@@ -99,4 +99,10 @@ declare type Position = {
y: number;
};
export declare const twoPointDistance: (source: Position, target: Position) => number;
/**
* 包装边生成函数
* @param graphModel graph model
* @param generator 用户自定义的边生成函数
*/
export declare function createEdgeGenerator(graphModel: any, generator?: Function): (sourceNode: any, targetNode: any, currentEdge?: any) => any;
export {};
+1 -1
View File
@@ -1,2 +1,2 @@
export declare function snapToGrid(distance: number, gridSize: number): number;
export declare function snapToGrid(point: number, gridSize: number): number;
export declare function getGridOffset(distance: number, gridSize: number): number;
+4
View File
@@ -0,0 +1,4 @@
export { action, observable, computed, makeObservable, configure, toJS, isObservable, } from 'mobx';
export declare function observer<P>(props: P): any;
export type { IReactionDisposer, IReactionPublic, IReactionOptions } from 'mobx';
export * as mobx from 'mobx';
+4
View File
@@ -0,0 +1,4 @@
import { DirectionVector2, Point } from '../type';
export declare const getDirectionVector: (point1: Point, point2: Point) => DirectionVector2;
export declare const isSameDirection: (v1: DirectionVector2, v2: DirectionVector2) => boolean;
export declare const isContraryDirection: (v1: DirectionVector2, v2: DirectionVector2) => boolean;
+1 -1
View File
@@ -38,7 +38,7 @@ declare class Anchor extends Component<IProps, IState> {
event: any;
}) => void;
onDragEnd: (event: any) => void;
checkEnd: () => void;
checkEnd: (event: any) => void;
moveAnchorEnd(endX: number, endY: number): void;
isShowLine(): boolean;
render(): h.JSX.Element;
+2
View File
@@ -5,6 +5,8 @@ export declare type ArrowStyle = {
fill?: string;
strokeWidth?: number;
offset: number;
refX?: number;
refY?: number;
verticalLength: number;
};
declare type ArrowAttributesType = {
+4 -2
View File
@@ -16,7 +16,9 @@ export default class BaseEdge extends Component<IProps> {
getText(): "" | h.JSX.Element;
getArrowInfo(): ArrowInfo;
getArrowStyle(): ArrowStyle;
getArrow(): h.JSX.Element;
getArrow(): h.JSX.Element | null;
getStartArrow(): h.JSX.Element | null;
getEndArrow(): h.JSX.Element | null;
getAdjustPoints(): h.JSX.Element;
getAnimation(): void;
getAppendWidth(): h.JSX.Element;
@@ -27,7 +29,7 @@ export default class BaseEdge extends Component<IProps> {
handleContextMenu: (ev: MouseEvent) => void;
handleMouseDown: (e: any) => void;
handleMouseUp: (e: MouseEvent) => void;
getIsDraging: () => boolean;
getIsDragging: () => boolean;
toFront(): void;
render(): h.JSX.Element;
}
@@ -21,7 +21,7 @@ export default class PolylineEdge extends BaseEdge {
}) => void;
onDragEnd: () => void;
beforeDragStart: (e: any, appendInfo: any) => void;
getIsDraging: () => boolean;
getIsDragging: () => boolean;
getEdge(): h.JSX.Element;
getShape(): h.JSX.Element;
getAnimation(): h.JSX.Element;
@@ -7,7 +7,6 @@ declare type IProps = {
graphModel: GraphModel;
};
declare type Istate = {
isHovered: boolean;
isDraging?: boolean;
};
export default abstract class BaseNode extends Component<IProps, Istate> {
+1 -1
View File
@@ -2,7 +2,7 @@ import { h } from 'preact';
import BaseNode from './BaseNode';
export default class HtmlNode extends BaseNode {
ref: HTMLElement;
currrentProperties: string;
currentProperties: string;
preProperties: string;
setRef: (dom: any) => void;
get rootEl(): HTMLElement;
+1 -1
View File
@@ -1,6 +1,6 @@
import { h } from 'preact';
import BaseNode from './BaseNode';
export default class TextNode extends BaseNode {
getBackgroud(): h.JSX.Element;
getBackground(): h.JSX.Element;
getShape(): h.JSX.Element;
}
+1 -1
View File
@@ -2,7 +2,7 @@ import { h } from 'preact';
import BaseText from './BaseText';
export default class LineText extends BaseText {
constructor(config: any);
getBackgroud(): h.JSX.Element;
getBackground(): h.JSX.Element;
setHoverON: () => void;
setHoverOFF: () => void;
getShape(): h.JSX.Element;