@logicflow/core 1.2.0-alpha.1 → 1.2.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,6 +6,9 @@
6
6
  background: #ffffff;
7
7
  user-select: none;
8
8
  }
9
+ .lf-graph svg {
10
+ display: block;
11
+ }
9
12
  .lf-element-text {
10
13
  cursor: text;
11
14
  }
@@ -193,3 +196,10 @@
193
196
  .lf-edge-adjust-point {
194
197
  cursor: move;
195
198
  }
199
+ /*
200
+ * svg默认会多5px,强制全部设置为block
201
+ * @see https://stackoverflow.com/questions/41437423/difference-between-display-inline-and-block-on-svg-elements
202
+ */
203
+ .lf-graph svg {
204
+ display: block;
205
+ }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@logicflow/core",
3
- "version": "1.2.0-alpha.1",
3
+ "version": "1.2.0-alpha.10",
4
4
  "description": "LogicFlow core, to quickly build flowchart editor",
5
- "main": "dist/logic-flow.js",
6
- "unpkg": "dist/logic-flow.js",
7
- "jsdelivr": "dist/logic-flow.js",
5
+ "main": "dist/entry.js",
6
+ "unpkg": "dist/logic-flow.min.js",
7
+ "jsdelivr": "dist/logic-flow.min.js",
8
8
  "license": "Apache-2.0",
9
9
  "homepage": "http://logic-flow.org/",
10
10
  "types": "types/index.d.ts",
@@ -17,9 +17,9 @@
17
17
  "dev": "cross-env NODE_ENV=development webpack-dev-server --client-log-level warning --config scripts/webpack.config.dev.js",
18
18
  "clean": "rimraf dist lib esm cjs",
19
19
  "build": "npm run build:umd",
20
- "build:umd": "cross-env NODE_ENV=production webpack --config scripts/webpack.config.build.js && cp -r src/style/ dist/style",
20
+ "build:umd": "cross-env NODE_ENV=production webpack --config scripts/webpack.config.build.js && cp -r src/style/ dist/style && cp scripts/entry.js dist",
21
21
  "build-analyse": "cross-env analyse=true npm run build",
22
- "types": "tsc -d --declarationDir ./types --outDir temp && rimraf temp",
22
+ "types": "tsc -d --declarationDir ./tempTypes --outDir temp && rimraf types && mv ./tempTypes/src ./types && rimraf temp && rimraf tempTypes",
23
23
  "lint": "eslint . --ext .ts,.tsx",
24
24
  "publish-lib": "npm run types & npm run clean && npm run build && npm publish",
25
25
  "publish-next": "npm run types & npm run clean && npm run build && npm publish --tag next"
@@ -73,9 +73,8 @@
73
73
  "ids": "^1.0.0",
74
74
  "less-loader": "^6.0.0",
75
75
  "lodash-es": "^4.17.15",
76
- "mobx": "^5.15.7",
77
- "mobx-react": "^6.3.0",
78
- "mobx-utils": "^5.6.1",
76
+ "mobx": "^6.5.0",
77
+ "mobx-react": "^7.3.0",
79
78
  "prettier": "^2.2.1",
80
79
  "rimraf": "^3.0.2",
81
80
  "standard-version": "^9.0.0",
