@logicflow/core 1.1.4 → 1.1.5

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.
@@ -18,10 +18,21 @@
18
18
  .lf-anchor:hover .lf-node-anchor-hover {
19
19
  visibility: visible;
20
20
  }
21
+ .lf-edge.pointer-none {
22
+ pointer-events: none;
23
+ }
21
24
  .lf-edge-append {
22
25
  cursor: pointer;
23
26
  }
24
-
27
+ .lf-edge-animation {
28
+ stroke-dashoffset: 100%;
29
+ animation: dash 5s linear infinite;
30
+ }
31
+ @keyframes dash {
32
+ to {
33
+ stroke-dashoffset: 0;
34
+ }
35
+ }
25
36
  /* node */
26
37
  .lf-node-not-allow {
27
38
  cursor: not-allowed;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logicflow/core",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "LogicFlow core, to quickly build flowchart editor",
5
5
  "main": "dist/logic-flow.js",
6
6
  "unpkg": "dist/logic-flow.js",
@@ -0,0 +1,12 @@
1
+ export declare type AnimationConfig = {
2
+ edge: boolean;
3
+ node: boolean;
4
+ };
5
+ export declare type Animation = {
6
+ stroke: string;
7
+ strokeDasharray: string;
8
+ className: string;
9
+ };
10
+ export declare const defaultAnimationCloseConfig: AnimationConfig;
11
+ export declare const defaultAnimationOpenConfig: AnimationConfig;
12
+ export declare const defaultAnimationData: Animation;
@@ -56,6 +56,8 @@ export declare enum EventType {
56
56
  EDGE_CONTEXTMENU = "edge:contextmenu",
57
57
  EDGE_ADJUST = "edge:adjust",
58
58
  EDGE_EXCHANGE_NODE = "edge:exchange-node",
59
+ ANCHOR_DRAGSTART = "anchor:dragstart",
60
+ ANCHOR_DROP = "anchor:drop",
59
61
  BLANK_MOUSEDOWN = "blank:mousedown",
60
62
  BLANK_DRAGSTART = "blank:dragstart",
61
63
  BLANK_DRAG = "blank:drag",
@@ -7,6 +7,7 @@ import { AdditionData, Point, NodeConfig, EdgeConfig, PointTuple, NodeMoveRule,
7
7
  import EventEmitter from '../event/eventEmitter';
8
8
  import { Theme } from '../constant/DefaultTheme';
9
9
  import { Definition } from '../options';
10
+ import { AnimationConfig } from '../constant/DefaultAnimation';
10
11
  declare type BaseNodeModelId = string;
11
12
  declare type ElementModeId = string;
12
13
  declare class GraphModel {
@@ -43,6 +44,10 @@ declare class GraphModel {
43
44
  * 用于在默认模式下将之前的顶部元素恢复初始高度。
44
45
  */
45
46
  topElement: BaseNodeModel | BaseEdgeModel;
47
+ /**
48
+ * 控制是否开启动画
49
+ */
50
+ animation: AnimationConfig;
46
51
  /**
47
52
  * 自定义全局id生成器
48
53
  * @see todo docs link
@@ -35,6 +35,7 @@ declare class BaseEdgeModel implements IBaseModel {
35
35
  targetAnchorId: string;
36
36
  menu?: MenuConfig[];
37
37
  customTextPosition: boolean;
38
+ animationData: import("../../constant/DefaultAnimation").Animation;
38
39
  [propName: string]: any;
39
40
  constructor(data: EdgeConfig, graphModel: GraphModel);
40
41
  /**
@@ -66,6 +67,12 @@ declare class BaseEdgeModel implements IBaseModel {
66
67
  * 获取当前节点文本样式
67
68
  */
68
69
  getTextStyle(): import("../../constant/DefaultTheme").EdgeTextTheme;
70
+ /**
71
+ * @overridable 支持重写
72
+ * 获取当前边的动画样式
73
+ * @returns 自定义边动画样式
74
+ */
75
+ getAnimation(): import("../../constant/DefaultAnimation").Animation;
69
76
  /**
70
77
  * @overridable 支持重写
71
78
  * 获取outline样式,重写可以定义此类型边outline样式, 默认使用主题样式
@@ -119,7 +126,7 @@ declare class BaseEdgeModel implements IBaseModel {
119
126
  */
120
127
  updateText(value: string): void;
121
128
  /**
122
- * 内部方法,计算边的起点和终点
129
+ * 内部方法,计算边的起点和终点和其对于的锚点Id
123
130
  */
124
131
  setAnchors(): void;
125
132
  setSelected(flag?: boolean): void;
@@ -171,6 +171,7 @@ export default class BaseNodeModel implements IBaseNodeModel {
171
171
  */
172
172
  getBounds(): Bounds;
173
173
  get anchors(): PointAnchor[];
174
+ getAnchorInfo(anchorId: string): PointAnchor;
174
175
  addNodeMoveRules(fn: NodeMoveRule): void;
175
176
  move(deltaX: any, deltaY: any, isignoreRule?: boolean): boolean;
176
177
  moveTo(x: any, y: any, isignoreRule?: boolean): boolean;
@@ -4,6 +4,7 @@ import { NodeData, EdgeData, Extension, GraphConfigData } from './type';
4
4
  import { KeyboardDef } from './keyboard';
5
5
  import { EditConfigInterface } from './model/EditConfigModel';
6
6
  import { Theme } from './constant/DefaultTheme';
7
+ import { AnimationConfig } from './constant/DefaultAnimation';
7
8
  export declare type EdgeType = 'line' | 'polyline' | 'bezier' | any;
8
9
  declare type DefaultOverlapMode = 0;
9
10
  declare type IncreaseOverlapMode = 1;
@@ -89,6 +90,13 @@ export declare type Definition = {
89
90
  * 是否配置个性插件,覆盖全局配置的插件
90
91
  */
91
92
  plugins?: Extension[];
93
+ /**
94
+ * 控制是否开启动画
95
+ * false: 关闭所有动画
96
+ * true: 开启所有动画
97
+ * AnimationConfig: 配置部分动画开启
98
+ */
99
+ animation?: boolean | Partial<AnimationConfig>;
92
100
  [key: string]: any;
93
101
  } & EditConfigInterface;
94
102
  export interface GuardsTypes {
@@ -177,6 +185,13 @@ export declare function get(options: Definition): {
177
185
  * 是否配置个性插件,覆盖全局配置的插件
178
186
  */
179
187
  plugins?: Extension[];
188
+ /**
189
+ * 控制是否开启动画
190
+ * false: 关闭所有动画
191
+ * true: 开启所有动画
192
+ * AnimationConfig: 配置部分动画开启
193
+ */
194
+ animation?: boolean | Partial<AnimationConfig>;
180
195
  } & EditConfigInterface;
181
196
  export declare const defaults: {
182
197
  background: boolean;
@@ -26,6 +26,7 @@ import * as Options from '../options';
26
26
  import { CommonTheme, EdgeTextTheme } from '../constant/DefaultTheme';
27
27
  export declare type PointTuple = [number, number];
28
28
  export declare type Point = {
29
+ id?: string;
29
30
  x: number;
30
31
  y: number;
31
32
  [key: string]: unknown;
@@ -0,0 +1,2 @@
1
+ import { AnimationConfig } from '../constant/DefaultAnimation';
2
+ export declare const updateAnimation: (config: boolean | Partial<AnimationConfig>) => AnimationConfig;
@@ -1,4 +1,5 @@
1
1
  import { h, Component } from 'preact';
2
+ import { StepDrag } from '../util/drag';
2
3
  import BaseNodeModel, { ConnectRuleResult } from '../model/node/BaseNodeModel';
3
4
  import GraphModel from '../model/GraphModel';
4
5
  import { AnchorConfig } from '../type';
@@ -23,16 +24,19 @@ interface IState {
23
24
  }
24
25
  declare class Anchor extends Component<IProps, IState> {
25
26
  preTargetNode: BaseNodeModel;
26
- dragHandler: Function;
27
27
  sourceRuleResults: Map<TargetNodeId, ConnectRuleResult>;
28
28
  targetRuleResults: Map<TargetNodeId, ConnectRuleResult>;
29
- constructor();
30
- onDragStart: () => void;
31
- onDraging: ({ deltaX, deltaY }: {
29
+ dragHandler: StepDrag;
30
+ constructor(props: any);
31
+ onDragStart: ({ event }: {
32
+ event: any;
33
+ }) => void;
34
+ onDraging: ({ deltaX, deltaY, event }: {
32
35
  deltaX: any;
33
36
  deltaY: any;
37
+ event: any;
34
38
  }) => void;
35
- onDragEnd: () => void;
39
+ onDragEnd: (event: any) => void;
36
40
  checkEnd: () => void;
37
41
  isShowLine(): boolean;
38
42
  render(): h.JSX.Element;
@@ -27,6 +27,9 @@ declare enum AdjustType {
27
27
  export default class AdjustPoint extends Component<IProps, IState> {
28
28
  dragHandler: Function;
29
29
  oldEdge: OldEdge;
30
+ preTargetNode: any;
31
+ targetRuleResults: Map<any, any>;
32
+ sourceRuleResults: Map<any, any>;
30
33
  constructor();
31
34
  onDragStart: () => void;
32
35
  onDraging: ({ deltaX, deltaY }: {
@@ -36,6 +39,7 @@ export default class AdjustPoint extends Component<IProps, IState> {
36
39
  onDragEnd: () => void;
37
40
  recoveryEdge: () => void;
38
41
  getAdjustPointStyle: () => import("../../constant/DefaultTheme").CircleTheme;
42
+ isAllowAdjust(info: any): any;
39
43
  render(): h.JSX.Element;
40
44
  }
41
45
  export {};
@@ -18,6 +18,7 @@ export default class BaseEdge extends Component<IProps> {
18
18
  getArrowStyle(): ArrowStyle;
19
19
  getArrow(): h.JSX.Element;
20
20
  getAdjustPoints(): h.JSX.Element;
21
+ getAnimation(): void;
21
22
  getAppendWidth(): h.JSX.Element;
22
23
  getAppend(): h.JSX.Element;
23
24
  handleHover: (hovered: any, ev: any) => void;
@@ -4,6 +4,7 @@ import { ArrowInfo } from '../../type/index';
4
4
  export default class BezierEdge extends BaseEdge {
5
5
  getEdge(): h.JSX.Element;
6
6
  getShape(): h.JSX.Element;
7
+ getAnimation(): h.JSX.Element;
7
8
  getAppendWidth(): h.JSX.Element;
8
9
  getArrowInfo(): ArrowInfo;
9
10
  }
@@ -3,5 +3,6 @@ import BaseEdge from './BaseEdge';
3
3
  export default class LineEdge extends BaseEdge {
4
4
  getEdge(): h.JSX.Element;
5
5
  getShape(): h.JSX.Element;
6
+ getAnimation(): h.JSX.Element;
6
7
  getAppendWidth(): h.JSX.Element;
7
8
  }
@@ -24,6 +24,7 @@ export default class PolylineEdge extends BaseEdge {
24
24
  getIsDraging: () => boolean;
25
25
  getEdge(): h.JSX.Element;
26
26
  getShape(): h.JSX.Element;
27
+ getAnimation(): h.JSX.Element;
27
28
  getArrowInfo(): ArrowInfo;
28
29
  getAppendAttributes(appendInfo: AppendInfo): AppendAttributesType;
29
30
  getAppendShape(appendInfo: AppendInfo): h.JSX.Element;