@logicflow/extension 2.2.0-alpha.7 → 2.2.1
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 +16 -0
- package/package.json +10 -7
- package/.turbo/turbo-build.log +0 -38
- package/CHANGELOG.md +0 -1829
- package/__test__/bpmn-adapter.test.js +0 -227
- package/es/materials/curved-edge/__test__/curved-edge.test.d.ts +0 -1
- package/es/materials/curved-edge/__test__/curved-edge.test.js +0 -18
- package/jest.config.js +0 -198
- package/lib/materials/curved-edge/__test__/curved-edge.test.d.ts +0 -1
- package/lib/materials/curved-edge/__test__/curved-edge.test.js +0 -20
- package/rollup.config.js +0 -52
- package/src/NodeResize/BasicShape/Ellipse.tsx +0 -22
- package/src/NodeResize/BasicShape/Polygon.tsx +0 -24
- package/src/NodeResize/BasicShape/Rect.tsx +0 -44
- package/src/NodeResize/control/Control.tsx +0 -537
- package/src/NodeResize/control/ControlGroup.tsx +0 -76
- package/src/NodeResize/control/Util.ts +0 -206
- package/src/NodeResize/index.ts +0 -26
- package/src/NodeResize/node/DiamondResize.tsx +0 -149
- package/src/NodeResize/node/EllipseResize.tsx +0 -140
- package/src/NodeResize/node/HtmlResize.tsx +0 -125
- package/src/NodeResize/node/RectResize.tsx +0 -126
- package/src/NodeResize/node/index.ts +0 -4
- package/src/bpmn/constant.ts +0 -56
- package/src/bpmn/events/EndEvent.ts +0 -73
- package/src/bpmn/events/StartEvent.ts +0 -52
- package/src/bpmn/events/index.ts +0 -2
- package/src/bpmn/flow/SequenceFlow.ts +0 -25
- package/src/bpmn/flow/index.ts +0 -1
- package/src/bpmn/gateways/ExclusiveGateway.ts +0 -71
- package/src/bpmn/gateways/index.ts +0 -1
- package/src/bpmn/getBpmnId.ts +0 -31
- package/src/bpmn/index.ts +0 -60
- package/src/bpmn/tasks/ServiceTask.ts +0 -63
- package/src/bpmn/tasks/UserTask.ts +0 -64
- package/src/bpmn/tasks/index.ts +0 -2
- package/src/bpmn-adapter/bpmnIds.ts +0 -31
- package/src/bpmn-adapter/index.ts +0 -835
- package/src/bpmn-adapter/json2xml.ts +0 -127
- package/src/bpmn-adapter/xml2json.ts +0 -544
- package/src/bpmn-elements/README.md +0 -223
- package/src/bpmn-elements/__tests__/definition.test.js +0 -72
- package/src/bpmn-elements/index.d.ts +0 -26
- package/src/bpmn-elements/index.ts +0 -107
- package/src/bpmn-elements/presets/Event/EndEventFactory.ts +0 -114
- package/src/bpmn-elements/presets/Event/IntermediateCatchEvent.ts +0 -108
- package/src/bpmn-elements/presets/Event/IntermediateThrowEvent.ts +0 -109
- package/src/bpmn-elements/presets/Event/StartEventFactory.ts +0 -114
- package/src/bpmn-elements/presets/Event/boundaryEventFactory.ts +0 -117
- package/src/bpmn-elements/presets/Event/index.ts +0 -14
- package/src/bpmn-elements/presets/Flow/flow.d.ts +0 -6
- package/src/bpmn-elements/presets/Flow/index.ts +0 -8
- package/src/bpmn-elements/presets/Flow/manhattan.ts +0 -691
- package/src/bpmn-elements/presets/Flow/sequenceFlow.ts +0 -65
- package/src/bpmn-elements/presets/Gateway/gateway.ts +0 -107
- package/src/bpmn-elements/presets/Gateway/index.ts +0 -23
- package/src/bpmn-elements/presets/Pool/Lane.ts +0 -211
- package/src/bpmn-elements/presets/Pool/Pool.ts +0 -284
- package/src/bpmn-elements/presets/Pool/index.ts +0 -89
- package/src/bpmn-elements/presets/Task/index.ts +0 -122
- package/src/bpmn-elements/presets/Task/subProcess.ts +0 -189
- package/src/bpmn-elements/presets/Task/task.ts +0 -193
- package/src/bpmn-elements/presets/icons.ts +0 -155
- package/src/bpmn-elements/utils.ts +0 -52
- package/src/bpmn-elements-adapter/README.md +0 -293
- package/src/bpmn-elements-adapter/__tests__/adapter_in.test.js +0 -528
- package/src/bpmn-elements-adapter/__tests__/adapter_out.test.js +0 -569
- package/src/bpmn-elements-adapter/constant.ts +0 -76
- package/src/bpmn-elements-adapter/index.ts +0 -1134
- package/src/bpmn-elements-adapter/json2xml.ts +0 -105
- package/src/bpmn-elements-adapter/xml2json.ts +0 -542
- package/src/components/context-menu/index.ts +0 -253
- package/src/components/control/index.ts +0 -155
- package/src/components/dnd-panel/index.ts +0 -137
- package/src/components/highlight/index.ts +0 -227
- package/src/components/menu/index.ts +0 -748
- package/src/components/mini-map/index.ts +0 -686
- package/src/components/selection-select/index.ts +0 -387
- package/src/dynamic-group/index.ts +0 -774
- package/src/dynamic-group/model.ts +0 -580
- package/src/dynamic-group/node.ts +0 -288
- package/src/dynamic-group/utils.ts +0 -46
- package/src/index.less +0 -1
- package/src/index.ts +0 -47
- package/src/insert-node-in-polyline/edge.ts +0 -175
- package/src/insert-node-in-polyline/index.ts +0 -193
- package/src/materials/curved-edge/__test__/curved-edge.test.ts +0 -46
- package/src/materials/curved-edge/index.ts +0 -217
- package/src/materials/group/GroupNode.ts +0 -437
- package/src/materials/group/index.ts +0 -542
- package/src/materials/node-selection/index.ts +0 -380
- package/src/mindmap/fakerRoot.ts +0 -19
- package/src/mindmap/index.ts +0 -328
- package/src/mindmap/markContent.ts +0 -81
- package/src/mindmap/markContentOption.ts +0 -81
- package/src/mindmap/markEntity.ts +0 -82
- package/src/mindmap/markRoot.ts +0 -83
- package/src/mindmap/theme.ts +0 -11
- package/src/pool/LaneModel.ts +0 -226
- package/src/pool/LaneView.ts +0 -220
- package/src/pool/PoolModel.ts +0 -631
- package/src/pool/PoolView.ts +0 -75
- package/src/pool/constant.ts +0 -19
- package/src/pool/index.ts +0 -621
- package/src/pool/utils.ts +0 -46
- package/src/rect-label-node/RectLabelNodeView.ts +0 -33
- package/src/rect-label-node/index.ts +0 -15
- package/src/style/index.less +0 -381
- package/src/style/raw.ts +0 -328
- package/src/tools/auto-layout/index.ts +0 -282
- package/src/tools/flow-path/index.ts +0 -233
- package/src/tools/label/Label.tsx +0 -357
- package/src/tools/label/LabelModel.ts +0 -83
- package/src/tools/label/LabelOverlay.tsx +0 -162
- package/src/tools/label/algorithm.ts +0 -42
- package/src/tools/label/index.ts +0 -479
- package/src/tools/label/mediumEditor.ts +0 -121
- package/src/tools/label/utils.ts +0 -395
- package/src/tools/proximity-connect/index.ts +0 -435
- package/src/tools/snapshot/README.md +0 -145
- package/src/tools/snapshot/index.ts +0 -701
- package/src/tools/snapshot/utils.ts +0 -163
- package/src/turbo-adapter/index.ts +0 -212
- package/stats.html +0 -4842
- package/tsconfig.json +0 -18
package/src/pool/LaneModel.ts
DELETED
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 基于DynamicGroup重新实现的泳道节点组件
|
|
3
|
-
* 继承DynamicGroupNodeModel和DynamicGroupNode,提供泳道特定功能
|
|
4
|
-
*/
|
|
5
|
-
import LogicFlow from '@logicflow/core'
|
|
6
|
-
import { DynamicGroupNodeModel } from '../dynamic-group'
|
|
7
|
-
import { forEach } from 'lodash-es'
|
|
8
|
-
import { laneConfig } from './constant'
|
|
9
|
-
|
|
10
|
-
export class LaneModel extends DynamicGroupNodeModel {
|
|
11
|
-
readonly isLane: boolean = true
|
|
12
|
-
defaultZIndex: number = -1
|
|
13
|
-
|
|
14
|
-
initNodeData(data: LogicFlow.NodeConfig) {
|
|
15
|
-
super.initNodeData(data)
|
|
16
|
-
// 泳道特定配置
|
|
17
|
-
this.width = data.width || laneConfig.defaultWidth
|
|
18
|
-
this.height = data.height || laneConfig.defaultHeight
|
|
19
|
-
this.draggable = true // 允许拖拽(实际拖拽逻辑由泳池控制)
|
|
20
|
-
this.resizable = true // 允许调整大小
|
|
21
|
-
this.rotatable = false // 禁止旋转
|
|
22
|
-
|
|
23
|
-
// 设置泳道层级
|
|
24
|
-
// 如果传入了zIndex,使用传入的值,否则默认为2
|
|
25
|
-
// 泳道层级应该比所属泳池高,确保显示在泳池上方
|
|
26
|
-
this.defaultZIndex = data.zIndex || -1
|
|
27
|
-
this.setZIndex(this.defaultZIndex)
|
|
28
|
-
this.autoToFront = true
|
|
29
|
-
|
|
30
|
-
this.text.editable = true
|
|
31
|
-
this.style.stroke = '#000'
|
|
32
|
-
this.style.strokeWidth = 1
|
|
33
|
-
|
|
34
|
-
// 泳道属性配置
|
|
35
|
-
this.properties = {
|
|
36
|
-
...this.properties,
|
|
37
|
-
processRef: '', // 流程引用标识
|
|
38
|
-
panels: ['processRef'], // 可配置面板
|
|
39
|
-
direction: data.properties?.direction || 'vertical',
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// 设置折叠尺寸(泳道不支持折叠,设置为与正常尺寸相同)
|
|
43
|
-
this.collapsedWidth = this.width
|
|
44
|
-
this.collapsedHeight = this.height
|
|
45
|
-
this.expandWidth = this.width
|
|
46
|
-
this.expandHeight = this.height
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
setAttributes(): void {
|
|
50
|
-
super.setAttributes()
|
|
51
|
-
this.updateTextPosition()
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
setZIndex(zIndex: number) {
|
|
55
|
-
this.zIndex = Math.min(zIndex, this.defaultZIndex) || this.defaultZIndex
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* 重写折叠方法 - 泳道不支持折叠
|
|
60
|
-
*/
|
|
61
|
-
toggleCollapse() {
|
|
62
|
-
// 泳道不支持折叠功能,保持展开状态
|
|
63
|
-
this.isCollapsed = false
|
|
64
|
-
this.setProperties({ isCollapsed: false })
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* 获取所属泳池ID
|
|
69
|
-
*/
|
|
70
|
-
getPoolId(): string | null {
|
|
71
|
-
try {
|
|
72
|
-
// 检查graphModel是否存在
|
|
73
|
-
if (!this.graphModel) {
|
|
74
|
-
console.warn('GraphModel is not available')
|
|
75
|
-
return null
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// 安全地获取泳池ID
|
|
79
|
-
const poolModel = this.graphModel.nodes.find((node) => {
|
|
80
|
-
return node.children && node.children.has(this.id)
|
|
81
|
-
})
|
|
82
|
-
return poolModel?.id || null
|
|
83
|
-
} catch (error) {
|
|
84
|
-
console.error('Error getting pool ID:', error)
|
|
85
|
-
return null
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* 获取所属泳池模型
|
|
91
|
-
*/
|
|
92
|
-
getPoolModel(): any {
|
|
93
|
-
try {
|
|
94
|
-
const poolId = this.getPoolId()
|
|
95
|
-
if (!poolId) {
|
|
96
|
-
return null
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// 检查graphModel是否存在
|
|
100
|
-
if (!this.graphModel) {
|
|
101
|
-
console.warn('GraphModel is not available for getting pool model')
|
|
102
|
-
return null
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const poolModel = this.graphModel.getNodeModelById(poolId)
|
|
106
|
-
return poolModel || null
|
|
107
|
-
} catch (error) {
|
|
108
|
-
console.error('Error getting pool model:', error)
|
|
109
|
-
return null
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* 动态修改泳道属性
|
|
115
|
-
*/
|
|
116
|
-
changeAttribute({ width, height, x, y }: any) {
|
|
117
|
-
if (width) this.width = width // 更新宽度
|
|
118
|
-
if (height) this.height = height // 更新高度
|
|
119
|
-
if (x) this.x = x // 更新X坐标
|
|
120
|
-
if (y) this.y = y // 更新Y坐标
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* 重写获取数据方法,添加泳道特定属性
|
|
125
|
-
*/
|
|
126
|
-
getData(): LogicFlow.NodeData {
|
|
127
|
-
const data = super.getData()
|
|
128
|
-
// const poolModel = this.getPoolModel()
|
|
129
|
-
return {
|
|
130
|
-
...data,
|
|
131
|
-
properties: {
|
|
132
|
-
...data.properties,
|
|
133
|
-
width: this.width,
|
|
134
|
-
height: this.height,
|
|
135
|
-
processRef: this.properties.processRef,
|
|
136
|
-
direction: this.properties.direction,
|
|
137
|
-
},
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* 重写 isAllowAppendIn,禁止 Lane 嵌套
|
|
142
|
-
*/
|
|
143
|
-
isAllowAppendIn(nodeData: LogicFlow.NodeData): boolean {
|
|
144
|
-
// 禁止 Lane 节点被添加到 Lane 中
|
|
145
|
-
return String(nodeData.type) !== 'lane'
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* 获取需要移动的节点
|
|
150
|
-
* @param groupModel
|
|
151
|
-
*/
|
|
152
|
-
getNodesInGroup(groupModel: DynamicGroupNodeModel): string[] {
|
|
153
|
-
const nodeIds: string[] = []
|
|
154
|
-
const {
|
|
155
|
-
properties: { parent },
|
|
156
|
-
isDragging,
|
|
157
|
-
} = groupModel
|
|
158
|
-
if (isDragging && parent) {
|
|
159
|
-
nodeIds.push(parent as string)
|
|
160
|
-
}
|
|
161
|
-
forEach(Array.from(groupModel.children), (nodeId: string) => {
|
|
162
|
-
const nodeModel = this.graphModel.getNodeModelById(nodeId)
|
|
163
|
-
// 只有非 Lane 类型的节点才会被带动
|
|
164
|
-
if (
|
|
165
|
-
nodeModel &&
|
|
166
|
-
!nodeModel.isDragging &&
|
|
167
|
-
String(nodeModel.type) !== 'lane'
|
|
168
|
-
) {
|
|
169
|
-
nodeIds.push(nodeId)
|
|
170
|
-
}
|
|
171
|
-
})
|
|
172
|
-
return nodeIds
|
|
173
|
-
}
|
|
174
|
-
getNodeStyle() {
|
|
175
|
-
const style = super.getNodeStyle()
|
|
176
|
-
style.strokeWidth = 2
|
|
177
|
-
return style
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* 获取文本样式
|
|
181
|
-
*/
|
|
182
|
-
getTextStyle() {
|
|
183
|
-
const { isHorizontal = false } = this.properties
|
|
184
|
-
const style = super.getTextStyle()
|
|
185
|
-
style.overflowMode = 'ellipsis'
|
|
186
|
-
style.strokeWidth = 2
|
|
187
|
-
style.textWidth = isHorizontal ? this.height : this.width
|
|
188
|
-
style.textHeight = isHorizontal ? this.width : this.height
|
|
189
|
-
if (isHorizontal) {
|
|
190
|
-
style.transform = 'rotate(-90deg)'
|
|
191
|
-
style.textAlign = 'center'
|
|
192
|
-
}
|
|
193
|
-
return style
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* 获取子泳道
|
|
198
|
-
*/
|
|
199
|
-
getSubNodes() {
|
|
200
|
-
const children: any[] = []
|
|
201
|
-
Array.from(this.children).forEach((childId) => {
|
|
202
|
-
const childModel = this.graphModel.getNodeModelById(childId)
|
|
203
|
-
if (childModel) {
|
|
204
|
-
children.push(childModel)
|
|
205
|
-
}
|
|
206
|
-
})
|
|
207
|
-
return children
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* 初始化文本位置 - 根据布局方向设置文本位置
|
|
212
|
-
*/
|
|
213
|
-
updateTextPosition() {
|
|
214
|
-
if (this.properties.isHorizontal) {
|
|
215
|
-
// 横向泳池:文本显示在左侧标题区域
|
|
216
|
-
this.text.x = this.x - this.width / 2 + laneConfig.titleSize / 2
|
|
217
|
-
this.text.y = this.y
|
|
218
|
-
} else {
|
|
219
|
-
// 纵向泳池:文本显示在顶部标题区域
|
|
220
|
-
this.text.x = this.x
|
|
221
|
-
this.text.y = this.y - this.height / 2 + laneConfig.titleSize / 2
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
export default null
|
package/src/pool/LaneView.ts
DELETED
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 基于DynamicGroup重新实现的泳道节点组件
|
|
3
|
-
* 继承DynamicGroupNodeModel和DynamicGroupNode,提供泳道特定功能
|
|
4
|
-
*/
|
|
5
|
-
import { h } from '@logicflow/core'
|
|
6
|
-
import { DynamicGroupNode } from '../dynamic-group'
|
|
7
|
-
import { laneConfig } from './constant'
|
|
8
|
-
import { LaneModel } from './LaneModel'
|
|
9
|
-
|
|
10
|
-
export class LaneView extends DynamicGroupNode {
|
|
11
|
-
getAppendAreaShape(): h.JSX.Element | null {
|
|
12
|
-
// DONE: 此区域用于初始化 group container, 即元素拖拽进入感应区域
|
|
13
|
-
const { model } = this.props
|
|
14
|
-
const { width, height, x, y, radius, groupAddable } = model
|
|
15
|
-
if (!groupAddable) return null
|
|
16
|
-
|
|
17
|
-
const { strokeWidth = 0 } = model.getNodeStyle()
|
|
18
|
-
const style = model.getAddableOutlineStyle()
|
|
19
|
-
|
|
20
|
-
const newWidth = width + strokeWidth + 8
|
|
21
|
-
const newHeight = height + strokeWidth + 8
|
|
22
|
-
return h('rect', {
|
|
23
|
-
...style,
|
|
24
|
-
width: newWidth,
|
|
25
|
-
height: newHeight,
|
|
26
|
-
x: x - newWidth / 2,
|
|
27
|
-
y: y - newHeight / 2,
|
|
28
|
-
rx: radius,
|
|
29
|
-
ry: radius,
|
|
30
|
-
})
|
|
31
|
-
}
|
|
32
|
-
getShape() {
|
|
33
|
-
const { model } = this.props
|
|
34
|
-
const {
|
|
35
|
-
x,
|
|
36
|
-
y,
|
|
37
|
-
width,
|
|
38
|
-
height,
|
|
39
|
-
properties: { textStyle: customTextStyle = {}, isHorizontal },
|
|
40
|
-
} = model
|
|
41
|
-
const style = model.getNodeStyle()
|
|
42
|
-
const base = { fill: '#ffffff', stroke: '#000000', strokeWidth: 1 }
|
|
43
|
-
const left = x - width / 2
|
|
44
|
-
const top = y - height / 2
|
|
45
|
-
// 泳道主体
|
|
46
|
-
const rectAttrs = {
|
|
47
|
-
x: x - width / 2,
|
|
48
|
-
y: y - height / 2,
|
|
49
|
-
width,
|
|
50
|
-
height,
|
|
51
|
-
stroke: '#000000',
|
|
52
|
-
strokeWidth: 2,
|
|
53
|
-
fill: 'transparent',
|
|
54
|
-
...style,
|
|
55
|
-
}
|
|
56
|
-
// 操作图标区域
|
|
57
|
-
const icons = this.getOperateIcons()
|
|
58
|
-
const titleRect = {
|
|
59
|
-
...base,
|
|
60
|
-
...style,
|
|
61
|
-
x: isHorizontal ? left + laneConfig.titleSize : left,
|
|
62
|
-
y: isHorizontal ? top : top + laneConfig.titleSize,
|
|
63
|
-
width: isHorizontal ? width - laneConfig.titleSize : width,
|
|
64
|
-
height: isHorizontal ? height : laneConfig.titleSize,
|
|
65
|
-
...(isHorizontal ? customTextStyle : {}),
|
|
66
|
-
}
|
|
67
|
-
return h('g', {}, [
|
|
68
|
-
this.getAppendAreaShape(),
|
|
69
|
-
h('rect', titleRect),
|
|
70
|
-
h('rect', { ...rectAttrs }),
|
|
71
|
-
...icons,
|
|
72
|
-
])
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* 获取操作图标
|
|
77
|
-
*/
|
|
78
|
-
getOperateIcons() {
|
|
79
|
-
const { model } = this.props
|
|
80
|
-
const { isSelected } = model
|
|
81
|
-
if (!isSelected) {
|
|
82
|
-
return []
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const poolModel = (model as LaneModel).getPoolModel()
|
|
86
|
-
if (!poolModel) {
|
|
87
|
-
return []
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const { isHorizontal } = poolModel
|
|
91
|
-
const laneData = model.getData()
|
|
92
|
-
|
|
93
|
-
return [
|
|
94
|
-
this.addBeforeLaneIcon(isHorizontal, () =>
|
|
95
|
-
isHorizontal
|
|
96
|
-
? poolModel.addChildAbove?.(laneData)
|
|
97
|
-
: poolModel.addChildRight?.(laneData),
|
|
98
|
-
),
|
|
99
|
-
this.addAfterLaneIcon(isHorizontal, () =>
|
|
100
|
-
isHorizontal
|
|
101
|
-
? poolModel.addChildBelow?.(laneData)
|
|
102
|
-
: poolModel.addChildLeft?.(laneData),
|
|
103
|
-
),
|
|
104
|
-
this.deleteLaneIcon(() => poolModel.deleteChild?.(laneData.id)),
|
|
105
|
-
]
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
addBeforeLaneIcon(isHorizontal: boolean, callback: () => void) {
|
|
109
|
-
const { x, y, width, height } = this.props.model
|
|
110
|
-
// 图标与泳道之间加固定的间距
|
|
111
|
-
const positionX = x + width / 2 + laneConfig.iconSpacing
|
|
112
|
-
const positionY = y - height / 2
|
|
113
|
-
const baseAttr = {
|
|
114
|
-
width: laneConfig.iconSize / 2,
|
|
115
|
-
height: laneConfig.iconSize,
|
|
116
|
-
strokeWidth: 1,
|
|
117
|
-
fill: '#fff',
|
|
118
|
-
stroke: '#000',
|
|
119
|
-
x: positionX,
|
|
120
|
-
y: positionY,
|
|
121
|
-
}
|
|
122
|
-
let iconView: h.JSX.Element[] = [
|
|
123
|
-
h('rect', {
|
|
124
|
-
...baseAttr,
|
|
125
|
-
x: positionX + laneConfig.iconSize / 2,
|
|
126
|
-
strokeDasharray: '2 2',
|
|
127
|
-
}),
|
|
128
|
-
h('rect', baseAttr),
|
|
129
|
-
]
|
|
130
|
-
if (isHorizontal) {
|
|
131
|
-
iconView = [
|
|
132
|
-
h('rect', {
|
|
133
|
-
...baseAttr,
|
|
134
|
-
width: laneConfig.iconSize,
|
|
135
|
-
height: laneConfig.iconSize / 2,
|
|
136
|
-
strokeDasharray: '2 2',
|
|
137
|
-
}),
|
|
138
|
-
h('rect', {
|
|
139
|
-
...baseAttr,
|
|
140
|
-
width: laneConfig.iconSize,
|
|
141
|
-
height: laneConfig.iconSize / 2,
|
|
142
|
-
y: positionY + laneConfig.iconSize / 2,
|
|
143
|
-
}),
|
|
144
|
-
]
|
|
145
|
-
}
|
|
146
|
-
return h('g', { cursor: 'pointer', onClick: callback }, iconView)
|
|
147
|
-
}
|
|
148
|
-
addAfterLaneIcon(isHorizontal: boolean, callback: () => void) {
|
|
149
|
-
const { x, y, width, height } = this.props.model
|
|
150
|
-
const positionX = x + width / 2 + laneConfig.iconSpacing
|
|
151
|
-
const positionY =
|
|
152
|
-
y - height / 2 + laneConfig.iconSize + laneConfig.iconSpacing
|
|
153
|
-
const baseAttr = {
|
|
154
|
-
width: laneConfig.iconSize / 2,
|
|
155
|
-
height: laneConfig.iconSize,
|
|
156
|
-
strokeWidth: 1,
|
|
157
|
-
fill: '#fff',
|
|
158
|
-
stroke: '#000',
|
|
159
|
-
x: positionX,
|
|
160
|
-
y: positionY,
|
|
161
|
-
}
|
|
162
|
-
let iconView: h.JSX.Element[] = [
|
|
163
|
-
h('rect', {
|
|
164
|
-
...baseAttr,
|
|
165
|
-
x: positionX + laneConfig.iconSize / 2,
|
|
166
|
-
}),
|
|
167
|
-
h('rect', {
|
|
168
|
-
...baseAttr,
|
|
169
|
-
strokeDasharray: '2 2',
|
|
170
|
-
}),
|
|
171
|
-
]
|
|
172
|
-
if (isHorizontal) {
|
|
173
|
-
iconView = [
|
|
174
|
-
h('rect', {
|
|
175
|
-
...baseAttr,
|
|
176
|
-
width: laneConfig.iconSize,
|
|
177
|
-
height: laneConfig.iconSize / 2,
|
|
178
|
-
}),
|
|
179
|
-
h('rect', {
|
|
180
|
-
...baseAttr,
|
|
181
|
-
width: laneConfig.iconSize,
|
|
182
|
-
height: laneConfig.iconSize / 2,
|
|
183
|
-
y: positionY + laneConfig.iconSize / 2,
|
|
184
|
-
strokeDasharray: '2 2',
|
|
185
|
-
}),
|
|
186
|
-
]
|
|
187
|
-
}
|
|
188
|
-
return h('g', { cursor: 'pointer', onClick: callback }, iconView)
|
|
189
|
-
}
|
|
190
|
-
deleteLaneIcon(callback: () => void) {
|
|
191
|
-
const { x, y, width, height } = this.props.model
|
|
192
|
-
const positionX = x + width / 2 + laneConfig.iconSpacing
|
|
193
|
-
const positionY =
|
|
194
|
-
y - height / 2 + (laneConfig.iconSize + laneConfig.iconSpacing) * 3
|
|
195
|
-
return h(
|
|
196
|
-
'g',
|
|
197
|
-
{
|
|
198
|
-
cursor: 'pointer',
|
|
199
|
-
onClick: callback,
|
|
200
|
-
width: laneConfig.iconSize,
|
|
201
|
-
height: laneConfig.iconSize,
|
|
202
|
-
transform: `translate(${positionX}, ${positionY})`,
|
|
203
|
-
},
|
|
204
|
-
[
|
|
205
|
-
h('rect', {
|
|
206
|
-
width: laneConfig.iconSize,
|
|
207
|
-
height: laneConfig.iconSize,
|
|
208
|
-
fill: 'transparent',
|
|
209
|
-
}),
|
|
210
|
-
h('path', {
|
|
211
|
-
transform: `translate(2, 1) scale(${laneConfig.iconSize / 18})`,
|
|
212
|
-
fill: '#000',
|
|
213
|
-
d: 'M1.6361705,0.07275847000000002L1.6362224,0.07267305000000002L5.1435161,2.2034403L6.3516493,1.28341734Q7.2009554,0.63665058,8.0902505,1.22722644L10.1215935,2.5762291Q11.006711,3.1640306,10.745867,4.1940317L10.4062386,5.5351257L13.625054,7.5778356L13.625001,7.5779204Q13.678322,7.6117587,13.721552,7.6577945Q13.764784,7.7038307,13.795207,7.7591715Q13.82563,7.8145118,13.841336,7.87568Q13.857041,7.9368477,13.857041,8Q13.85704,8.0492353,13.847435,8.0975251Q13.83783,8.145814900000001,13.818987,8.191302799999999Q13.800144,8.2367907,13.772791,8.2777286Q13.745438,8.318666499999999,13.710623,8.3534818Q13.675808,8.3882966,13.63487,8.4156504Q13.593931,8.4430046,13.548444,8.461846399999999Q13.502956,8.4806881,13.454666,8.4902935Q13.406377,8.4998994,13.357141,8.499899899999999Q13.211908,8.499899899999999,13.089283,8.4220805L13.08923,8.4221654L4.9074116,3.229857L1.1170242400000001,0.92732695L1.1170761599999999,0.92724147Q1.06204063,0.8938076500000001,1.0172748,0.84751782Q0.97250897,0.80122799,0.9409355500000001,0.74510445Q0.9093622,0.68898091,0.89304277,0.626688Q0.87672335,0.564395107,0.87672332,0.5Q0.8767232899999999,0.450764146,0.88632876,0.402474351Q0.8959341599999999,0.35418455,0.91477591,0.30869657Q0.93361765,0.26320857,0.9609716500000001,0.22227046Q0.9883256,0.18133234999999998,1.02314061,0.14651734Q1.05795562,0.11170232000000002,1.0988937,0.08434838Q1.13983184,0.056994409999999995,1.18531984,0.038152660000000005Q1.2308077800000001,0.019310890000000025,1.27909762,0.009705450000000004Q1.32738745,0.00010001999999997846,1.3766233300000001,0.00009998999999999425Q1.516567,0.00009998999999999425,1.6361705,0.07275847000000002ZM9.5175018,4.9711194L9.7764683,3.9485345Q9.8634167,3.6052005,9.5683784,3.4092672L7.537035,2.0602646Q7.240603,1.8634058,6.9575009,2.0789949L6.0496349,2.7703574L9.5175018,4.9711194ZM11.227273,14.5L11.227273,9.7307692L11.227173,9.7307692Q11.227173,9.6815329,11.217567,9.6332426Q11.207962,9.5849533,11.189119,9.539465Q11.170278,9.4939766,11.142924,9.4530392Q11.11557,9.4121017,11.080755,9.3772869Q11.04594,9.3424721,11.005002,9.3151178Q10.964064,9.2877636,10.918575,9.2689209Q10.873087,9.2500801,10.824797,9.2404747Q10.776508,9.2308693,10.727273,9.2308693Q10.678036,9.2308693,10.629745,9.2404747Q10.581455,9.2500801,10.535968,9.2689209Q10.4904804,9.2877636,10.449542,9.3151178Q10.4086046,9.3424721,10.3737898,9.377286Q10.338975,9.4121008,10.3116207,9.4530382Q10.2842674,9.4939766,10.2654257,9.539465Q10.2465839,9.5849533,10.2369785,9.6332426Q10.2273731,9.6815329,10.2273731,9.7307692L10.2272739,9.7307692L10.2272739,14.5Q10.2272739,15,9.727273,15L7.7207794,15L7.7207789,8.2500091L7.7206788,8.2500091Q7.7206783,8.2007728,7.7110729,8.152483Q7.7014675,8.104193200000001,7.6826253,8.0587053Q7.6637836,8.013217000000001,7.6364298,7.9722791Q7.6090755,7.9313412,7.5742612,7.8965263Q7.5394459,7.861711,7.4985075,7.8343568Q7.4575696,7.807003,7.4120817,7.7881613Q7.3665934,7.7693195,7.3183041,7.7597141Q7.2700143,7.7501092,7.2207789,7.7501092Q7.1715426,7.7501092,7.1232524,7.7597141Q7.0749626,7.7693195,7.0294747,7.7881613Q6.9839869,7.807003,6.943049,7.8343573Q6.9021111,7.861711,6.8672962,7.8965263Q6.8324809,7.9313412,6.8051271,7.9722791Q6.7777729,8.013217000000001,6.7589312,8.0587053Q6.7400894,8.1041937,6.7304845,8.1524839Q6.7208786,8.2007732,6.7208791,8.2500095L6.7207789,8.2500091L6.7207794,15L4.2142854,15L4.2142854,6.2692308L4.2141855,6.2692308Q4.2141852,6.2199945,4.204579799999999,6.1717048Q4.1949743999999995,6.123415,4.1761324,6.0779266Q4.1572905,6.0324383,4.1299367,5.9915004Q4.1025827,5.9505625,4.0677679,5.9157476Q4.0329528,5.8809328,3.9920146,5.8535786Q3.9510765,5.8262248,3.9055884,5.8073831Q3.8601003,5.7885418,3.811811,5.7789364Q3.7635212,5.769331,3.7142854,5.769331Q3.6650493,5.769331,3.6167595,5.7789364Q3.5684695,5.7885418,3.5229816,5.8073831Q3.4774938,5.8262248,3.4365554,5.8535786Q3.3956175,5.8809328,3.3608027,5.9157476Q3.3259873,5.9505625,3.2986333,5.9915004Q3.2712793,6.0324383,3.2524376,6.0779266Q3.2335958,6.123415,3.2239904,6.1717048Q3.214385,6.2199945,3.2143853,6.2692308L3.2142854,6.2692308L3.2142854,15L1.5000002,15Q1.0000001200000002,15,1.0000001200000002,14.5L1,5.4150848Q1,5.0384622,1.3766233300000001,5.0384622L1.3766233300000001,5.0383615Q1.42585915,5.0383615,1.47414887,5.0287557Q1.5224386,5.0191503,1.5679266,5.0003085Q1.6134146,4.9814663,1.6543528,4.954113Q1.695291,4.9267588,1.730106,4.8919439Q1.7649209,4.8571291,1.792275,4.8161907Q1.8196288,4.7752523,1.8384706,4.7297645Q1.8573124,4.6842766,1.8669178,4.6359868Q1.8765233,4.587697,1.8765234,4.5384617Q1.8765233,4.4892254000000005,1.8669178,4.4409355999999995Q1.8573124,4.3926458,1.8384707,4.3471577Q1.819629,4.3016696,1.792275,4.2607315Q1.7649209,4.2197936,1.730106,4.1849787Q1.695291,4.1501637,1.6543529,4.1228096Q1.6134148,4.0954556,1.5679268,4.0766139Q1.5224388,4.0577724,1.4741489300000001,4.048166999999999Q1.42585915,4.0385615999999995,1.3766233300000001,4.0385615999999995L1.3766233300000001,4.0384617Q0.8064074800000001,4.0384617,0.403203636,4.4416654Q0,4.8448691,0,5.4150848L9.000000000813912e-8,14.5Q2.9999999984209325e-8,15.121321,0.439339694,15.56066Q0.8786805,16.000002000000002,1.5000002,16.000002000000002L9.727273,16.000002000000002Q10.3485928,16.000002000000002,10.787933,15.56066Q11.227273,15.121321,11.227273,14.5Z',
|
|
214
|
-
}),
|
|
215
|
-
],
|
|
216
|
-
)
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
export default null
|