@@ -106,6 +106,11 @@ export default class LogicFlow {
106
106
  */
107
107
  register(type: string | RegisterConfig, fn?: RegisterElementFn, isObserverView?: boolean): void;
108
108
  private registerElement;
109
+ /**
110
+ * 批量注册
111
+ * @param elements 注册的元素
112
+ */
113
+ batchRegister(elements?: any[]): void;
109
114
  private defaultRegister;
110
115
  /**
111
116
  * 将图形选中
@@ -445,9 +450,20 @@ export default class LogicFlow {
445
450
  translateCenter(): void;
446
451
  /**
447
452
  * 图形适应屏幕大小
448
- * @param offset number 距离盒子四周的距离, 默认为20
453
+ * @param verticalOffset number 距离盒子上下的距离, 默认为20
454
+ * @param horizontalOffset number 距离盒子左右的距离, 默认为20
455
+ */
456
+ fitView(verticalOffset?: number, horizontalOffset?: number): void;
457
+ /**
458
+ * 开启边的动画
459
+ * @param edgeId any
449
460
  */
450
- fitView(offset: number): void;
461
+ openEdgeAnimation(edgeId: any): void;
462
+ /**
463
+ * 关闭边的动画
464
+ * @param edgeId any
465
+ */
466
+ closeEdgeAnimation(edgeId: any): void;
451
467
  /**
452
468
  * 监听事件
453
469
  * 事件详情见 @see todo
@@ -468,7 +484,7 @@ export default class LogicFlow {
468
484
  /**
469
485
  * 触发监听事件
470
486
  */
471
- emit(evt: string, arg: any): void;
487
+ emit(evt: string, arg?: any): void;
472
488
  /**
473
489
  * 添加扩展, 待讨论,这里是不是静态方法好一些?
474
490
  * 重复添加插件的时候,把上一次添加的插件的销毁。
@@ -514,7 +530,12 @@ export default class LogicFlow {
514
530
  * 用于fakerNode移除对齐线
515
531
  */
516
532
  setView(type: string, component: any): void;
517
- renderRawData(graphRawData: any): void;
533
+ /**
534
+ * 内部保留方法
535
+ * 用于支持国际化
536
+ */
537
+ static t(text: string): string;
538
+ renderRawData(graphRawData: any, isForce?: boolean): void;
518
539
  /**
519
540
  * 渲染图
520
541
  * @example
@@ -543,7 +564,7 @@ export default class LogicFlow {
543
564
  * })
544
565
  * @param graphData 图数据
545
566
  */
546
- render(graphData?: {}): void;
567
+ render(graphData?: {}, isForce?: boolean): void;
547
568
  /**
548
569
  * 内部保留方法
549
570
  * 获取指定类型的view
@@ -139,6 +139,10 @@ export declare type EdgeTextTheme = {
139
139
  * 文本背景样式
140
140
  */
141
141
  background?: {
142
+ /**
143
+ * 背景区域padding
144
+ * wrapPadding: '5px,10px'
145
+ */
142
146
  wrapPadding?: string;
143
147
  } & RectTheme;
144
148
  /**
@@ -179,6 +183,19 @@ export declare type OutlineTheme = {
179
183
  */
180
184
  hover?: CommonTheme;
181
185
  } & CommonTheme;
186
+ /**
187
+ * 边动画主题
188
+ */
189
+ export declare type EdgeAnimation = {
190
+ stroke?: string;
191
+ strokeDasharray?: string;
192
+ strokeDashoffset?: string;
193
+ animationName?: string;
194
+ animationDuration?: string;
195
+ animationIterationCount?: string;
196
+ animationTimingFunction?: string;
197
+ animationDirection?: string;
198
+ };
182
199
  export declare type Theme = {
183
200
  /**
184
201
  * 所有节点的通用主题设置
@@ -258,5 +275,9 @@ export declare type Theme = {
258
275
  * 节点选择状态下外侧的选框样式
259
276
  */
260
277
  outline?: OutlineTheme;
278
+ /**
279
+ * 边动画样式
280
+ */
281
+ edgeAnimation?: EdgeAnimation;
261
282
  };
262
283
  export declare const defaultTheme: Theme;
