@logicflow/core 2.2.1 → 2.2.3
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.
- package/README.md +32 -0
- package/dist/docs/api/logicflow-constructor/index.en.md +106 -0
- package/dist/docs/api/logicflow-constructor/index.zh.md +106 -0
- package/dist/docs/api/logicflow-constructor/use.en.md +61 -0
- package/dist/docs/api/logicflow-constructor/use.zh.md +61 -0
- package/dist/docs/api/logicflow-instance/canvas.en.md +197 -0
- package/dist/docs/api/logicflow-instance/canvas.zh.md +199 -0
- package/dist/docs/api/logicflow-instance/edge.en.md +273 -0
- package/dist/docs/api/logicflow-instance/edge.zh.md +273 -0
- package/dist/docs/api/logicflow-instance/edit-config.en.md +59 -0
- package/dist/docs/api/logicflow-instance/edit-config.zh.md +59 -0
- package/dist/docs/api/logicflow-instance/element.en.md +375 -0
- package/dist/docs/api/logicflow-instance/element.zh.md +379 -0
- package/dist/docs/api/logicflow-instance/event.en.md +326 -0
- package/dist/docs/api/logicflow-instance/event.zh.md +406 -0
- package/dist/docs/api/logicflow-instance/history.en.md +38 -0
- package/dist/docs/api/logicflow-instance/history.zh.md +38 -0
- package/dist/docs/api/logicflow-instance/index.en.md +41 -0
- package/dist/docs/api/logicflow-instance/index.zh.md +41 -0
- package/dist/docs/api/logicflow-instance/node.en.md +308 -0
- package/dist/docs/api/logicflow-instance/node.zh.md +308 -0
- package/dist/docs/api/logicflow-instance/register.en.md +76 -0
- package/dist/docs/api/logicflow-instance/register.zh.md +76 -0
- package/dist/docs/api/logicflow-instance/render-and-data.en.md +179 -0
- package/dist/docs/api/logicflow-instance/render-and-data.zh.md +181 -0
- package/dist/docs/api/logicflow-instance/text.en.md +60 -0
- package/dist/docs/api/logicflow-instance/text.zh.md +60 -0
- package/dist/docs/api/logicflow-instance/theme.en.md +179 -0
- package/dist/docs/api/logicflow-instance/theme.zh.md +179 -0
- package/dist/docs/api/runtime-model/edgeModel.en.md +29 -0
- package/dist/docs/api/runtime-model/edgeModel.zh.md +325 -0
- package/dist/docs/api/runtime-model/graphModel.en.md +275 -0
- package/dist/docs/api/runtime-model/graphModel.zh.md +1153 -0
- package/dist/docs/api/runtime-model/nodeModel.en.md +37 -0
- package/dist/docs/api/runtime-model/nodeModel.zh.md +644 -0
- package/dist/docs/api/type/MainTypes.en.md +598 -0
- package/dist/docs/api/type/MainTypes.zh.md +867 -0
- package/dist/docs/api/type/Theme.en.md +187 -0
- package/dist/docs/api/type/Theme.zh.md +187 -0
- package/dist/docs/api/type/canvas-types.en.md +25 -0
- package/dist/docs/api/type/canvas-types.zh.md +25 -0
- package/dist/docs/api/type/index.en.md +96 -0
- package/dist/docs/api/type/index.zh.md +99 -0
- package/dist/docs/api/type/node-types.en.md +21 -0
- package/dist/docs/api/type/node-types.zh.md +21 -0
- package/dist/docs/api/type/plugin-types.en.md +24 -0
- package/dist/docs/api/type/plugin-types.zh.md +24 -0
- package/dist/docs/index.md +11 -0
- package/dist/docs/tutorial/about.en.md +38 -0
- package/dist/docs/tutorial/about.zh.md +65 -0
- package/dist/docs/tutorial/advanced/dnd.en.md +62 -0
- package/dist/docs/tutorial/advanced/dnd.zh.md +52 -0
- package/dist/docs/tutorial/advanced/edge.en.md +64 -0
- package/dist/docs/tutorial/advanced/edge.zh.md +66 -0
- package/dist/docs/tutorial/advanced/keyboard.en.md +70 -0
- package/dist/docs/tutorial/advanced/keyboard.zh.md +67 -0
- package/dist/docs/tutorial/advanced/node.en.md +338 -0
- package/dist/docs/tutorial/advanced/node.zh.md +338 -0
- package/dist/docs/tutorial/advanced/react.en.md +106 -0
- package/dist/docs/tutorial/advanced/react.zh.md +114 -0
- package/dist/docs/tutorial/advanced/silent-mode.en.md +75 -0
- package/dist/docs/tutorial/advanced/silent-mode.zh.md +71 -0
- package/dist/docs/tutorial/advanced/snapline.en.md +54 -0
- package/dist/docs/tutorial/advanced/vue.en.md +249 -0
- package/dist/docs/tutorial/advanced/vue.zh.md +248 -0
- package/dist/docs/tutorial/ai.en.md +64 -0
- package/dist/docs/tutorial/ai.zh.md +64 -0
- package/dist/docs/tutorial/basic/background.en.md +50 -0
- package/dist/docs/tutorial/basic/canvas.en.md +164 -0
- package/dist/docs/tutorial/basic/canvas.zh.md +183 -0
- package/dist/docs/tutorial/basic/class.en.md +106 -0
- package/dist/docs/tutorial/basic/class.zh.md +103 -0
- package/dist/docs/tutorial/basic/edge.en.md +151 -0
- package/dist/docs/tutorial/basic/edge.zh.md +152 -0
- package/dist/docs/tutorial/basic/event.en.md +70 -0
- package/dist/docs/tutorial/basic/event.zh.md +66 -0
- package/dist/docs/tutorial/basic/grid.en.md +77 -0
- package/dist/docs/tutorial/basic/node.en.md +358 -0
- package/dist/docs/tutorial/basic/node.zh.md +318 -0
- package/dist/docs/tutorial/basic/theme.en.md +154 -0
- package/dist/docs/tutorial/basic/theme.zh.md +157 -0
- package/dist/docs/tutorial/extension/adapter.en.md +446 -0
- package/dist/docs/tutorial/extension/adapter.zh.md +429 -0
- package/dist/docs/tutorial/extension/bpmn-element.en.md +1427 -0
- package/dist/docs/tutorial/extension/bpmn-element.zh.md +1472 -0
- package/dist/docs/tutorial/extension/control.en.md +117 -0
- package/dist/docs/tutorial/extension/control.zh.md +118 -0
- package/dist/docs/tutorial/extension/curved-edge.en.md +46 -0
- package/dist/docs/tutorial/extension/curved-edge.zh.md +46 -0
- package/dist/docs/tutorial/extension/custom.en.md +142 -0
- package/dist/docs/tutorial/extension/custom.zh.md +138 -0
- package/dist/docs/tutorial/extension/dnd-panel.en.md +109 -0
- package/dist/docs/tutorial/extension/dnd-panel.zh.md +109 -0
- package/dist/docs/tutorial/extension/dynamic-group.en.md +606 -0
- package/dist/docs/tutorial/extension/dynamic-group.zh.md +606 -0
- package/dist/docs/tutorial/extension/group.en.md +217 -0
- package/dist/docs/tutorial/extension/group.zh.md +209 -0
- package/dist/docs/tutorial/extension/highlight.en.md +50 -0
- package/dist/docs/tutorial/extension/highlight.zh.md +50 -0
- package/dist/docs/tutorial/extension/insert-node-in-polyline.en.md +52 -0
- package/dist/docs/tutorial/extension/insert-node-in-polyline.zh.md +47 -0
- package/dist/docs/tutorial/extension/intro.en.md +72 -0
- package/dist/docs/tutorial/extension/intro.zh.md +95 -0
- package/dist/docs/tutorial/extension/label.en.md +136 -0
- package/dist/docs/tutorial/extension/label.zh.md +135 -0
- package/dist/docs/tutorial/extension/layout.en.md +156 -0
- package/dist/docs/tutorial/extension/layout.zh.md +156 -0
- package/dist/docs/tutorial/extension/menu.en.md +319 -0
- package/dist/docs/tutorial/extension/menu.zh.md +377 -0
- package/dist/docs/tutorial/extension/minimap.en.md +164 -0
- package/dist/docs/tutorial/extension/minimap.zh.md +180 -0
- package/dist/docs/tutorial/extension/node-resize.en.md +199 -0
- package/dist/docs/tutorial/extension/node-resize.zh.md +221 -0
- package/dist/docs/tutorial/extension/pool.en.md +227 -0
- package/dist/docs/tutorial/extension/pool.zh.md +227 -0
- package/dist/docs/tutorial/extension/proximity-connect.en.md +104 -0
- package/dist/docs/tutorial/extension/proximity-connect.zh.md +107 -0
- package/dist/docs/tutorial/extension/selection.en.md +166 -0
- package/dist/docs/tutorial/extension/selection.zh.md +150 -0
- package/dist/docs/tutorial/extension/snapshot.en.md +276 -0
- package/dist/docs/tutorial/extension/snapshot.zh.md +276 -0
- package/dist/docs/tutorial/get-started.en.md +501 -0
- package/dist/docs/tutorial/get-started.zh.md +139 -0
- package/dist/docs/tutorial/update.en.md +213 -0
- package/dist/docs/tutorial/update.zh.md +212 -0
- package/package.json +5 -3
- package/scripts/postinstall-ai-prompt.js +67 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: API
|
|
3
|
+
group:
|
|
4
|
+
title: 类型字典
|
|
5
|
+
order: 3
|
|
6
|
+
title: 总览
|
|
7
|
+
toc: content
|
|
8
|
+
order: 0
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
欢迎阅读 LogicFlow 类型说明。本页为 **API「类型字典」分组入口**,收录与构造方法、实例能力相关的类型索引与正文。
|
|
12
|
+
|
|
13
|
+
**分组内文档**
|
|
14
|
+
|
|
15
|
+
- [`配置相关`](./MainTypes.zh.md)
|
|
16
|
+
- [`画布相关`](./canvas-types.zh.md)
|
|
17
|
+
- [`节点相关`](./node-types.zh.md)
|
|
18
|
+
- [`内置插件相关`](./plugin-types.zh.md)
|
|
19
|
+
- [`主题相关`](./Theme.zh.md)
|
|
20
|
+
|
|
21
|
+
下面是 LogicFlow 中定义的每种类型的简介(条目与旧版类型字典一致,便于检索):
|
|
22
|
+
|
|
23
|
+
## 主题样式相关类型
|
|
24
|
+
|
|
25
|
+
- [Theme](Theme.zh.md#theme主题配置):LogicFlow主题配置项,提供了目前LogicFlow支持的元素的样式配置。
|
|
26
|
+
- [CommonTheme](Theme.zh.md#commontheme通用主题):各种主题类型的基础,提供了诸如 `fill`、`stroke` 和 `strokeWidth` 等通用属性。
|
|
27
|
+
- [NodeTheme](Theme.zh.md#nodetheme节点主题):节点主题类型,例如 `RectTheme`、`CircleTheme`、`PolygonTheme` 和 `EllipseTheme`,继承自 `CommonTheme` 并定义了特定于每种形状的属性。
|
|
28
|
+
- [EdgeTheme](Theme.zh.md#edgetheme边主题):扩展了 `CommonTheme`,并包含了特定于边样式的附加属性,允许对边的外观进行详细的自定义。
|
|
29
|
+
- [TextTheme](Theme.zh.md#texttheme文本主题):概述了与文本样式相关的属性,包括 `color`、`fontSize` 和 `textAnchor`,同时也扩展了 `CommonTheme`。
|
|
30
|
+
|
|
31
|
+
## 实例相关
|
|
32
|
+
|
|
33
|
+
- [Common](MainTypes.zh.md#common实例基础配置项):LogicFlow 实例的基础配置项,包括画布的 DOM 节点、宽度、高度等。
|
|
34
|
+
- [BackgroundConfig](MainTypes.zh.md#backgroundconfig背景配置):定义画布背景的配置,包括背景图片和背景平铺方式。
|
|
35
|
+
- [GridOptions](MainTypes.zh.md#gridoptions网格配置):定义画布网格的配置,包括网格大小、可见性和网格类型。
|
|
36
|
+
- [KeyboardDef](MainTypes.zh.md#keyboarddef快捷键参数类型):定义快捷键的配置,包括启用状态和快捷键组合。
|
|
37
|
+
- [EdgeType](MainTypes.zh.md#edgetype边类型):定义边的类型,包括直线、折线和贝塞尔曲线。
|
|
38
|
+
- [AnimationConfig](MainTypes.zh.md#animationconfig动画配置):定义动画的配置,包括节点和边的动画启用状态。
|
|
39
|
+
- [EdgeGeneratorType](MainTypes.zh.md#edgegeneratortype自定义边生成函数):定义自定义边生成函数的类型,用于根据节点类型生成不同类型的边。
|
|
40
|
+
- [customTargetAnchorType](MainTypes.zh.md#customtargetanchortype自定义锚点连接规则):定义自定义锚点连接规则函数类型,用于决定手动连线落到目标节点时连接哪个锚点。
|
|
41
|
+
- [GuardsConfig](MainTypes.zh.md#guardsconfig守卫函数类型):定义守卫函数的配置,用于在克隆或删除节点/边之前进行拦截。
|
|
42
|
+
- [AppendConfig](MainTypes.zh.md#appendconfig折线边选区信息):定义折线边选区的信息,包括起点、终点、方向和是否可拖动。
|
|
43
|
+
- [ArrowConfig](MainTypes.zh.md#arrowconfig箭头配置):定义箭头的配置,包括箭头起点和终点的样式。
|
|
44
|
+
- [AttributesType](MainTypes.zh.md#attributestype通用属性类型):定义通用属性类型,允许为 LogicFlow 元素附加自定义属性。
|
|
45
|
+
- [RegisterConfig](MainTypes.zh.md#registerconfig注册配置):定义注册新元素的配置,包括元素类型、视图组件和模型构造函数。
|
|
46
|
+
- [RegisterElement](MainTypes.zh.md#registerelement注册元素配置):定义注册新元素类型的配置,包括视图组件和数据模型。
|
|
47
|
+
- [RegisterElementFunc](MainTypes.zh.md#registerelementfunc):定义注册元素的函数类型,接受注册参数并返回注册元素对象。
|
|
48
|
+
- [RegisterParam](MainTypes.zh.md#registerparam):定义注册元素时的参数类型,包括 hyperscript 函数和其他自定义属性。
|
|
49
|
+
- [BaseNodeModelCtor](MainTypes.zh.md#basenodemodelctor基础节点构造函数):定义基础节点模型的构造函数类型,用于创建节点模型实例。
|
|
50
|
+
- [BaseEdgeModelCtor](MainTypes.zh.md#baseedgemodelctor基础边构造函数):定义基础边模型的构造函数类型,用于创建边模型实例。
|
|
51
|
+
|
|
52
|
+
## 画布相关
|
|
53
|
+
|
|
54
|
+
- [GraphConfigData](MainTypes.zh.md#graphconfigdata流程图渲染数据类型):定义流程图渲染数据的类型,包括节点和边的配置。
|
|
55
|
+
- [GraphData](MainTypes.zh.md#graphdata画布数据):定义画布数据的类型,包括节点和边的数据结构。
|
|
56
|
+
- [GraphElement](MainTypes.zh.md#graphelement):定义画布上的元素类型,包括节点和边。
|
|
57
|
+
- [GraphElementCtor](MainTypes.zh.md#graphelementctor画布元素构造函数):定义画布元素的构造函数类型,用于创建节点或边的实例。
|
|
58
|
+
- [Position](MainTypes.zh.md#position坐标类型):定义二维空间中的点的坐标类型,包括 x 和 y 坐标。
|
|
59
|
+
- [Point](MainTypes.zh.md#point点类型):扩展自 Position 类型,表示二维空间中的点,包含可选的 id 和其他属性。
|
|
60
|
+
- [PointTuple](MainTypes.zh.md#pointtuple点坐标组):表示二维空间中点的元组,由两个数值组成,分别对应 x 和 y 坐标。
|
|
61
|
+
- [PropertiesType](MainTypes.zh.md#propertiestype元素属性):定义元素的属性类型,包括宽度、高度、样式和文本样式。
|
|
62
|
+
- [TextConfig](MainTypes.zh.md#textconfig文本配置):定义文本元素的配置,包括文本内容、位置、编辑和拖动选项。
|
|
63
|
+
- [ClientPosition](MainTypes.zh.md#clientposition元素位置):表示事件相对于 DOM 覆盖层和画布覆盖层的位置。
|
|
64
|
+
|
|
65
|
+
## 节点相关
|
|
66
|
+
|
|
67
|
+
- [NodeConfig](MainTypes.zh.md#nodeconfig节点配置):定义节点的配置结构,包括节点的特性、位置和行为。
|
|
68
|
+
- [OffsetData](MainTypes.zh.md#offsetdata移动偏移):定义节点在拖拽时移动偏移值的数据结构。
|
|
69
|
+
- [FakeNodeConfig](MainTypes.zh.md#fakenodeconfig虚拟节点配置):定义虚拟节点的配置,用于拖拽创建节点过程中的临时节点。
|
|
70
|
+
- [VectorData](MainTypes.zh.md#vectordata向量数据):定义二维空间中的向量数据,包括 x 轴和 y 轴的变化量。
|
|
71
|
+
- [DomAttributes](MainTypes.zh.md#domattributesdom属性):定义节点的 DOM 属性,包括 CSS 类名和其他自定义属性。
|
|
72
|
+
|
|
73
|
+
## 边相关
|
|
74
|
+
|
|
75
|
+
- [EdgeConfig](MainTypes.zh.md#edgeconfig边配置):定义边的配置结构,包括边的特性、起点和终点。
|
|
76
|
+
- [EdgeData](MainTypes.zh.md#edgedata边数据):扩展自 EdgeConfig,表示边的数据结构,包括边的特性和行为。
|
|
77
|
+
|
|
78
|
+
## 插件相关
|
|
79
|
+
|
|
80
|
+
- [Extension](MainTypes.zh.md#extension插件):定义 LogicFlow 框架中扩展的结构和行为,包括渲染和销毁方法。
|
|
81
|
+
- [ExtensionRenderFunc](MainTypes.zh.md#extensionrenderfunc插件渲染函数):定义插件的渲染函数类型,用于在 LogicFlow 环境中渲染扩展内容。
|
|
82
|
+
- [ExtensionType](MainTypes.zh.md#extensiontype插件类型):定义 LogicFlow 框架中可用的不同形式的扩展,包括构造函数和对象定义。
|
|
83
|
+
- [ExtensionConfig](MainTypes.zh.md#extensionconfig插件配置):定义插件的配置结构,包括插件标识符、扩展行为和额外属性。
|
|
84
|
+
- [IExtensionProps](MainTypes.zh.md#iextensionprops插件参数类型):定义插件的参数类型,包括 LogicFlow 实例和扩展属性。
|
|
85
|
+
- [ExtensionConstructor](MainTypes.zh.md#extensionconstructor插件构造函数):定义插件的构造函数类型,用于创建插件实例。
|
|
86
|
+
- [ExtensionDefinition](MainTypes.zh.md#extensiondefinition插件定义):定义插件的对象形式,包括插件名称、安装和渲染方法。
|
|
87
|
+
- [LabelConfig](MainTypes.zh.md#labelconfiglabel插件数据类型):定义 Label 插件支持的渲染数据结构,包括标签位置、内容和样式。
|
|
88
|
+
- [LabelOption](MainTypes.zh.md#labeloptionlabel插件配置项类型):定义 Label 插件的配置设置,包括标签方向和最大数量。
|
|
89
|
+
- [MenuConfig](MainTypes.zh.md#menuconfigmenu插件菜单项类型):定义 Menu 插件中菜单项的配置结构,包括显示文本、CSS 类名、图标和回调函数。
|
|
90
|
+
|
|
91
|
+
有关每种类型的详细信息,请参阅上面链接的相应文档。
|
|
92
|
+
|
|
93
|
+
## 相关跳转
|
|
94
|
+
|
|
95
|
+
- 运行时主题与主题类型:[`LogicFlow 实例 > 主题`](../logicflow-instance/theme.zh.md)
|
|
96
|
+
- 构造期配置与嵌套类型:[`构造方法`](../logicflow-constructor/index.zh.md)
|
|
97
|
+
- model 相关文档:[graphModel](../runtime-model/graphModel.zh.md)
|
|
98
|
+
- 插件全局注册:[`LogicFlow.use`](../logicflow-constructor/use.zh.md)
|
|
99
|
+
- 节点/边注册能力:[`实例 > 注册`](../logicflow-instance/register.zh.md)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: API
|
|
3
|
+
group:
|
|
4
|
+
title: Type dictionary
|
|
5
|
+
order: 3
|
|
6
|
+
title: Node-related types
|
|
7
|
+
toc: content
|
|
8
|
+
order: 3
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
This page indexes node and edge data-structure types. Full definitions are in [`MainTypes.en.md`](./MainTypes.en.md).
|
|
12
|
+
|
|
13
|
+
| Type | Description |
|
|
14
|
+
| :--- | :--- |
|
|
15
|
+
| [`NodeConfig`](./MainTypes.en.md#nodeconfig) | Node configuration |
|
|
16
|
+
| [`OffsetData`](./MainTypes.en.md#offsetdata) | Drag offset payload |
|
|
17
|
+
| [`FakeNodeConfig`](./MainTypes.en.md#fakenodeconfig) | Placeholder node while dragging in |
|
|
18
|
+
| [`VectorData`](./MainTypes.en.md#vectordata) | Vector math helper |
|
|
19
|
+
| [`DomAttributes`](./MainTypes.en.md#domattributes) | DOM attribute bag for nodes |
|
|
20
|
+
| [`EdgeConfig`](./MainTypes.en.md#edgeconfig) | Edge configuration |
|
|
21
|
+
| [`EdgeData`](./MainTypes.en.md#edgedata) | Serialized edge payload |
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: API
|
|
3
|
+
group:
|
|
4
|
+
title: 类型字典
|
|
5
|
+
order: 3
|
|
6
|
+
title: 节点相关
|
|
7
|
+
toc: content
|
|
8
|
+
order: 3
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
本页汇总节点与边数据结构相关类型。详细定义见 [`配置相关`](./MainTypes.zh.md) 对应章节。
|
|
12
|
+
|
|
13
|
+
| 类型 | 说明 |
|
|
14
|
+
| :--- | :--- |
|
|
15
|
+
| [`NodeConfig`](./MainTypes.zh.md#nodeconfig节点配置) | 节点配置类型。 |
|
|
16
|
+
| [`OffsetData`](./MainTypes.zh.md#offsetdata移动偏移) | 节点移动偏移量类型。 |
|
|
17
|
+
| [`FakeNodeConfig`](./MainTypes.zh.md#fakenodeconfig虚拟节点配置) | 拖拽中的虚拟节点配置类型。 |
|
|
18
|
+
| [`VectorData`](./MainTypes.zh.md#vectordata向量数据) | 向量数据类型。 |
|
|
19
|
+
| [`DomAttributes`](./MainTypes.zh.md#domattributesdom属性) | 节点 DOM 属性类型。 |
|
|
20
|
+
| [`EdgeConfig`](./MainTypes.zh.md#edgeconfig边配置) | 边配置类型。 |
|
|
21
|
+
| [`EdgeData`](./MainTypes.zh.md#edgedata边数据) | 边数据类型。 |
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: API
|
|
3
|
+
group:
|
|
4
|
+
title: Type dictionary
|
|
5
|
+
order: 3
|
|
6
|
+
title: Built-in plugin types
|
|
7
|
+
toc: content
|
|
8
|
+
order: 4
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
This page indexes extension and built-in plugin typings. Full descriptions live in [`MainTypes.en.md`](./MainTypes.en.md).
|
|
12
|
+
|
|
13
|
+
| Type | Description |
|
|
14
|
+
| :--- | :--- |
|
|
15
|
+
| [`Extension`](./MainTypes.en.md#extension) | Extension instance contract |
|
|
16
|
+
| [`ExtensionRenderFunc`](./MainTypes.en.md#extensionrenderfunc) | Render hook signature |
|
|
17
|
+
| [`ExtensionType`](./MainTypes.en.md#extensiontype) | Extension union |
|
|
18
|
+
| [`ExtensionConfig`](./MainTypes.en.md#extensionconfig) | Extension registration config |
|
|
19
|
+
| [`IExtensionProps`](./MainTypes.en.md#iextensionprops) | Constructor props |
|
|
20
|
+
| [`ExtensionConstructor`](./MainTypes.en.md#extensionconstructor) | Class-based plugin |
|
|
21
|
+
| [`ExtensionDefinition`](./MainTypes.en.md#extensiondefinition) | Object-style plugin |
|
|
22
|
+
| [`LabelConfig`](./MainTypes.en.md#labelconfig) | Label plugin data |
|
|
23
|
+
| [`LabelOption`](./MainTypes.en.md#labeloption) | Label plugin options |
|
|
24
|
+
| [`MenuConfig`](./MainTypes.en.md#menuconfig) | Context menu entries |
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: API
|
|
3
|
+
group:
|
|
4
|
+
title: 类型字典
|
|
5
|
+
order: 3
|
|
6
|
+
title: 内置插件相关
|
|
7
|
+
toc: content
|
|
8
|
+
order: 4
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
本页汇总内置插件与扩展机制相关类型。详细定义见 [`配置相关`](./MainTypes.zh.md) 对应章节。
|
|
12
|
+
|
|
13
|
+
| 类型 | 说明 |
|
|
14
|
+
| :--- | :--- |
|
|
15
|
+
| [`Extension`](./MainTypes.zh.md#extension插件) | 插件实例接口。 |
|
|
16
|
+
| [`ExtensionRenderFunc`](./MainTypes.zh.md#extensionrenderfunc插件渲染函数) | 插件渲染函数类型。 |
|
|
17
|
+
| [`ExtensionType`](./MainTypes.zh.md#extensiontype插件类型) | 插件联合类型。 |
|
|
18
|
+
| [`ExtensionConfig`](./MainTypes.zh.md#extensionconfig插件配置) | 插件配置结构。 |
|
|
19
|
+
| [`IExtensionProps`](./MainTypes.zh.md#iextensionprops插件参数类型) | 插件构造参数类型。 |
|
|
20
|
+
| [`ExtensionConstructor`](./MainTypes.zh.md#extensionconstructor插件构造函数) | 插件构造函数类型。 |
|
|
21
|
+
| [`ExtensionDefinition`](./MainTypes.zh.md#extensiondefinition插件定义) | 对象式插件定义类型。 |
|
|
22
|
+
| [`LabelConfig`](./MainTypes.zh.md#labelconfiglabel插件数据类型) | Label 插件数据类型。 |
|
|
23
|
+
| [`LabelOption`](./MainTypes.zh.md#labeloptionlabel插件配置项类型) | Label 插件配置类型。 |
|
|
24
|
+
| [`MenuConfig`](./MainTypes.zh.md#menuconfigmenu插件菜单项类型) | Menu 插件菜单项类型。 |
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: Guide
|
|
3
|
+
group:
|
|
4
|
+
title: Introduce
|
|
5
|
+
order: 0
|
|
6
|
+
title: What's LogicFlow
|
|
7
|
+
order: 0
|
|
8
|
+
toc: content
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
LogicFlow is a flowchart editing framework, provides a series of flowchart interaction, editing the necessary functions and flexible node customization, plug-ins and other expansion mechanisms.
|
|
12
|
+
LogicFlow supports the front-end custom development of a variety of logic orchestration scenarios, such as flowcharts, ER diagrams, BPMN processes and so on.
|
|
13
|
+
In the work approval flow configuration, robot logic orchestration, no code platform process configuration have better applications.
|
|
14
|
+
|
|
15
|
+
If you can't wait to try LogicFlow, come to [Get Started](./get-started.en.md)!
|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
- **Visual Modeling**: With the intuitive visual interface provided by LogicFlow, users can easily create, edit and manage complex logic flow diagrams.
|
|
20
|
+
- **Highly Customizable**: Users can customize nodes, connectors, and styles to create customized logic flow diagrams that fit specific use cases.
|
|
21
|
+
- **Self-executing engine**: The execution engine supports browser-side execution of flowchart logic, providing a new way of thinking about code-free execution.
|
|
22
|
+
|
|
23
|
+
In order to help you get a more comprehensive understanding of LogicFlow's design concepts and implementation principles, we have also compiled a number of in-depth technical articles, interested parties can visit [LogicFlow series of articles](../article/architecture-of-logicflow.en.md).
|
|
24
|
+
|
|
25
|
+
## How to contribute
|
|
26
|
+
|
|
27
|
+
### Bugs
|
|
28
|
+
|
|
29
|
+
If you're having trouble with something, start by checking
|
|
30
|
+
out [issues](https://github.com/didi/LogicFlow/issues) to see if there are any similar bugs or suggestions. Before you report a bug, make sure you've searched for existing issues and read our [FAQ](https://github.com/didi/LogicFlow/discussions).
|
|
31
|
+
|
|
32
|
+
### PR
|
|
33
|
+
|
|
34
|
+
If you want to build LogicFlow together, you are welcome to PR to us~[Code Contribution Guidelines](https://github.com/didi/LogicFlow/blob/master/CONTRUBUTING.en-US.md)
|
|
35
|
+
|
|
36
|
+
<!-- ### Code of Conduct
|
|
37
|
+
|
|
38
|
+
### Join the community -->
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: 指南
|
|
3
|
+
group:
|
|
4
|
+
title: 介绍
|
|
5
|
+
order: 0
|
|
6
|
+
title: LogicFlow是什么
|
|
7
|
+
order: 0
|
|
8
|
+
toc: content
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
LogicFlow是一款流程图编辑框架,提供了一系列流程图交互、编辑所必需的功能和灵活的节点自定义、插件等拓展机制。
|
|
12
|
+
LogicFlow支持前端自定义开发各种逻辑编排场景,如流程图、ER图、BPMN流程等。在工作审批流配置、机器人逻辑编排、无代码平台流程配置都有较好的应用。
|
|
13
|
+
|
|
14
|
+
如果你已经迫不及待想试试 LogicFlow,那就来 [快速上手](./get-started.zh.md) 吧!
|
|
15
|
+
|
|
16
|
+
## 推荐阅读顺序
|
|
17
|
+
|
|
18
|
+
如果你是第一次接触 LogicFlow,推荐按下面的顺序阅读:
|
|
19
|
+
|
|
20
|
+
1. [快速上手](./get-started.zh.md):先把最小示例跑通
|
|
21
|
+
2. [实例与图数据](./basic/class.zh.md):理解 `LogicFlow` 实例和 `graphData`
|
|
22
|
+
3. [主题](./basic/theme.zh.md) / [事件](./basic/event.zh.md):掌握样式和交互入口
|
|
23
|
+
4. [节点](./basic/node.zh.md) / [边](./basic/edge.zh.md):开始进入业务自定义
|
|
24
|
+
5. [进阶节点](./advanced/node.zh.md):理解连接规则、锚点和框架节点
|
|
25
|
+
6. [插件简介](./extension/intro.zh.md) / [API 导览](../api/logicflow-instance/index.zh.md):按目标扩展或精确查阅
|
|
26
|
+
|
|
27
|
+
## 特性
|
|
28
|
+
|
|
29
|
+
- **可视化模型**:通过 LogicFlow 提供的直观可视化界面,用户可以轻松创建、编辑和管理复杂的逻辑流程图。
|
|
30
|
+
- **高可定制性**:用户可以根据自己的需要定制节点、连接器和样式,创建符合特定用例的定制逻辑流程图。
|
|
31
|
+
- **自执行引擎**:执行引擎支持浏览器端执行流程图逻辑,为无代码执行提供新思路。
|
|
32
|
+
|
|
33
|
+
为了帮助大家更全面地了解 LogicFlow 的设计理念和实现原理,我们还整理了一些深入的技术文章,感兴趣的朋友可以访问 [LogicFlow 系列文章](../article/architecture-of-logicflow.zh.md)
|
|
34
|
+
此外,我们也会在掘金的「[LogicFlow官方号](https://juejin.cn/user/2885546018354925)」持续分享开发实践与框架动态,欢迎关注,与我们一起探索更多可能!
|
|
35
|
+
|
|
36
|
+
## 如何交流
|
|
37
|
+
|
|
38
|
+
如果您有任何的问题、建议、反馈或者交流意愿,可以通过如下方式联系我们:
|
|
39
|
+
|
|
40
|
+
- 官方推荐:[GitHub issues](https://github.com/didi/LogicFlow/issues)
|
|
41
|
+
- 官方微信:请添加「LogicFlow官方号 👨 」
|
|
42
|
+
|
|
43
|
+
<div>
|
|
44
|
+
<img alt="LogicFlow WeChat 交流群" style="border-radius: 18px; margin-left: 20px" src="https://cdn.jsdelivr.net/gh/Logic-Flow/static@latest/assets/wechat.png" width="300" />
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
- QQ讨论群:
|
|
48
|
+
|
|
49
|
+
<div>
|
|
50
|
+
<img alt="LogicFlow QQ 交流群" style="border-radius: 18px; margin-left: 20px" src="https://cdn.jsdelivr.net/gh/Logic-Flow/static@latest/assets/qq.png" width="300" />
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
## 如何贡献
|
|
54
|
+
|
|
55
|
+
### Bugs Or Questions
|
|
56
|
+
|
|
57
|
+
如果您在使用的过程中碰到问题,可以查阅我们的 [issues](https://github.com/didi/LogicFlow/issues) 看看有没有类似的
|
|
58
|
+
bug 或者建议。在你报告一个 bug 之前,请先确保已经搜索过已有的 issue 和 [常见问题](https://github.com/didi/LogicFlow/discussions)。
|
|
59
|
+
|
|
60
|
+
### PR
|
|
61
|
+
|
|
62
|
+
如果您想一起共建LogicFlow,也欢迎您提PR给我们~[代码贡献指引](https://github.com/didi/LogicFlow/blob/master/CONTRIBUTING.md)
|
|
63
|
+
<!-- ### 行为准则
|
|
64
|
+
|
|
65
|
+
### 加入社区 -->
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: Guide
|
|
3
|
+
group:
|
|
4
|
+
title: Intermediate
|
|
5
|
+
order: 2
|
|
6
|
+
title: Dnd
|
|
7
|
+
order: 4
|
|
8
|
+
toc: content
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
#### In a flowchart editing scenario rather than creating nodes through code configuration, we may need to manipulate the creation of the flowchart through the graphical user interface, which can be achieved through drag and drop. <Badge>info</Badge>
|
|
12
|
+
|
|
13
|
+
Drag and drop needs to be combined with a graphical panel, steps: create panel → initialize drag and
|
|
14
|
+
drop → listen to drop event to create node
|
|
15
|
+
|
|
16
|
+
The example is as follows:
|
|
17
|
+
|
|
18
|
+
```tsx | pure
|
|
19
|
+
lf.dnd.startDrag({
|
|
20
|
+
type,
|
|
21
|
+
text: `${type}-node`,
|
|
22
|
+
})
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
<a href="https://codesandbox.io/embed/logicflow-base18-odj3g?fontsize=14&hidenavigation=1&theme=dark&view=preview" target="_blank"> Go to CodeSandbox for examples </a>
|
|
26
|
+
|
|
27
|
+
As you can see from the code above, the nodes are drawn to the panel by means of `div` tags + `css`
|
|
28
|
+
styles, and the `onMouseDown` event is bound to it, and when the graph is dragged and dropped,
|
|
29
|
+
the `lf.dnd.startDrag` function is triggered to indicate that dragging and dropping has begun, and
|
|
30
|
+
the configuration of the selected graph is passed in, in the format of the `startDrag` entry
|
|
31
|
+
parameter:
|
|
32
|
+
|
|
33
|
+
```tsx | pure
|
|
34
|
+
lf.dnd.startDrag = (nodeConfig: NodeConfig): void => {}
|
|
35
|
+
|
|
36
|
+
type NodeConfig = {
|
|
37
|
+
id?: string; // It is not recommended to pass ids directly, logicflow ids are not allowed to be duplicated.
|
|
38
|
+
type: string;
|
|
39
|
+
text?: TextConfig;
|
|
40
|
+
properties?: Record<string, unknown>;
|
|
41
|
+
};
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
When the mouse is released at the end of the drag, the current mouse position is converted to
|
|
45
|
+
coordinates on the canvas and used as the center point coordinates of the node `x`, `y`, merged with
|
|
46
|
+
the `nodeConfig` passed in by the dragging node, and the `lf.addNode` method is called to create the
|
|
47
|
+
node when it listens to the drop event.
|
|
48
|
+
|
|
49
|
+
:::warning
|
|
50
|
+
If you are using an image as an element to add a node in the configuration panel, you need to set it
|
|
51
|
+
to be non-draggable. For more details, please refer
|
|
52
|
+
to[#267](https://github.com/didi/LogicFlow/issues/267)<br>
|
|
53
|
+
If you encounter the error "No node with id xx exists" when you add a node by dragging, you need to
|
|
54
|
+
trigger `dnd.startDrag` when mousedown. For more details, please refer
|
|
55
|
+
to[#185](https://github.com/didi/LogicFlow/issues/185)
|
|
56
|
+
:::
|
|
57
|
+
|
|
58
|
+
**Use drag and drop panel plugin**
|
|
59
|
+
|
|
60
|
+
LogicFlow has built-in **Drag & Drop Panel Plugin** in extension, if you don't want to customize the
|
|
61
|
+
graphic panel, you can use this plugin to do it quickly.
|
|
62
|
+
See [DndPanel](../extension/dnd-panel.en.md) for more details.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: 指南
|
|
3
|
+
group:
|
|
4
|
+
title: 进阶
|
|
5
|
+
order: 2
|
|
6
|
+
title: 拖拽创建节点
|
|
7
|
+
order: 4
|
|
8
|
+
toc: content
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
#### 在流程图编辑场景中比起通过代码配置创建节点,我们可能更需要通过图形用户界面来操作创建流程图,这时候就可以通过拖拽的方式来实现。 <Badge>info</Badge>
|
|
12
|
+
|
|
13
|
+
拖拽需要结合图形面板来实现,步骤:创建面板 → 拖拽初始化 → 监听 drop 事件创建节点
|
|
14
|
+
|
|
15
|
+
示例如下:
|
|
16
|
+
|
|
17
|
+
```tsx | pure
|
|
18
|
+
lf.dnd.startDrag({
|
|
19
|
+
type,
|
|
20
|
+
text: `${type}节点`,
|
|
21
|
+
})
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
<a href="https://codesandbox.io/embed/logicflow-base18-odj3g?fontsize=14&hidenavigation=1&theme=dark&view=preview" target="_blank"> 去 CodeSandbox 查看示例</a>
|
|
25
|
+
|
|
26
|
+
通过上面的代码可以看出,将节点通过`div`标签+`css`样式的方式绘制到面板中,并为其绑定`onMouseDown`
|
|
27
|
+
事件,当拖拽图形时,会触发`lf.dnd.startDrag`函数,表示开始拖拽,并传入选中图形的配置,`startDrag`入参格式:
|
|
28
|
+
|
|
29
|
+
```tsx | pure
|
|
30
|
+
lf.dnd.startDrag = (nodeConfig: NodeConfig): void => {}
|
|
31
|
+
|
|
32
|
+
type NodeConfig = {
|
|
33
|
+
id?: string; // 不建议直接传id, logicflow id不允许重复
|
|
34
|
+
type: string;
|
|
35
|
+
text?: TextConfig;
|
|
36
|
+
properties?: Record<string, unknown>;
|
|
37
|
+
};
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
拖拽结束鼠标松开时,将当前鼠标的位置转换为画布上的坐标,并以此为节点的中心点坐标`x`、`y`
|
|
41
|
+
,合并拖拽节点传入的`nodeConfig`,监听到 drop 事件后会调用`lf.addNode`方法创建节点。
|
|
42
|
+
|
|
43
|
+
:::warning{title=注意}
|
|
44
|
+
如果是用图片作为配置面板中添加节点的元素,需要将其设置为不可拖动的。详细请参考[#267](https://github.com/didi/LogicFlow/issues/267)<br>
|
|
45
|
+
如果遇到拖拽添加节点报错“不存在 id 为 xx 的节点”,需要在 mousedown 时触发`dnd.startDrag`
|
|
46
|
+
。详情参考[#185](https://github.com/didi/LogicFlow/issues/185)
|
|
47
|
+
:::
|
|
48
|
+
|
|
49
|
+
**使用拖拽面板插件**
|
|
50
|
+
|
|
51
|
+
LogicFlow 在 extension 中内置了**拖拽面板插件**
|
|
52
|
+
,如果不想自定义图形面板,可以使用此插件快速实现。详情见[拖拽面板](../extension/dnd-panel.zh.md)。
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: Guide
|
|
3
|
+
group:
|
|
4
|
+
title: Intermediate
|
|
5
|
+
order: 2
|
|
6
|
+
title: Edge
|
|
7
|
+
order: 1
|
|
8
|
+
toc: content
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## React edge
|
|
12
|
+
|
|
13
|
+
You can customize the edges based on React components using the following method, you can add any
|
|
14
|
+
React component you want to the edges, or even hide the original edges by styling them and redrawing
|
|
15
|
+
them using React
|
|
16
|
+
|
|
17
|
+
<code id="edge-react" src="../../../src/tutorial/advanced/edge/reactEdge"></code>
|
|
18
|
+
|
|
19
|
+
## Anchor Points
|
|
20
|
+
|
|
21
|
+
By default, LogicFlow only records node to node information. However, in some business scenarios, it
|
|
22
|
+
is necessary to pay attention to the anchor points, such as the correlation relationship in the UML
|
|
23
|
+
class diagram; or the anchor points indicate the entrance and exit of the nodes and so on. At this
|
|
24
|
+
time, you need to rewrite the save method of connectivity to save the anchor point information
|
|
25
|
+
together.
|
|
26
|
+
|
|
27
|
+
```tsx | pure
|
|
28
|
+
class CustomEdgeModel2 extends LineEdgeModel {
|
|
29
|
+
// Rewrite this method to save the data with the anchors.
|
|
30
|
+
getData() {
|
|
31
|
+
const data = super.getData()
|
|
32
|
+
data.sourceAnchorId = this.sourceAnchorId
|
|
33
|
+
data.targetAnchorId = this.targetAnchorId
|
|
34
|
+
return data
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
<a href="https://codesandbox.io/embed/logicflow-base17-h5pis?fontsize=14&hidenavigation=1&theme=dark&view=preview" target="_blank">
|
|
40
|
+
Go to CodeSandbox for examples</a>
|
|
41
|
+
|
|
42
|
+
## Animation
|
|
43
|
+
|
|
44
|
+
Since LogicFlow is a flowchart editing framework based on svg, we can animate flowcharts the same
|
|
45
|
+
way we animate svg. For ease of use, we have built-in basic animation effects as well. When defining
|
|
46
|
+
edges, you can set the property `isAnimation` to true to make the edge move, or you can
|
|
47
|
+
use `lf.openEdgeAnimation(edgeId)` to turn on the default animation for edges.
|
|
48
|
+
|
|
49
|
+
```tsx | pure
|
|
50
|
+
class CustomEdgeModel extends PolylineEdgeModel {
|
|
51
|
+
setAttributes() {
|
|
52
|
+
this.isAnimation = true;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
getEdgeAnimationStyle() {
|
|
56
|
+
const style = super.getEdgeAnimationStyle();
|
|
57
|
+
style.strokeDasharray = "5 5";
|
|
58
|
+
style.animationDuration = "10s";
|
|
59
|
+
return style;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
<code id="edge-animation" src="../../../src/tutorial/advanced/edge/animation"></code>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: 指南
|
|
3
|
+
group:
|
|
4
|
+
title: 进阶
|
|
5
|
+
order: 2
|
|
6
|
+
title: 边进阶
|
|
7
|
+
order: 1
|
|
8
|
+
toc: content
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
这页适合已经完成基础自定义边、准备继续处理**边上的 React 内容、锚点信息和动画效果**的读者。
|
|
12
|
+
|
|
13
|
+
::::info{title=阅读提示}
|
|
14
|
+
- 前置知识:建议先读 [边](../basic/edge.zh.md)
|
|
15
|
+
- 本页不展开节点规则和框架节点注册;这些内容请看 [进阶节点](node.zh.md)
|
|
16
|
+
- 相关 API:[`edgeModel`](../../api/runtime-model/edgeModel.zh.md)、[`事件`](../../api/logicflow-instance/event.zh.md)、[`主题`](../../api/logicflow-instance/theme.zh.md)
|
|
17
|
+
::::
|
|
18
|
+
|
|
19
|
+
## React 边
|
|
20
|
+
|
|
21
|
+
使用以下方法可以基于 React 组件自定义边,你可以在边上添加任何你想要的 React 组件,甚至将原有的边通过样式隐藏,使用
|
|
22
|
+
React 重新绘制
|
|
23
|
+
|
|
24
|
+
<code id="edge-react" src="../../../src/tutorial/advanced/edge/reactEdge"></code>
|
|
25
|
+
|
|
26
|
+
## 锚点
|
|
27
|
+
|
|
28
|
+
默认情况下,LogicFlow 只记录节点与节点的信息。但是在一些业务场景下,需要关注到锚点,比如在 UML
|
|
29
|
+
类图中的关联关系;或者锚点表示节点的入口和出口之类。这个时候需要重写连线的保存方法,将锚点信息也一起保存。
|
|
30
|
+
|
|
31
|
+
```tsx | pure
|
|
32
|
+
class CustomEdgeModel2 extends LineEdgeModel {
|
|
33
|
+
// 重写此方法,使保存数据是能带上锚点数据。
|
|
34
|
+
getData() {
|
|
35
|
+
const data = super.getData()
|
|
36
|
+
data.sourceAnchorId = this.sourceAnchorId
|
|
37
|
+
data.targetAnchorId = this.targetAnchorId
|
|
38
|
+
return data
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
<a href="https://codesandbox.io/embed/logicflow-base17-h5pis?fontsize=14&hidenavigation=1&theme=dark&view=preview" target="_blank"> 去 CodeSandbox 查看示例</a>
|
|
44
|
+
|
|
45
|
+
## 动画
|
|
46
|
+
|
|
47
|
+
由于 LogicFlow 是基于 svg 的流程图编辑框架,所以我们可以给 svg
|
|
48
|
+
添加动画的方式来给流程图添加动画效果。为了方便使用,我们也内置了基础的动画效果。在定义边的时候,可以将属性`isAnimation`
|
|
49
|
+
设置为 true 就可以让边动起来,也可以使用`lf.openEdgeAnimation(edgeId)`来开启边的默认动画。
|
|
50
|
+
|
|
51
|
+
```tsx | pure
|
|
52
|
+
class CustomEdgeModel extends PolylineEdgeModel {
|
|
53
|
+
setAttributes() {
|
|
54
|
+
this.isAnimation = true
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
getEdgeAnimationStyle() {
|
|
58
|
+
const style = super.getEdgeAnimationStyle()
|
|
59
|
+
style.strokeDasharray = '5 5'
|
|
60
|
+
style.animationDuration = '10s'
|
|
61
|
+
return style
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
<code id="edge-animation" src="../../../src/tutorial/advanced/edge/animation"></code>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: Guide
|
|
3
|
+
group:
|
|
4
|
+
title: Intermediate
|
|
5
|
+
order: 2
|
|
6
|
+
title: Keyboard
|
|
7
|
+
order: 3
|
|
8
|
+
toc: content
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Shortcut Configuration
|
|
12
|
+
|
|
13
|
+
Shortcuts can be enabled by passing the keyboard attribute to options when creating a `LogicFlow`
|
|
14
|
+
instance.
|
|
15
|
+
You can configure only the enabled attribute, which, when true, enables the default shortcut keys.
|
|
16
|
+
|
|
17
|
+
```tsx | pure
|
|
18
|
+
const lf = new LogicFlow({
|
|
19
|
+
container: document.querySelector('#app'),
|
|
20
|
+
keyboard: {
|
|
21
|
+
enabled: true,
|
|
22
|
+
},
|
|
23
|
+
})
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## 内置快捷键功能
|
|
27
|
+
|
|
28
|
+
Built-in shortcuts for copying, pasting, redoing/undoing, and deleting are available for different
|
|
29
|
+
products.
|
|
30
|
+
|
|
31
|
+
| Shortcuts | Functions |
|
|
32
|
+
|:--------------------|:-----------|
|
|
33
|
+
| cmd + c or ctrl + c | copy node |
|
|
34
|
+
| cmd + v or ctrl + v | Paste Node |
|
|
35
|
+
| cmd + z or ctrl + z | Undo |
|
|
36
|
+
| cmd + y or ctrl + y | Redo |
|
|
37
|
+
| backspace | Delete |
|
|
38
|
+
|
|
39
|
+
## Customized shortcuts
|
|
40
|
+
|
|
41
|
+
shortcuts allow you to define a user-defined set of shortcuts.
|
|
42
|
+
It is worth mentioning the rules for keys, which are consistent
|
|
43
|
+
with [mousetrap](https://www.npmjs.com/package/mousetrap).
|
|
44
|
+
|
|
45
|
+
Use a custom delete shortcut as an example: add a confirmation action before deletion.
|
|
46
|
+
|
|
47
|
+
```tsx | pure
|
|
48
|
+
const lf = new LogicFlow({
|
|
49
|
+
// ...
|
|
50
|
+
keyboard: {
|
|
51
|
+
enabled: true,
|
|
52
|
+
shortcuts: [
|
|
53
|
+
{
|
|
54
|
+
keys: ["backspace"],
|
|
55
|
+
callback: () => {
|
|
56
|
+
const r = window.confirm("Are you sure you want to delete it?");
|
|
57
|
+
if (r) {
|
|
58
|
+
const elements = lf.getSelectElements(true);
|
|
59
|
+
lf.clearSelectElements();
|
|
60
|
+
elements.edges.forEach((edge) => lf.deleteEdge(edge.id));
|
|
61
|
+
elements.nodes.forEach((node) => lf.deleteNode(node.id));
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
<a href="https://codesandbox.io/embed/logicflow-base10-eerft?fontsize=14&hidenavigation=1&theme=dark&view=preview" target="_blank"> Go to CodeSandbox for examples </a>
|