@logicflow/core 0.4.1-alpha.1 → 0.4.1-alpha.2

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.
Files changed (63) hide show
  1. package/README.md +171 -0
  2. package/dist/logic-flow-cjs.js +2 -0
  3. package/dist/logic-flow-cjs.js.LICENSE.txt +23 -0
  4. package/dist/logic-flow.js +2 -2
  5. package/dist/logic-flow.js.LICENSE.txt +23 -0
  6. package/dist/style/index.css +124 -8
  7. package/es/index.js +69 -0
  8. package/package.json +20 -5
  9. package/types/LogicFlow.d.ts +63 -19
  10. package/types/constant/DefaultTheme.d.ts +12 -0
  11. package/types/constant/constant.d.ts +13 -2
  12. package/types/event/eventEmitter.d.ts +8 -8
  13. package/types/model/BaseModel.d.ts +60 -1
  14. package/types/model/EditConfigModel.d.ts +74 -2
  15. package/types/model/GraphModel.d.ts +34 -6
  16. package/types/model/TransformModel.d.ts +16 -3
  17. package/types/model/edge/BaseEdgeModel.d.ts +19 -1
  18. package/types/model/edge/BezierEdgeModel.d.ts +11 -1
  19. package/types/model/edge/LineEdgeModel.d.ts +1 -1
  20. package/types/model/edge/PolylineEdgeModel.d.ts +19 -1
  21. package/types/model/node/BaseNodeModel.d.ts +71 -23
  22. package/types/model/node/CircleNodeModel.d.ts +5 -2
  23. package/types/model/node/HtmlNodeModel.d.ts +11 -0
  24. package/types/model/node/PolygonNodeModel.d.ts +5 -0
  25. package/types/model/node/index.d.ts +1 -0
  26. package/types/options.d.ts +79 -9
  27. package/types/tool/MultipleSelectTool.d.ts +2 -2
  28. package/types/tool/TextEditTool.d.ts +3 -4
  29. package/types/tool/index.d.ts +1 -0
  30. package/types/type/index.d.ts +74 -5
  31. package/types/util/drag.d.ts +2 -0
  32. package/types/util/edge.d.ts +2 -1
  33. package/types/util/graph.d.ts +4 -0
  34. package/types/util/node.d.ts +20 -2
  35. package/types/util/theme.d.ts +12 -0
  36. package/types/util/uuid.d.ts +5 -0
  37. package/types/util/zIndex.d.ts +2 -0
  38. package/types/view/Anchor.d.ts +6 -4
  39. package/types/view/Graph.d.ts +0 -4
  40. package/types/view/basic-shape/LinearGradient.d.ts +1 -0
  41. package/types/view/basic-shape/Polygon.d.ts +1 -9
  42. package/types/view/behavior/DnD.d.ts +1 -1
  43. package/types/view/edge/AdjustPoint.d.ts +43 -0
  44. package/types/view/edge/BaseEdge.d.ts +3 -1
  45. package/types/view/edge/PolylineEdge.d.ts +1 -0
  46. package/types/view/node/BaseNode.d.ts +11 -7
  47. package/types/view/node/CircleNode.d.ts +3 -1
  48. package/types/view/node/DiamondNode.d.ts +3 -1
  49. package/types/view/node/EllipseNode.d.ts +3 -1
  50. package/types/view/node/HtmlNode.d.ts +11 -0
  51. package/types/view/node/PolygonNode.d.ts +3 -1
  52. package/types/view/node/RectNode.d.ts +3 -1
  53. package/types/view/node/TextNode.d.ts +1 -0
  54. package/types/view/node/index.d.ts +2 -1
  55. package/types/view/overlay/CanvasOverlay.d.ts +30 -2
  56. package/types/view/overlay/Grid.d.ts +10 -0
  57. package/types/view/overlay/HtmlOverlay.d.ts +5 -46
  58. package/types/view/overlay/ModificationOverlay.d.ts +9 -0
  59. package/CHANGELOG.md +0 -415
  60. package/LICENSE +0 -433
  61. package/dist/style/background.css +0 -8
  62. package/dist/style/html-overlay.css +0 -33
  63. package/dist/style/tool.css +0 -29