@@ -46,6 +46,8 @@ export declare enum EventType {
46
46
  NODE_MOUSEMOVE = "node:mousemove",
47
47
  NODE_MOUSEENTER = "node:mouseenter",
48
48
  NODE_MOUSELEAVE = "node:mouseleave",
49
+ NODE_TEXT_UPDATE = "node:text-update",
50
+ NODE_PROPERTY_UPDATE = "node:property-update",
49
51
  NODE_CONTEXTMENU = "node:contextmenu",
50
52
  EDGE_DELETE = "edge:delete",
51
53
  EDGE_ADD = "edge:add",
@@ -53,6 +55,8 @@ export declare enum EventType {
53
55
  EDGE_DBCLICK = "edge:dbclick",
54
56
  EDGE_MOUSEENTER = "edge:mouseenter",
55
57
  EDGE_MOUSELEAVE = "edge:mouseleave",
58
+ EDGE_TEXT_UPDATE = "edge:text-update",
59
+ EDGE_PROPERTY_UPDATE = "edge:property-update",
56
60
  EDGE_CONTEXTMENU = "edge:contextmenu",
57
61
  EDGE_ADJUST = "edge:adjust",
58
62
  EDGE_EXCHANGE_NODE = "edge:exchange-node",
@@ -76,7 +80,9 @@ export declare enum EventType {
76
80
  SELECTION_CONTEXTMENU = "selection:contextmenu",
77
81
  CONNECTION_NOT_ALLOWED = "connection:not-allowed",
78
82
  HISTORY_CHANGE = "history:change",
83
+ HISTORY_INSERT = "history:insert",
79
84
  TEXT_UPDATE = "text:update",
85
+ TEXT_DROP = "text:drop",
80
86
  GRAPH_TRANSFORM = "graph:transform",
81
87
  GRAPH_RENDERED = "graph:rendered"
82
88
  }
@@ -8,13 +8,15 @@ declare class History {
8
8
  maxSize: number;
9
9
  waitTime: number;
10
10
  eventCenter: EventEmitter;
11
- constructor(eventCenter: any);
11
+ model: any;
12
+ constructor(graphModel: any, isPropertiesChangeHistory: any);
12
13
  add(data: any): void;
13
14
  undoAble(): boolean;
14
15
  undo(): any;
15
16
  redoAble(): boolean;
16
17
  redo(): any;
17
- watch(model: any): void;
18
+ emitHistoryChange(): void;
19
+ listenHistoryChange: () => void;
18
20
  }
19
21
  export { History };
20
22
  export default History;
package/types/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { h } from 'preact';
2
1
  import LogicFlow from './LogicFlow';
3
2
  import * as LogicFlowUtil from './util';
4
- export declare function observer<P>(props: P): any;
5
- export { LogicFlow, h };
6
- export { LogicFlowUtil };
3
+ import { version } from '../package.json';
4
+ export { h } from 'preact';
5
+ export * from './util/stateUtil';
6
+ export { LogicFlowUtil, version, LogicFlow };
7
7
  export * from './type/index';
8
8
  export * from './view';
9
9
  export * from './model';
@@ -68,6 +68,12 @@ export interface EditConfigInterface {
68
68
  * 不支持ctrl,ctrl会触发contextmenu
69
69
  */
70
70
  multipleSelectKey?: string;
71
+ /**
72
+ * 拖动节点靠近画布边缘时,
73
+ * 是否自动扩张画布.
74
+ * 默认false。
75
+ */
76
+ autoExpand?: string;
71
77
  }
72
78
  /**
73
79
  * 页面编辑配置
@@ -89,6 +95,7 @@ export default class EditConfigModel {
89
95
  edgeTextEdit: boolean;
90
96
  nodeTextDraggable: boolean;
91
97
  edgeTextDraggable: boolean;
98
+ autoExpand: boolean;
92
99
  multipleSelectKey: string;
93
100
  defaultConfig: {};
94
101
  constructor(config: EditConfigInterface);
@@ -433,9 +433,20 @@ declare class GraphModel {
433
433
  translateCenter(): void;
434
434
  /**
435
435
  * 画布图形适应屏幕大小
436
- * @param offset number 距离盒子四周的距离, 默认为20
436
+ * @param verticalOffset number 距离盒子上下的距离, 默认为20
437
+ * @param horizontalOffset number 距离盒子左右的距离, 默认为20
437
438
  */
438
- fitView(offset?: number): void;
439
+ fitView(verticalOffset?: number, horizontalOffset?: number): void;
440
+ /**
441
+ * 开启边的动画
442
+ * @param edgeId any
443
+ */
444
+ openEdgeAnimation(edgeId: any): void;
445
+ /**
446
+ * 关闭边的动画
447
+ * @param edgeId any
448
+ */
449
+ closeEdgeAnimation(edgeId: any): void;
439
450
  }
440
451
  export { GraphModel };
441
452
  export default GraphModel;
@@ -1,6 +1,6 @@
1
1
  import { IBaseModel } from '../BaseModel';
2
2
  import GraphModel from '../GraphModel';
3
- import { Point, AdditionData, EdgeData, MenuConfig, EdgeConfig } from '../../type/index';
3
+ import { Point, AdditionData, EdgeData, MenuConfig, EdgeConfig, ShapeStyleAttribute } from '../../type/index';
4
4
  import { ModelType, ElementType } from '../../constant/constant';
5
5
  import { OutlineTheme } from '../../constant/DefaultTheme';
6
6
  declare class BaseEdgeModel implements IBaseModel {
@@ -25,6 +25,8 @@ declare class BaseEdgeModel implements IBaseModel {
25
25
  isHitable: boolean;
26
26
  draggable: boolean;
27
27
  visible: boolean;
28
+ virtual: boolean;
29
+ isAnimation: boolean;
28
30
  graphModel: GraphModel;
29
31
  zIndex: number;
30
32
  readonly BaseType = ElementType.EDGE;
@@ -36,8 +38,14 @@ declare class BaseEdgeModel implements IBaseModel {
36
38
  menu?: MenuConfig[];
37
39
  customTextPosition: boolean;
38
40
  animationData: import("../../constant/DefaultAnimation").Animation;
41
+ style: ShapeStyleAttribute;
42
+ arrowConfig: {
43
+ markerEnd: string;
44
+ markerStart: string;
45
+ };
39
46
  [propName: string]: any;
40
47
  constructor(data: EdgeConfig, graphModel: GraphModel);
48
+ init(): void;
41
49
  /**
42
50
  * @override 支持重写
43
51
  * 初始化边数据
@@ -61,7 +69,12 @@ declare class BaseEdgeModel implements IBaseModel {
61
69
  * 获取当前节点样式
62
70
  * @returns 自定义边样式
63
71
  */
64
- getEdgeStyle(): import("../../constant/DefaultTheme").CommonTheme;
72
+ getEdgeStyle(): {
73
+ [x: string]: any;
74
+ fill?: string;
75
+ stroke?: string;
76
+ strokeWidth?: number;
77
+ };
65
78
  /**
66
79
  * @override 支持重写
67
80
  * 获取当前节点文本样式
@@ -74,7 +87,13 @@ declare class BaseEdgeModel implements IBaseModel {
74
87
  */
75
88
  getAnimation(): import("../../constant/DefaultAnimation").Animation;
76
89
  /**
77
- * @override 支持重写
90
+ * @overridable 支持重写
91
+ * 获取当前边的动画样式
92
+ * @returns 自定义边动画样式
93
+ */
94
+ getEdgeAnimationStyle(): import("../../constant/DefaultTheme").EdgeAnimation;
95
+ /**
96
+ * @overridable 支持重写
78
97
  * 获取outline样式,重写可以定义此类型边outline样式, 默认使用主题样式
79
98
  * @returns 自定义outline样式
80
99
  */
@@ -111,6 +130,9 @@ declare class BaseEdgeModel implements IBaseModel {
111
130
  getHistoryData(): EdgeData;
112
131
  setProperty(key: any, val: any): void;
113
132
  setProperties(properties: any): void;
133
+ setStyle(key: any, val: any): void;
134
+ setStyles(styles: any): void;
135
+ updateStyles(styles: any): void;
114
136
  /**
115
137
  * 内部方法,处理初始化文本格式
116
138
  */
@@ -138,6 +160,8 @@ declare class BaseEdgeModel implements IBaseModel {
138
160
  setSelected(flag?: boolean): void;
139
161
  setHovered(flag?: boolean): void;
140
162
  setHitable(flag?: boolean): void;
163
+ openEdgeAnimation(): void;
164
+ closeEdgeAnimation(): void;
141
165
  setElementState(state: number, additionStateData?: AdditionData): void;
142
166
  updateStartPoint(anchor: any): void;
143
167
  moveStartPoint(deltaX: any, deltaY: any): void;
@@ -5,6 +5,7 @@ export { BezierEdgeModel };
5
5
  export default class BezierEdgeModel extends BaseEdgeModel {
6
6
  modelType: ModelType;
7
7
  path: string;
8
+ constructor(data: any, graphModel: any);
8
9
  initEdgeData(data: any): void;
9
10
  getEdgeStyle(): {
10
11
  [x: string]: any;
@@ -6,6 +6,7 @@ export default class PolylineEdgeModel extends BaseEdgeModel {
6
6
  modelType: ModelType;
7
7
  draggingPointList: any;
8
8
  dbClickPosition: Point;
9
+ constructor(data: any, graphModel: any);
9
10
  initEdgeData(data: any): void;
10
11
  getEdgeStyle(): {
11
12
  [x: string]: any;
@@ -36,15 +37,27 @@ export default class PolylineEdgeModel extends BaseEdgeModel {
36
37
  moveEndPoint(deltaX: any, deltaY: any): void;
37
38
  dragAppendStart(): void;
38
39
  dragAppendSimple(appendInfo: any, dragInfo: any): {
39
- start: any;
40
- end: any;
40
+ start: {
41
+ x: any;
42
+ y: any;
43
+ };
44
+ end: {
45
+ x: any;
46
+ y: any;
47
+ };
41
48
  startIndex: any;
42
49
  endIndex: any;
43
50
  direction: any;
44
51
  };
45
52
  dragAppend(appendInfo: any, dragInfo: any): {
46
- start: any;
47
- end: any;
53
+ start: {
54
+ x: any;
55
+ y: any;
56
+ };
57
+ end: {
58
+ x: any;
59
+ y: any;
60
+ };
48
61
  startIndex: any;
49
62
  endIndex: any;
50
63
  direction: any;
@@ -45,10 +45,12 @@ export default class BaseNodeModel implements IBaseNodeModel {
45
45
  isHitable: boolean;
46
46
  draggable: boolean;
47
47
  visible: boolean;
48
+ virtual: boolean;
48
49
  graphModel: GraphModel;
49
50
  zIndex: number;
50
51
  state: number;
51
52
  autoToFront: boolean;
53
+ style: ShapeStyleAttribute;
52
54
  readonly BaseType = ElementType.NODE;
53
55
  modelType: ModelType;
54
56
  additionStateData: AdditionData;
@@ -59,6 +61,7 @@ export default class BaseNodeModel implements IBaseNodeModel {
59
61
  hasSetSourceRules: boolean;
60
62
  [propName: string]: any;
61
63
  constructor(data: NodeConfig, graphModel: GraphModel);
64
+ init(): void;
62
65
  /**
63
66
  * 获取进入当前节点的边和节点
64
67
  */
@@ -105,6 +108,7 @@ export default class BaseNodeModel implements IBaseNodeModel {
105
108
  * @override 支持重写
106
109
  */
107
110
  getData(): NodeData;
111
+ setIsDragging(isDragging: any): void;
108
112
  /**
109
113
  * 用于在历史记录时获取节点数据,
110
114
  * 在某些情况下,如果希望某个属性变化不引起history的变化,
@@ -192,6 +196,19 @@ export default class BaseNodeModel implements IBaseNodeModel {
192
196
  setElementState(state: number, additionStateData?: AdditionData): void;
193
197
  setProperty(key: any, val: any): void;
194
198
  setProperties(properties: any): void;
195
- setZIndex(zIndex?: number): void;
199
+ setStyle(key: any, val: any): void;
200
+ setStyles(styles: any): void;
201
+ updateStyles(styles: any): void;
202
+ setZIndex(zindex?: number): void;
203
+ /**
204
+ * 设置节点属性;
205
+ * 支持属性请参考节点属性文档
206
+ * http://logic-flow.org/api/nodeModelApi.html#%E6%95%B0%E6%8D%AE%E5%B1%9E%E6%80%A7
207
+ * @example
208
+ * nodeModel.updateAttributes({
209
+ * width: 100,
210
+ * height: 100
211
+ * })
212
+ */
196
213
  updateAttributes(attributes: any): void;
197
214
  }
@@ -3,6 +3,7 @@ import { ModelType } from '../../constant/constant';
3
3
  declare class CircleNodeModel extends BaseNodeModel {
4
4
  modelType: ModelType;
5
5
  r: number;
6
+ constructor(data: any, graphData: any);
6
7
  get width(): number;
7
8
  get height(): number;
8
9
  getNodeStyle(): {
@@ -5,6 +5,7 @@ declare class DiamondNodeModel extends BaseNodeModel {
5
5
  modelType: ModelType;
6
6
  rx: number;
7
7
  ry: number;
8
+ constructor(data: any, graphData: any);
8
9
  getNodeStyle(): {
9
10
  [x: string]: any;
10
11
  fill?: string;
@@ -4,6 +4,7 @@ declare class EllipseNodeModel extends BaseNodeModel {
4
4
  modelType: ModelType;
5
5
  rx: number;
6
6
  ry: number;
7
+ constructor(data: any, graphData: any);
7
8
  getNodeStyle(): {
8
9
  [x: string]: any;
9
10
  fill?: string;
@@ -4,6 +4,7 @@ import { ModelType } from '../../constant/constant';
4
4
  declare class PolygonNodeModel extends BaseNodeModel {
5
5
  modelType: ModelType;
6
6
  points: PointTuple[];
7
+ constructor(data: any, graphModel: any);
7
8
  getNodeStyle(): {
8
9
  [x: string]: any;
9
10
  fill?: string;
@@ -3,6 +3,7 @@ import { ModelType } from '../../constant/constant';
3
3
  declare class RectNodeModel extends BaseNodeModel {
4
4
  modelType: ModelType;
5
5
  radius: number;
6
+ constructor(data: any, graphModel: any);
6
7
  getDefaultAnchor(): {
7
8
  x: number;
8
9
  y: number;
@@ -2,6 +2,7 @@ import BaseNodeModel from './BaseNodeModel';
2
2
  import { ModelType } from '../../constant/constant';
3
3
  declare class TextNodeModel extends BaseNodeModel {
4
4
  modelType: ModelType;
5
+ constructor(data: any, graphModel: any);
5
6
  getTextStyle(): {
6
7
  [x: string]: any;
7
8
  color?: string;
@@ -60,6 +60,13 @@ export declare type Definition = {
60
60
  * 是否开启历史记录功能,默认开启
61
61
  */
62
62
  history?: boolean;
63
+ /**
64
+ * 节点、连线的属性的变化是否会记录到history中,默认是。
65
+ * 例如:节点的一个属性为active, 在自定义节点时这个属性为true节点高亮。
66
+ * 那么在isPropertiesChangeHistory为true的情况下,将节点active设置为true
67
+ * 会在历史记录中多一个active为false的快照。
68
+ */
69
+ isPropertiesChangeHistory?: boolean;
63
70
  /**
64
71
  * 是否开启局部渲染,默认不开启
65
72
  */
@@ -107,6 +114,7 @@ export declare function get(options: Definition): {
107
114
  background: boolean;
108
115
  grid: boolean;
109
116
  textEdit: boolean;
117
+ isPropertiesChangeHistory: boolean;
110
118
  disabledTools: any[];
111
119
  } & {
112
120
  [key: string]: any;
@@ -155,6 +163,13 @@ export declare function get(options: Definition): {
155
163
  * 是否开启历史记录功能,默认开启
156
164
  */
157
165
  history?: boolean;
166
+ /**
167
+ * 节点、连线的属性的变化是否会记录到history中,默认是。
168
+ * 例如:节点的一个属性为active, 在自定义节点时这个属性为true节点高亮。
169
+ * 那么在isPropertiesChangeHistory为true的情况下,将节点active设置为true
170
+ * 会在历史记录中多一个active为false的快照。
171
+ */
172
+ isPropertiesChangeHistory?: boolean;
158
173
  /**
159
174
  * 是否开启局部渲染,默认不开启
160
175
  */
@@ -197,6 +212,7 @@ export declare const defaults: {
197
212
  background: boolean;
198
213
  grid: boolean;
199
214
  textEdit: boolean;
215
+ isPropertiesChangeHistory: boolean;
200
216
  disabledTools: any[];
201
217
  };
202
218
  export {};
@@ -28,6 +28,7 @@ export default class TextEdit extends Component<IProps, IState> {
28
28
  componentDidUpdate(): void;
29
29
  keyupHandler: (ev: any) => void;
30
30
  inputHandler: (ev: any) => void;
31
+ keydownHandler: (ev: any) => void;
31
32
  placeCaretAtEnd(el: any): void;
32
33
  render(): h.JSX.Element;
33
34
  }
@@ -382,4 +382,25 @@ export declare type VirtualRectSize = {
382
382
  virtualRectCenterPositionX: number;
383
383
  virtualRectCenterPositionY: number;
384
384
  };
385
+ export declare type ArrowPath = {
386
+ d: string;
387
+ stroke?: string;
388
+ fill?: string;
389
+ transform?: string;
390
+ [key: string]: any;
391
+ };
392
+ export declare type ArrowMarker = {
393
+ id: string;
394
+ refX?: string | number;
395
+ refY?: string | number;
396
+ overflow?: string;
397
+ orient?: string;
398
+ markerUnits?: string;
399
+ viewBox?: string;
400
+ markerWidth?: number;
401
+ markerHeight?: number;
402
+ path: ArrowPath;
403
+ [key: string]: any;
404
+ };
405
+ export declare type ArrowMarkerList = ArrowMarker[];
385
406
  export {};
@@ -26,8 +26,11 @@ export declare const isBboxOverLapping: (b1: PBBox, b2: PBBox) => boolean;
26
26
  export declare const filterRepeatPoints: (points: PolyPoint[]) => PolyPoint[];
27
27
  export declare const getSimplePolyline: (sPoint: PolyPoint, tPoint: PolyPoint) => PolyPoint[];
28
28
  export declare const getExpandedBBox: (bbox: PBBox, offset: number) => PBBox;
29
- export declare const pointDirection: (point: PolyPoint, bbox: PBBox) => Direction;
30
- export declare const getExpandedBBoxPoint: (bbox: PBBox, point: PolyPoint) => PolyPoint;
29
+ /**
30
+ * 判断点与中心点边的方向:是否水平,true水平,false垂直
31
+ */
32
+ export declare const pointDirection: (point: PolyPoint, node: BaseNode) => Direction;
33
+ export declare const getExpandedBBoxPoint: (bbox: PBBox, point: PolyPoint, direction: any) => PolyPoint;
31
34
  export declare const mergeBBox: (b1: PBBox, b2: PBBox) => PBBox;
32
35
  export declare const getBBoxOfPoints: (points?: PolyPoint[], offset?: number) => PBBox;
33
36
  export declare const getPointsFromBBox: (bbox: PBBox) => PolyPoint[];
@@ -46,6 +49,14 @@ export declare const getNextNeighborPoints: (points: PolyPoint[], point: PolyPoi
46
49
  export declare const pathFinder: (points: PolyPoint[], start: PolyPoint, goal: PolyPoint, sBBox: PBBox, tBBox: PBBox, os: PolyPoint, ot: PolyPoint) => PolyPoint[];
47
50
  export declare const getBoxByOriginNode: (node: BaseNode) => PBBox;
48
51
  export declare const pointFilter: (points: PolyPoint[]) => PolyPoint[];
52
+ /**
53
+ * 计算折线点
54
+ * @param start 连线的开始点坐标
55
+ * @param end 连线的结束点坐标
56
+ * @param sNode 连线连接的开始节点
57
+ * @param tNode 连线连接的结束节点
58
+ * @param offset 连线箭头距离
59
+ */
49
60
  export declare const getPolylinePoints: (start: PolyPoint, end: PolyPoint, sNode: BaseNode, tNode: BaseNode, offset: number) => PolyPoint[];
50
61
  /**
51
62
  * 获取折线中最长的一个线
@@ -0,0 +1,4 @@
1
+ export { action, observable, computed, makeObservable, configure, toJS, isObservable, } from 'mobx';
2
+ export declare function observer<P>(props: P): any;
3
+ export type { IReactionDisposer, IReactionPublic, IReactionOptions } from 'mobx';
4
+ export * as mobx from 'mobx';
@@ -38,7 +38,7 @@ declare class Anchor extends Component<IProps, IState> {
38
38
  event: any;
39
39
  }) => void;
40
40
  onDragEnd: (event: any) => void;
41
- checkEnd: () => void;
41
+ checkEnd: (event: any) => void;
42
42
  moveAnchorEnd(endX: number, endY: number): void;
43
43
  isShowLine(): boolean;
44
44
  render(): h.JSX.Element;
@@ -17,6 +17,8 @@ export default class BaseEdge extends Component<IProps> {
17
17
  getArrowInfo(): ArrowInfo;
18
18
  getArrowStyle(): ArrowStyle;
19
19
  getArrow(): h.JSX.Element;
20
+ getStartArrow(): h.JSX.Element;
21
+ getEndArrow(): h.JSX.Element;
20
22
  getAdjustPoints(): h.JSX.Element;
21
23
  getAnimation(): void;
22
24
  getAppendWidth(): h.JSX.Element;
@@ -13,7 +13,12 @@ declare class CanvasOverlay extends Component<IProps, IState> {
13
13
  stepDrag: StepDrag;
14
14
  stepScrollX: number;
15
15
  stepScrollY: number;
16
+ ref: HTMLElement;
16
17
  constructor(props: IProps);
18
+ componentDidMount(): void;
19
+ componentWillUnmount(): void;
20
+ setRef: (dom: any) => void;
21
+ get rootEl(): HTMLElement;
17
22
  onDragging: ({ deltaX, deltaY }: {
18
23
  deltaX: any;
19
24
  deltaY: any;
@@ -22,6 +22,7 @@ export default class BaseText extends Component<IProps, IState> {
22
22
  deltaX: any;
23
23
  deltaY: any;
24
24
  }) => void;
25
+ onDragEnd: (e: any) => void;
25
26
  dblClickHandler: () => void;
26
27
  mouseDownHandle: (ev: MouseEvent) => void;
27
28
  render(): h.JSX.Element;
@@ -1 +0,0 @@
1
- export default function Rect(props: any): void;