@@ -3,30 +3,57 @@ import { GridOptions } from './view/overlay/Grid';
3
3
  import { BackgroundConfig } from './view/overlay/BackgroundOverlay';
4
4
  import { Style, NodeData, EdgeData, GraphConfigData } from './type';
5
5
  import { KeyboardDef } from './keyboard';
6
+ import { EditConfigInterface } from './model/EditConfigModel';
6
7
  export declare type EdgeType = 'line' | 'polyline' | 'bezier' | any;
8
+ declare type DefaultOverlapMode = 0;
9
+ declare type IncreaseOverlapMode = 1;
10
+ /**
11
+ * 元素重叠处理方式
12
+ * 0:表示节点在上,连线在下,点击元素时选择元素显示在最顶部。
13
+ * 1:表示安装元素创建顺序排序,点击元素也不会将其置顶。要置顶需要调用置顶API。
14
+ */
15
+ export declare type OverlapMode = DefaultOverlapMode | IncreaseOverlapMode;
7
16
  export declare type Definition = {
17
+ /**
18
+ * 画布初始化容器
19
+ */
8
20
  container: HTMLElement;
21
+ /**
22
+ * 画布宽度,不传则默认100%
23
+ */
9
24
  width?: number;
25
+ /**
26
+ * 画布高度,不传则默认100%
27
+ */
10
28
  height?: number;
29
+ /**
30
+ * 背景图
31
+ */
11
32
  background?: false | BackgroundConfig;
33
+ /**
34
+ * 网格
35
+ */
12
36
  grid?: boolean | GridOptions;
13
- textEdit?: boolean;
14
37
  keyboard?: KeyboardDef;
15
38
  style?: Style;
16
39
  dndOptions?: DndOptions;
17
- isSilentMode?: boolean;
18
40
  disabledPlugins?: string[];
19
41
  edgeType?: EdgeType;
20
42
  snapline?: boolean;
21
43
  history?: boolean;
22
44
  partial?: boolean;
23
- stopScrollGraph?: boolean;
24
- stopZoomGraph?: boolean;
25
- stopMoveGraph?: boolean;
26
45
  guards?: GuardsTypes;
27
- hideAnchors?: boolean;
28
- hoverOutline?: boolean;
29
- };
46
+ hideOutline?: boolean;
47
+ overlapMode?: OverlapMode;
48
+ idGenerator?: () => number | string;
49
+ /**
50
+ * 禁止启用的内置工具
51
+ * 有些场景下,需要自定义多选效果或者文本编辑效果,则需要禁用这些内置的工具
52
+ * multipleSelect和textEdit
53
+ * todo: 将multipleSelect放到插件中
54
+ */
55
+ disabledTools?: string[];
56
+ } & EditConfigInterface;
30
57
  export interface GuardsTypes {
31
58
  beforeClone?: (data: NodeData | GraphConfigData) => boolean;
32
59
  beforeDelete?: (data: NodeData | EdgeData) => boolean;
@@ -35,9 +62,52 @@ export declare function get(options: Definition): {
35
62
  background: boolean;
36
63
  grid: boolean;
37
64
  textEdit: boolean;
38
- } & Definition;
65
+ disabledTools: any[];
66
+ } & {
67
+ /**
68
+ * 画布初始化容器
69
+ */
70
+ container: HTMLElement;
71
+ /**
72
+ * 画布宽度,不传则默认100%
73
+ */
74
+ width?: number;
75
+ /**
76
+ * 画布高度,不传则默认100%
77
+ */
78
+ height?: number;
79
+ /**
80
+ * 背景图
81
+ */
82
+ background?: false | BackgroundConfig;
83
+ /**
84
+ * 网格
85
+ */
86
+ grid?: boolean | GridOptions;
87
+ keyboard?: KeyboardDef;
88
+ style?: Style;
89
+ dndOptions?: DndOptions;
90
+ disabledPlugins?: string[];
91
+ edgeType?: any;
92
+ snapline?: boolean;
93
+ history?: boolean;
94
+ partial?: boolean;
95
+ guards?: GuardsTypes;
96
+ hideOutline?: boolean;
97
+ overlapMode?: OverlapMode;
98
+ idGenerator?: () => string | number;
99
+ /**
100
+ * 禁止启用的内置工具
101
+ * 有些场景下,需要自定义多选效果或者文本编辑效果,则需要禁用这些内置的工具
102
+ * multipleSelect和textEdit
103
+ * todo: 将multipleSelect放到插件中
104
+ */
105
+ disabledTools?: string[];
106
+ } & EditConfigInterface;
39
107
  export declare const defaults: {
40
108
  background: boolean;
41
109
  grid: boolean;
42
110
  textEdit: boolean;
111
+ disabledTools: any[];
43
112
  };
113
+ export {};
@@ -6,15 +6,15 @@ declare type IProps = {
6
6
  logicFlow: LogicFlow;
7
7
  };
8
8
  export default class MultipleSelect extends Component<IProps> {
9
+ static toolName: string;
9
10
  stepDrag: any;
10
11
  constructor(props: any);
11
12
  handleMouseDown: (ev: MouseEvent) => void;
12
- onDragStart: () => void;
13
13
  onDraging: ({ deltaX, deltaY }: {
14
14
  deltaX: any;
15
15
  deltaY: any;
16
16
  }) => void;
17
- onDragEnd: () => void;
17
+ handleContextMenu: (ev: MouseEvent) => void;
18
18
  render(): h.JSX.Element;
19
19
  }
20
20
  export {};
@@ -13,18 +13,17 @@ declare type IState = {
13
13
  style: Style;
14
14
  };
15
15
  export default class TextEdit extends Component<IProps, IState> {
16
+ static toolName: string;
16
17
  ref: import("preact").RefObject<any>;
17
18
  __prevText: {
19
+ type: string;
18
20
  text: string;
19
21
  id: string;
20
22
  };
21
23
  constructor();
22
24
  componentDidMount(): void;
23
25
  static getDerivedStateFromProps(props: any): {
24
- style: {
25
- left: any;
26
- top: any;
27
- };
26
+ style: any;
28
27
  };
29
28
  componentDidUpdate(): void;
30
29
  keyupHandler: (ev: KeyboardEvent) => void;
@@ -6,6 +6,7 @@ export default class Tool {
6
6
  toolMap: Map<any, any>;
7
7
  instance: LogicFlow;
8
8
  constructor(instance: LogicFlow);
9
+ private isDisabledTool;
9
10
  registerTool(name: any, component: any): void;
10
11
  getTools(): any[];
11
12
  getInstance(): LogicFlow;
@@ -20,6 +20,8 @@ import PolylineEdge from '../view/edge/PolylineEdge';
20
20
  import PolylineEdgeModel from '../model/edge/PolylineEdgeModel';
21
21
  import EllipseNode from '../view/node/EllipseNode';
22
22
  import EllipseNodeModel from '../model/node/EllipseNodeModel';
23
+ import HtmlNode from '../view/node/HtmlNode';
24
+ import HtmlNodeModel from '../model/node/HtmlNodeModel';
23
25
  import * as Options from '../options';
24
26
  export declare type PointTuple = [number, number];
25
27
  export declare type Point = {
@@ -27,6 +29,27 @@ export declare type Point = {
27
29
  y: number;
28
30
  [key: string]: unknown;
29
31
  };
32
+ /**
33
+ * 锚点坐标
34
+ * 为了方便计算
35
+ * 锚点的位置都是相对于节点中心点的偏移量。
36
+ */
37
+ export declare type PointAnchor = {
38
+ /**
39
+ * 锚点x轴相对于中心点的偏移量
40
+ */
41
+ x: number;
42
+ /**
43
+ * 锚点y轴相对于中心点的偏移量
44
+ */
45
+ y: number;
46
+ /**
47
+ * 锚点Id
48
+ */
49
+ id?: string;
50
+ [key: string]: unknown;
51
+ };
52
+ export declare type AnchorsOffsetItem = PointTuple | PointAnchor;
30
53
  export declare type Size = {
31
54
  width: number;
32
55
  height: number;
@@ -44,6 +67,7 @@ export declare type NodeConfig = {
44
67
  x: number;
45
68
  y: number;
46
69
  text?: TextConfig | string;
70
+ zIndex?: number;
47
71
  properties?: Record<string, unknown>;
48
72
  };
49
73
  export declare type NodeData = {
@@ -51,10 +75,10 @@ export declare type NodeData = {
51
75
  type: string;
52
76
  x: number;
53
77
  y: number;
54
- rx?: number;
55
- ry?: number;
56
78
  text?: TextConfig;
57
79
  properties: Record<string, unknown>;
80
+ zIndex?: number;
81
+ [key: string]: any;
58
82
  };
59
83
  export declare type NodeAttribute = {
60
84
  id: string;
@@ -80,6 +104,7 @@ export declare type EdgeData = {
80
104
  endPoint: Point;
81
105
  text?: TextConfig;
82
106
  properties: Record<string, unknown>;
107
+ zIndex?: number;
83
108
  pointsList?: Point[];
84
109
  };
85
110
  export declare type EdgeAttribute = {
@@ -101,7 +126,9 @@ export declare type EdgeConfig = {
101
126
  id?: string;
102
127
  type: string;
103
128
  sourceNodeId: string;
129
+ sourceAnchorId?: string;
104
130
  targetNodeId: string;
131
+ targetAnchorId?: string;
105
132
  startPoint?: {
106
133
  x: number;
107
134
  y: number;
@@ -114,10 +141,21 @@ export declare type EdgeConfig = {
114
141
  x: number;
115
142
  y: number;
116
143
  value: string;
117
- };
144
+ } | string;
118
145
  pointsList?: Point[];
146
+ zIndex?: number;
119
147
  properties?: Record<string, unknown>;
120
148
  };
149
+ declare type LeftTopX = number;
150
+ declare type LeftTopY = number;
151
+ declare type RightBottomX = number;
152
+ declare type RightBottomY = number;
153
+ export declare type Bounds = {
154
+ x1: LeftTopX;
155
+ y1: LeftTopY;
156
+ x2: RightBottomX;
157
+ y2: RightBottomY;
158
+ };
121
159
  export declare type CommonStyle = {
122
160
  fill?: string;
123
161
  stroke?: string;
@@ -187,7 +225,11 @@ export declare type TextStyle = {
187
225
  fontWeight?: string;
188
226
  fontFamily?: string;
189
227
  };
190
- export declare type NodeTextStyle = TextStyle;
228
+ export declare type NodeTextStyle = TextStyle & {
229
+ autoWrap?: boolean;
230
+ lineHeight?: number;
231
+ wrapPadding?: string;
232
+ };
191
233
  export declare type EdgeTextStyle = TextStyle & {
192
234
  background?: {
193
235
  fill?: string;
@@ -199,11 +241,19 @@ export declare type EdgeTextStyle = TextStyle & {
199
241
  stroke?: string;
200
242
  radius?: number;
201
243
  };
244
+ autoWrap?: boolean;
245
+ lineHeight?: number;
246
+ wrapPadding?: string;
202
247
  };
203
248
  export declare type ArrowStyle = {
204
249
  offset?: number;
205
250
  verticalLength?: number;
206
251
  };
252
+ export declare type EdgeAdjustStyle = {
253
+ r: number;
254
+ fill?: string;
255
+ stroke?: string;
256
+ };
207
257
  export declare type Style = {
208
258
  rect?: RectStyle;
209
259
  circle?: CircleStyle;
@@ -220,6 +270,7 @@ export declare type Style = {
220
270
  arrow?: ArrowStyle;
221
271
  anchorLine?: AnchorLineStyle;
222
272
  anchorHover?: AnchorHoverStyle;
273
+ EdgeAdjustStyle?: EdgeAdjustStyle;
223
274
  };
224
275
  export declare type GraphTransform = {
225
276
  transform: string;
@@ -235,7 +286,7 @@ export declare type FocusOnArgs = {
235
286
  };
236
287
  export declare type ComponentRender = (lf: LogicFlow, container: HTMLElement) => void;
237
288
  export interface Extension {
238
- name: string;
289
+ pluginName: string;
239
290
  install?: (lf: LogicFlow, LogicFlow: LogicFlowContractor) => void;
240
291
  render?: ComponentRender;
241
292
  destroy?: () => void;
@@ -248,6 +299,7 @@ export declare type AppendInfo = {
248
299
  startIndex?: number;
249
300
  endIndex?: number;
250
301
  direction?: string;
302
+ dragAble?: boolean;
251
303
  };
252
304
  export declare type ArrowInfo = {
253
305
  start: Point;
@@ -297,6 +349,8 @@ export interface RegisterParam {
297
349
  PolylineEdgeModel: typeof PolylineEdgeModel;
298
350
  EllipseNode: typeof EllipseNode;
299
351
  EllipseNodeModel: typeof EllipseNodeModel;
352
+ HtmlNode: typeof HtmlNode;
353
+ HtmlNodeModel: typeof HtmlNodeModel;
300
354
  [key: string]: unknown;
301
355
  }
302
356
  export declare type RegisterElementFn = (params: RegisterParam) => RegisterBack;
@@ -306,3 +360,18 @@ export declare type RegisterConfig = {
306
360
  model: any;
307
361
  isObserverView?: boolean;
308
362
  };
363
+ export declare type AnchorConfig = {
364
+ id?: string;
365
+ x: number;
366
+ y: number;
367
+ [key: string]: any;
368
+ };
369
+ /**
370
+ * 限制节点移动规则
371
+ * model: 移动节点的model
372
+ * deltaX: 移动的x轴距离
373
+ * deltaY: 移动的y轴距离
374
+ */
375
+ export declare type NodeMoveRule = (model: BaseNodeModel, deltaX: number, deltaY: number) => Boolean;
376
+ export declare type ZoomParam = boolean | number;
377
+ export {};
@@ -15,6 +15,7 @@ declare class StepDrag {
15
15
  step: number;
16
16
  isStopPropagation: boolean;
17
17
  isDraging: boolean;
18
+ isStartDraging: boolean;
18
19
  startX: number;
19
20
  startY: number;
20
21
  sumDeltaX: number;
@@ -23,6 +24,7 @@ declare class StepDrag {
23
24
  eventCenter: EventEmitter | null;
24
25
  model?: BaseNodeModel | BaseEdgeModel;
25
26
  startTime?: number;
27
+ isGrag: boolean;
26
28
  constructor({ onDragStart, onDraging, onDragEnd, eventType, eventCenter, step, isStopPropagation, model, }: {
27
29
  onDragStart?: (...args: any[]) => void;
28
30
  onDraging?: (...args: any[]) => void;
@@ -59,6 +59,7 @@ export declare const segmentDirection: (start: Point, end: Point) => Direction;
59
59
  export declare const poins2PointsList: (points: string) => PolyPoint[];
60
60
  export declare const getSimplePoints: (start: any, end: any, sPoint: any, tPoint: any) => Point[];
61
61
  export declare const getBytesLength: (word: string) => number;
62
+ export declare const getTextWidth: (text: any, font: any) => any;
62
63
  declare type AppendAttributesType = {
63
64
  d: string;
64
65
  fill: string;
@@ -97,5 +98,5 @@ declare type Position = {
97
98
  x: number;
98
99
  y: number;
99
100
  };
100
- export declare const twoPointDistance: (p1: Position, p2: Position) => number;
101
+ export declare const twoPointDistance: (source: Position, target: Position) => number;
101
102
  export {};
@@ -6,3 +6,7 @@ export declare const getById: (id: any, data: any) => any;
6
6
  * @param rightBottomPoint 区域的右下角点
7
7
  */
8
8
  export declare const isPointInArea: ([x, y]: [any, any], [leftTopX, leftTopY]: [any, any], [rightBottomX, rightBottomY]: [any, any]) => boolean;
9
+ /**
10
+ * 判断鼠标点击选中元素的时候,是否为多选
11
+ */
12
+ export declare const isMultipleSelect: (e: MouseEvent, editConfig: any) => boolean;
@@ -1,10 +1,10 @@
1
1
  import BaseNode from '../model/node/BaseNodeModel';
2
- import { Point, Direction, NodeConfig } from '../type';
2
+ import { Point, Direction, NodeConfig, AnchorConfig } from '../type';
3
3
  export declare const getAnchors: (data: any) => Point[];
4
4
  declare type NodeContaint = {
5
5
  node: BaseNode;
6
6
  anchorIndex: number;
7
- anchorPosition: Point;
7
+ anchor: AnchorConfig;
8
8
  };
9
9
  export declare const targetNodeInfo: (position: Point, nodes: BaseNode[]) => NodeContaint;
10
10
  export declare const distance: (x1: number, y1: number, x2: number, y2: number) => number;
@@ -43,4 +43,22 @@ export declare const getNodeAnchorPosition: (center: any, point: any, width: any
43
43
  x: any;
44
44
  y: any;
45
45
  };
46
+ export declare const getHtmlTextHeight: ({ rows, style, rowsLength, className }: {
47
+ rows: any;
48
+ style: any;
49
+ rowsLength: any;
50
+ className: any;
51
+ }) => number;
52
+ export declare const getSvgTextWidthHeight: ({ rows, rowsLength, fontSize }: {
53
+ rows: any;
54
+ rowsLength: any;
55
+ fontSize: any;
56
+ }) => {
57
+ width: number;
58
+ height: number;
59
+ };
60
+ /**
61
+ * @description 格式化连线校验信息
62
+ */
63
+ export declare const formateAnchorConnectValidateData: (data: any) => any;
46
64
  export {};
@@ -87,6 +87,9 @@ export declare const updateTheme: (style: any) => {
87
87
  fontFamily: string;
88
88
  };
89
89
  nodeText: {
90
+ autoWrap: boolean;
91
+ lineHeight: number;
92
+ wrapPadding: string;
90
93
  color: string;
91
94
  fontSize: number;
92
95
  fontWeight: string;
@@ -104,6 +107,9 @@ export declare const updateTheme: (style: any) => {
104
107
  radius: number;
105
108
  };
106
109
  hoverBackground: any;
110
+ autoWrap: boolean;
111
+ lineHeight: number;
112
+ wrapPadding: string;
107
113
  };
108
114
  line: {
109
115
  stroke: string;
@@ -158,4 +164,10 @@ export declare const updateTheme: (style: any) => {
158
164
  stroke: string;
159
165
  strokeWidth: number;
160
166
  };
167
+ edgeAdjust: {
168
+ r: number;
169
+ fill: string;
170
+ stroke: string;
171
+ strokeWidth: string;
172
+ };
161
173
  };
@@ -1 +1,6 @@
1
+ import { GraphConfigData } from '..';
1
2
  export declare const createUuid: () => string;
3
+ /**
4
+ * 重新刷新流程图的所有id
5
+ */
6
+ export declare const refreshGraphId: (graphData: GraphConfigData, prefix?: string) => GraphConfigData;
@@ -0,0 +1,2 @@
1
+ export declare const getZIndex: () => number;
2
+ export declare const getMinIndex: () => number;
@@ -2,13 +2,16 @@ import { h, Component } from 'preact';
2
2
  import BaseNodeModel, { ConnectRuleResult } from '../model/node/BaseNodeModel';
3
3
  import GraphModel from '../model/GraphModel';
4
4
  import EventEmitter from '../event/eventEmitter';
5
+ import { AnchorConfig } from '../type';
5
6
  declare type TargetNodeId = string;
6
7
  interface IProps {
7
8
  x: number;
8
9
  y: number;
9
- style?: CSSStyleDeclaration;
10
- hoverStyle?: CSSStyleDeclaration;
11
- edgeStyle?: CSSStyleDeclaration;
10
+ id?: string;
11
+ anchorData: AnchorConfig;
12
+ style?: Record<string, any>;
13
+ hoverStyle?: Record<string, any>;
14
+ edgeStyle?: Record<string, any>;
12
15
  anchorIndex: number;
13
16
  eventCenter: EventEmitter;
14
17
  graphModel: GraphModel;
@@ -35,7 +38,6 @@ declare class Anchor extends Component<IProps, IState> {
35
38
  deltaY: any;
36
39
  }) => void;
37
40
  onDragEnd: () => void;
38
- onDblClick: () => void;
39
41
  checkEnd: () => void;
40
42
  isShowLine(): boolean;
41
43
  render(): h.JSX.Element;
@@ -14,13 +14,9 @@ declare type IProps = {
14
14
  eventCenter: EventEmitter;
15
15
  dnd: DnD;
16
16
  snaplineModel: SnaplineModel;
17
- components: any;
18
- };
19
- declare type InjectedProps = IProps & {
20
17
  graphModel: GraphModel;
21
18
  };
22
19
  declare class Graph extends Component<IProps> {
23
- get InjectedProps(): InjectedProps;
24
20
  getComponent(model: BaseEdgeModel | BaseNodeModel, graphModel: GraphModel, eventCenter: EventEmitter, overlay?: string): h.JSX.Element;
25
21
  render(): h.JSX.Element;
26
22
  }
@@ -0,0 +1 @@
1
+ export default function Rect(props: any): void;
@@ -1,10 +1,2 @@
1
1
  import { h } from 'preact';
2
- export default function Polygon({ fillOpacity, strokeWidth, strokeOpacity, fill, stroke, points, className, }: {
3
- fillOpacity?: number;
4
- strokeWidth?: number;
5
- strokeOpacity?: number;
6
- fill?: string;
7
- stroke?: string;
8
- points: any;
9
- className?: string;
10
- }): h.JSX.Element;
2
+ export default function Polygon(props: any): h.JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import LogicFlow from '../../LogicFlow';
2
+ import { BaseNodeModel } from '../../model';
2
3
  import { TextConfig } from '../../type';
3
- import { BaseNodeModel } from '../..';
4
4
  export declare type DndOptions = {
5
5
  validate: () => boolean;
6
6
  };
@@ -0,0 +1,43 @@
1
+ import { h, Component } from 'preact';
2
+ import EventEmitter from '../../event/eventEmitter';
3
+ import { BaseEdgeModel } from '../../model/edge';
4
+ import GraphModel from '../../model/GraphModel';
5
+ import { Point } from '../../type';
6
+ interface IProps {
7
+ x: number;
8
+ y: number;
9
+ type: AdjustType;
10
+ id?: string;
11
+ eventCenter: EventEmitter;
12
+ graphModel: GraphModel;
13
+ edgeModel: BaseEdgeModel;
14
+ }
15
+ interface IState {
16
+ draging: boolean;
17
+ endX: number;
18
+ endY: number;
19
+ }
20
+ interface OldEdge {
21
+ startPoint: Point;
22
+ endPoint: Point;
23
+ pointsList: Point[];
24
+ }
25
+ declare enum AdjustType {
26
+ SOURCE = "SOURCE",
27
+ TARGET = "TARGET"
28
+ }
29
+ export default class AdjustPoint extends Component<IProps, IState> {
30
+ dragHandler: Function;
31
+ oldEdge: OldEdge;
32
+ constructor();
33
+ onDragStart: () => void;
34
+ onDraging: ({ deltaX, deltaY }: {
35
+ deltaX: any;
36
+ deltaY: any;
37
+ }) => void;
38
+ onDragEnd: () => void;
39
+ recoveryEdge: () => void;
40
+ getAdjustPointStyle: () => any;
41
+ render(): h.JSX.Element;
42
+ }
43
+ export {};
@@ -10,7 +10,6 @@ declare type IProps = {
10
10
  };
11
11
  export default class BaseEdge extends Component<IProps> {
12
12
  startTime: number;
13
- preStartTime: number;
14
13
  contextMenuTime: number;
15
14
  clickTimer: number;
16
15
  getAttributes(): {
@@ -36,6 +35,7 @@ export default class BaseEdge extends Component<IProps> {
36
35
  verticalLength: any;
37
36
  };
38
37
  getArrow(): h.JSX.Element;
38
+ getAdjustPoints(): h.JSX.Element;
39
39
  getAppendWidth(): h.JSX.Element;
40
40
  getAppend(): h.JSX.Element;
41
41
  handleHover: (hovered: any, ev: any) => void;
@@ -44,6 +44,8 @@ export default class BaseEdge extends Component<IProps> {
44
44
  handleContextMenu: (ev: MouseEvent) => void;
45
45
  handleMouseDown: (e: any) => void;
46
46
  handleMouseUp: (e: MouseEvent) => void;
47
+ getIsDraging: () => boolean;
48
+ toFront(): void;
47
49
  render(): h.JSX.Element;
48
50
  }
49
51
  export {};
@@ -21,6 +21,7 @@ export default class PolylineEdge extends BaseEdge {
21
21
  }) => void;
22
22
  onDragEnd: () => void;
23
23
  beforeDragStart: (e: any, appendInfo: any) => void;
24
+ getIsDraging: () => boolean;
24
25
  getAttributes(): {
25
26
  points: string;
26
27
  stroke: string;
@@ -15,9 +15,8 @@ declare type Istate = {
15
15
  export default abstract class BaseNode extends Component<IProps, Istate> {
16
16
  static getModel(defaultModel: any): any;
17
17
  stepDrag: StepDrag;
18
- startTime: number;
19
- preStartTime: number;
20
18
  contextMenuTime: number;
19
+ startTime: number;
21
20
  clickTimer: number;
22
21
  constructor(props: any);
23
22
  abstract getShape(): any;
@@ -43,7 +42,9 @@ export default abstract class BaseNode extends Component<IProps, Istate> {
43
42
  opacity: number;
44
43
  outlineColor: string;
45
44
  id: string;
46
- properties: {};
45
+ properties: {
46
+ [x: string]: any;
47
+ };
47
48
  type: string;
48
49
  x: number;
49
50
  y: number;
@@ -58,14 +59,13 @@ export default abstract class BaseNode extends Component<IProps, Istate> {
58
59
  };
59
60
  };
60
61
  getProperties(): Record<string, any>;
61
- getAnchorStyle(): CSSStyleDeclaration;
62
- getAnchorHoverStyle(): CSSStyleDeclaration;
63
- getNewEdgeStyle(): CSSStyleDeclaration;
62
+ getAnchorStyle(): Record<string, any>;
63
+ getAnchorHoverStyle(): Record<string, any>;
64
+ getNewEdgeStyle(): Record<string, any>;
64
65
  getAnchors(): h.JSX.Element[];
65
66
  getTextStyle(): any;
66
67
  getText(): "" | h.JSX.Element;
67
68
  getStateClassName(): string;
68
- onDragStart: () => void;
69
69
  onDraging: ({ deltaX, deltaY }: {
70
70
  deltaX: any;
71
71
  deltaY: any;
@@ -77,6 +77,10 @@ export default abstract class BaseNode extends Component<IProps, Istate> {
77
77
  setHoverON: (ev: any) => void;
78
78
  setHoverOFF: (ev: any) => void;
79
79
  onMouseOut: (ev: any) => void;
80
+ /**
81
+ * 节点置顶,可以被某些不需要置顶的节点重写,如group节点。
82
+ */
83
+ toFront(): void;
80
84
  render(): any;
81
85
  }
82
86
  export {};
@@ -25,7 +25,9 @@ export default class CircleNode extends BaseNode {
25
25
  opacity: number;
26
26
  outlineColor: string;
27
27
  id: string;
28
- properties: {};
28
+ properties: {
29
+ [x: string]: any;
30
+ };
29
31
  type: string;
30
32
  x: number;
31
33
  y: number;