@logicflow/extension 2.2.0 → 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/dist/index.css +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/es/NodeResize/node/RectResize.d.ts +0 -6
- package/es/NodeResize/node/RectResize.js +2 -11
- package/es/bpmn-elements-adapter/json2xml.d.ts +2 -1
- package/es/bpmn-elements-adapter/json2xml.js +18 -4
- package/es/bpmn-elements-adapter/xml2json.js +2 -7
- package/es/components/control/index.d.ts +1 -0
- package/es/components/control/index.js +24 -11
- package/es/components/mini-map/index.js +1 -1
- package/es/dynamic-group/model.d.ts +2 -1
- package/es/dynamic-group/model.js +28 -11
- package/es/dynamic-group/node.js +1 -0
- package/es/index.css +1 -1
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -0
- package/es/insert-node-in-polyline/index.js +11 -35
- package/es/materials/curved-edge/index.js +49 -21
- package/es/materials/group/GroupNode.d.ts +0 -6
- package/es/materials/group/GroupNode.js +1 -6
- package/es/pool/LaneModel.d.ts +90 -0
- package/es/pool/LaneModel.js +252 -0
- package/es/pool/LaneView.d.ts +40 -0
- package/es/pool/LaneView.js +202 -0
- package/es/pool/PoolModel.d.ts +120 -0
- package/es/pool/PoolModel.js +586 -0
- package/es/pool/PoolView.d.ts +17 -0
- package/es/pool/PoolView.js +76 -0
- package/es/pool/constant.d.ts +15 -0
- package/es/pool/constant.js +17 -0
- package/es/pool/index.d.ts +89 -0
- package/es/pool/index.js +524 -0
- package/es/pool/utils.d.ts +19 -0
- package/es/pool/utils.js +33 -0
- package/es/style/index.css +1 -1
- package/es/style/raw.d.ts +1 -1
- package/es/style/raw.js +1 -1
- package/es/tools/label/LabelOverlay.js +3 -3
- package/es/tools/label/mediumEditor.d.ts +1 -1
- package/es/tools/label/mediumEditor.js +89 -52
- package/es/tools/snapshot/index.d.ts +7 -3
- package/es/tools/snapshot/index.js +72 -77
- package/lib/NodeResize/node/RectResize.d.ts +0 -6
- package/lib/NodeResize/node/RectResize.js +1 -10
- package/lib/bpmn-elements-adapter/json2xml.d.ts +2 -1
- package/lib/bpmn-elements-adapter/json2xml.js +19 -4
- package/lib/bpmn-elements-adapter/xml2json.js +2 -7
- package/lib/components/control/index.d.ts +1 -0
- package/lib/components/control/index.js +24 -11
- package/lib/components/mini-map/index.js +1 -1
- package/lib/dynamic-group/model.d.ts +2 -1
- package/lib/dynamic-group/model.js +28 -11
- package/lib/dynamic-group/node.js +1 -0
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -0
- package/lib/insert-node-in-polyline/index.js +10 -34
- package/lib/materials/curved-edge/index.js +49 -21
- package/lib/materials/group/GroupNode.d.ts +0 -6
- package/lib/materials/group/GroupNode.js +1 -6
- package/lib/pool/LaneModel.d.ts +90 -0
- package/lib/pool/LaneModel.js +255 -0
- package/lib/pool/LaneView.d.ts +40 -0
- package/lib/pool/LaneView.js +205 -0
- package/lib/pool/PoolModel.d.ts +120 -0
- package/lib/pool/PoolModel.js +589 -0
- package/lib/pool/PoolView.d.ts +17 -0
- package/lib/pool/PoolView.js +79 -0
- package/lib/pool/constant.d.ts +15 -0
- package/lib/pool/constant.js +20 -0
- package/lib/pool/index.d.ts +89 -0
- package/lib/pool/index.js +527 -0
- package/lib/pool/utils.d.ts +19 -0
- package/lib/pool/utils.js +38 -0
- package/lib/style/index.css +1 -1
- package/lib/style/raw.d.ts +1 -1
- package/lib/style/raw.js +1 -1
- package/lib/tools/label/LabelOverlay.js +2 -2
- package/lib/tools/label/mediumEditor.d.ts +1 -1
- package/lib/tools/label/mediumEditor.js +91 -53
- package/lib/tools/snapshot/index.d.ts +7 -3
- package/lib/tools/snapshot/index.js +72 -77
- package/package.json +10 -7
- package/.turbo/turbo-build.log +0 -38
- package/CHANGELOG.md +0 -1766
- 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 -146
- 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 -91
- package/src/bpmn-elements-adapter/xml2json.ts +0 -548
- package/src/components/context-menu/index.ts +0 -253
- package/src/components/control/index.ts +0 -141
- 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 -775
- package/src/dynamic-group/model.ts +0 -562
- 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 -45
- package/src/insert-node-in-polyline/edge.ts +0 -175
- package/src/insert-node-in-polyline/index.ts +0 -187
- package/src/materials/curved-edge/__test__/curved-edge.test.ts +0 -46
- package/src/materials/curved-edge/index.ts +0 -185
- package/src/materials/group/GroupNode.ts +0 -442
- 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/rect-label-node/RectLabelNodeView.ts +0 -33
- package/src/rect-label-node/index.ts +0 -15
- package/src/style/index.less +0 -342
- package/src/style/raw.ts +0 -295
- 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 -158
- package/src/tools/label/algorithm.ts +0 -42
- package/src/tools/label/index.ts +0 -479
- package/src/tools/label/mediumEditor.ts +0 -94
- 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 -718
- 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
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
export enum ModelType {
|
|
2
|
-
NODE = 'node',
|
|
3
|
-
CIRCLE_NODE = 'circle-node',
|
|
4
|
-
POLYGON_NODE = 'polygon-node',
|
|
5
|
-
RECT_NODE = 'rect-node',
|
|
6
|
-
HTML_NODE = 'html-node',
|
|
7
|
-
TEXT_NODE = 'text-node',
|
|
8
|
-
ELLIPSE_NODE = 'ellipse-node',
|
|
9
|
-
DIAMOND_NODE = 'diamond-node',
|
|
10
|
-
EDGE = 'edge',
|
|
11
|
-
LINE_EDGE = 'line-edge',
|
|
12
|
-
POLYLINE_EDGE = 'polyline-edge',
|
|
13
|
-
BEZIER_EDGE = 'bezier-edge',
|
|
14
|
-
GRAPH = 'graph',
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// 计算节点的box四角数据
|
|
18
|
-
function getNodeBox(node) {
|
|
19
|
-
const { x, y, width, height } = node
|
|
20
|
-
return {
|
|
21
|
-
minX: x - width / 2,
|
|
22
|
-
minY: y - height / 2,
|
|
23
|
-
maxX: x + width / 2,
|
|
24
|
-
maxY: y + height / 2,
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// 计算矩形radius设置后,四个圆角的圆心
|
|
29
|
-
function getRadiusCenter(node) {
|
|
30
|
-
const nodeBox = getNodeBox(node)
|
|
31
|
-
const { radius } = node
|
|
32
|
-
const { minX, minY, maxX, maxY } = nodeBox
|
|
33
|
-
return [
|
|
34
|
-
{
|
|
35
|
-
x: minX + radius,
|
|
36
|
-
y: minY + radius,
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
x: maxX - radius,
|
|
40
|
-
y: minY + radius,
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
x: maxX - radius,
|
|
44
|
-
y: maxY - radius,
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
x: minX + radius,
|
|
48
|
-
y: maxY - radius,
|
|
49
|
-
},
|
|
50
|
-
]
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// 获取矩形resize之后,与矩形连接边的新端点
|
|
54
|
-
export function getRectResizeEdgePoint({ point, beforeNode, afterNode }) {
|
|
55
|
-
const { x, y } = point
|
|
56
|
-
const afterPoint = {
|
|
57
|
-
x,
|
|
58
|
-
y,
|
|
59
|
-
}
|
|
60
|
-
const { radius } = beforeNode
|
|
61
|
-
const beforeNodeBox = getNodeBox(beforeNode)
|
|
62
|
-
const afterNodeBox = getNodeBox(afterNode)
|
|
63
|
-
if (x === beforeNodeBox.minX) {
|
|
64
|
-
// 左边
|
|
65
|
-
afterPoint.x = afterNodeBox.minX
|
|
66
|
-
const pct = (y - beforeNode.y) / (beforeNode.height / 2 - radius)
|
|
67
|
-
if (pct) {
|
|
68
|
-
afterPoint.y = afterNode.y + (afterNode.height / 2 - radius) * pct
|
|
69
|
-
} else {
|
|
70
|
-
afterPoint.y = afterNode.y
|
|
71
|
-
}
|
|
72
|
-
} else if (x === beforeNodeBox.maxX) {
|
|
73
|
-
// 右边
|
|
74
|
-
afterPoint.x = afterNodeBox.maxX
|
|
75
|
-
const pct = (y - beforeNode.y) / (beforeNode.height / 2 - radius)
|
|
76
|
-
if (pct) {
|
|
77
|
-
afterPoint.y = afterNode.y + (afterNode.height / 2 - radius) * pct
|
|
78
|
-
} else {
|
|
79
|
-
afterPoint.y = afterNode.y
|
|
80
|
-
}
|
|
81
|
-
} else if (y === beforeNodeBox.minY) {
|
|
82
|
-
// 上边
|
|
83
|
-
afterPoint.y = afterNodeBox.minY
|
|
84
|
-
const pct = (x - beforeNode.x) / (beforeNode.width / 2 - radius)
|
|
85
|
-
if (pct) {
|
|
86
|
-
afterPoint.x = afterNode.x + (afterNode.width / 2 - radius) * pct
|
|
87
|
-
} else {
|
|
88
|
-
afterPoint.x = afterNode.x
|
|
89
|
-
}
|
|
90
|
-
} else if (y === beforeNodeBox.maxY) {
|
|
91
|
-
// 下边
|
|
92
|
-
afterPoint.y = afterNodeBox.maxY
|
|
93
|
-
const pct = (x - beforeNode.x) / (beforeNode.width / 2 - radius)
|
|
94
|
-
if (pct) {
|
|
95
|
-
afterPoint.x = afterNode.x + (afterNode.width / 2 - radius) * pct
|
|
96
|
-
} else {
|
|
97
|
-
afterPoint.x = afterNode.x
|
|
98
|
-
}
|
|
99
|
-
} else {
|
|
100
|
-
// 在圆角部分
|
|
101
|
-
const beforeCoc = getRadiusCenter(beforeNode)
|
|
102
|
-
const afterCoc = getRadiusCenter(afterNode)
|
|
103
|
-
const nodeBox = getNodeBox(beforeNode)
|
|
104
|
-
const { minX, minY, maxX, maxY } = nodeBox
|
|
105
|
-
let index = -1
|
|
106
|
-
if (x - minX < radius && y - minY < radius) {
|
|
107
|
-
// 左上角
|
|
108
|
-
index = 0
|
|
109
|
-
} else if (maxX - x < radius && y - minY < radius) {
|
|
110
|
-
// 右上角
|
|
111
|
-
index = 1
|
|
112
|
-
} else if (maxX - x < radius && maxY - y < radius) {
|
|
113
|
-
// 右下角
|
|
114
|
-
index = 2
|
|
115
|
-
} else if (x - minX < radius && minY - y < radius) {
|
|
116
|
-
// 左下角
|
|
117
|
-
index = 3
|
|
118
|
-
}
|
|
119
|
-
if (index > -1) {
|
|
120
|
-
// 根据夹角角度计算位置
|
|
121
|
-
const angle = Math.atan2(y - beforeCoc[index].y, x - beforeCoc[index].x)
|
|
122
|
-
afterPoint.x = afterCoc[index].x + radius * Math.cos(angle)
|
|
123
|
-
afterPoint.y = afterCoc[index].y + radius * Math.sin(angle)
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
return afterPoint
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// 获取椭圆resize之后,与椭圆连接边的新端点
|
|
130
|
-
export function getEllipseResizeEdgePoint({ point, beforeNode, afterNode }) {
|
|
131
|
-
const { rx, ry } = afterNode
|
|
132
|
-
let afterPoint = point
|
|
133
|
-
// 将椭圆中心当做中心点(0,0),放大缩小前点与X周夹角
|
|
134
|
-
const tan = (point.y - beforeNode.y) / (point.x - beforeNode.x)
|
|
135
|
-
// 方便与公式对照,将rx命名为a,ry命名为b
|
|
136
|
-
const a = rx
|
|
137
|
-
const b = ry
|
|
138
|
-
let x
|
|
139
|
-
let y
|
|
140
|
-
// 将椭圆中心当做中心点(0,0),计算放大缩小后,同一夹角下,点相对位置
|
|
141
|
-
if (tan >= Infinity) {
|
|
142
|
-
// θ = PI / 2
|
|
143
|
-
x = 0
|
|
144
|
-
y = b
|
|
145
|
-
} else if (tan <= -Infinity) {
|
|
146
|
-
// θ = 3 * PI / 2
|
|
147
|
-
x = 0
|
|
148
|
-
y = -b
|
|
149
|
-
} else if (point.x - beforeNode.x > 0) {
|
|
150
|
-
// 0 < θ = PI / 2 或者 3 * PI / 2 < θ = 2 * PI
|
|
151
|
-
// 一四象限
|
|
152
|
-
x = (a * b) / Math.sqrt(b * b + a * a * tan * tan)
|
|
153
|
-
y = (a * b * tan) / Math.sqrt(b * b + a * a * tan * tan)
|
|
154
|
-
} else {
|
|
155
|
-
// PI / 2 < θ 3 * PI / 2
|
|
156
|
-
// 二三象限
|
|
157
|
-
x = -(a * b) / Math.sqrt(b * b + a * a * tan * tan)
|
|
158
|
-
y = -(a * b * tan) / Math.sqrt(b * b + a * a * tan * tan)
|
|
159
|
-
}
|
|
160
|
-
afterPoint = {
|
|
161
|
-
x: x + afterNode.x,
|
|
162
|
-
y: y + afterNode.y,
|
|
163
|
-
}
|
|
164
|
-
return afterPoint
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
// 获取菱形resize之后,与菱形连接边的新端点
|
|
168
|
-
export function getDiamondResizeEdgePoint({ point, beforeNode, afterNode }) {
|
|
169
|
-
let afterPoint = point
|
|
170
|
-
let x
|
|
171
|
-
let y
|
|
172
|
-
const px = point.x - beforeNode.x
|
|
173
|
-
const py = point.y - beforeNode.y
|
|
174
|
-
const rxBefore = beforeNode.rx
|
|
175
|
-
const ryBefore = beforeNode.ry
|
|
176
|
-
// eslint-disable-next-line max-len
|
|
177
|
-
const pct =
|
|
178
|
-
Math.sqrt((rxBefore - Math.abs(px)) * (rxBefore - Math.abs(px)) + py * py) /
|
|
179
|
-
Math.sqrt(rxBefore * rxBefore + ryBefore * ryBefore)
|
|
180
|
-
const rxAfter = afterNode.rx
|
|
181
|
-
const ryAfter = afterNode.ry
|
|
182
|
-
// eslint-disable-next-line max-len
|
|
183
|
-
const a = Math.sqrt(
|
|
184
|
-
(rxAfter * rxAfter + ryAfter * ryAfter) *
|
|
185
|
-
pct *
|
|
186
|
-
pct *
|
|
187
|
-
((rxAfter * rxAfter) / (rxAfter * rxAfter + ryAfter * ryAfter)),
|
|
188
|
-
)
|
|
189
|
-
const b = a * (ryAfter / rxAfter)
|
|
190
|
-
if (px >= 0) {
|
|
191
|
-
// eslint-disable-next-line max-len
|
|
192
|
-
x = rxAfter - a
|
|
193
|
-
} else {
|
|
194
|
-
x = a - rxAfter
|
|
195
|
-
}
|
|
196
|
-
if (py > 0) {
|
|
197
|
-
y = b
|
|
198
|
-
} else {
|
|
199
|
-
y = -b
|
|
200
|
-
}
|
|
201
|
-
afterPoint = {
|
|
202
|
-
x: x + afterNode.x,
|
|
203
|
-
y: y + afterNode.y,
|
|
204
|
-
}
|
|
205
|
-
return afterPoint
|
|
206
|
-
}
|
package/src/NodeResize/index.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @deprecated
|
|
3
|
-
* 待废弃,2.0 版本将 NodeResize 能力内置,该插件设计和实现有比较多的问题,后续不再维护,请及时切换
|
|
4
|
-
*/
|
|
5
|
-
import LogicFlow from '@logicflow/core'
|
|
6
|
-
|
|
7
|
-
import EllipseResize from './node/EllipseResize'
|
|
8
|
-
import DiamondResize from './node/DiamondResize'
|
|
9
|
-
import HtmlResize from './node/HtmlResize'
|
|
10
|
-
import RectResize from './node/RectResize'
|
|
11
|
-
|
|
12
|
-
export * from './node'
|
|
13
|
-
export const NodeResize = {
|
|
14
|
-
pluginName: 'nodeResize',
|
|
15
|
-
// 拖动step
|
|
16
|
-
step: 0,
|
|
17
|
-
|
|
18
|
-
install(lf: LogicFlow) {
|
|
19
|
-
lf.register(EllipseResize)
|
|
20
|
-
lf.register(DiamondResize)
|
|
21
|
-
lf.register(HtmlResize)
|
|
22
|
-
lf.register(RectResize)
|
|
23
|
-
},
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export default NodeResize
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import LogicFlow, {
|
|
2
|
-
Polygon,
|
|
3
|
-
GraphModel,
|
|
4
|
-
DiamondNode,
|
|
5
|
-
DiamondNodeModel,
|
|
6
|
-
} from '@logicflow/core'
|
|
7
|
-
import { PCTResizeParams } from './RectResize'
|
|
8
|
-
import ControlGroup from '../control/ControlGroup'
|
|
9
|
-
|
|
10
|
-
import NodeConfig = LogicFlow.NodeConfig
|
|
11
|
-
|
|
12
|
-
export type ResizeDiamondNodeConfig = NodeConfig & {
|
|
13
|
-
properties: {
|
|
14
|
-
nodeSize: {
|
|
15
|
-
rx: number
|
|
16
|
-
ry: number
|
|
17
|
-
}
|
|
18
|
-
} & Record<string, unknown>
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export class DiamondResizeModel extends DiamondNodeModel {
|
|
22
|
-
PCTResizeInfo?: PCTResizeParams
|
|
23
|
-
minWidth!: number
|
|
24
|
-
minHeight!: number
|
|
25
|
-
maxWidth!: number
|
|
26
|
-
maxHeight!: number
|
|
27
|
-
|
|
28
|
-
constructor(data: ResizeDiamondNodeConfig, graphModel: GraphModel) {
|
|
29
|
-
super(data, graphModel)
|
|
30
|
-
const { nodeSize } = data.properties
|
|
31
|
-
if (nodeSize) {
|
|
32
|
-
this.rx = nodeSize.rx
|
|
33
|
-
this.ry = nodeSize.ry
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
initNodeData(data: any): void {
|
|
38
|
-
super.initNodeData(data)
|
|
39
|
-
this.minWidth = 30
|
|
40
|
-
this.minHeight = 30
|
|
41
|
-
this.maxWidth = 2000
|
|
42
|
-
this.maxHeight = 2000
|
|
43
|
-
this.gridSize = 1
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
getOutlineStyle() {
|
|
47
|
-
const style = super.getOutlineStyle()
|
|
48
|
-
const {
|
|
49
|
-
editConfigModel: { isSilentMode },
|
|
50
|
-
} = this.graphModel
|
|
51
|
-
if (isSilentMode) return style
|
|
52
|
-
style.stroke = 'none'
|
|
53
|
-
if (style.hover) {
|
|
54
|
-
style.hover.stroke = 'none'
|
|
55
|
-
}
|
|
56
|
-
return style
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
getResizeOutlineStyle() {
|
|
60
|
-
return {
|
|
61
|
-
fill: 'none',
|
|
62
|
-
stroke: 'transparent',
|
|
63
|
-
strokeWidth: 1,
|
|
64
|
-
strokeDasharray: '3,3',
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
getControlPointStyle() {
|
|
69
|
-
return {
|
|
70
|
-
width: 7,
|
|
71
|
-
height: 7,
|
|
72
|
-
fill: '#FFFFFF',
|
|
73
|
-
stroke: '#000000',
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// 该方法需要在重设宽高和最大、最小限制后被调用,不建议在 initNodeData() 方法中使用
|
|
78
|
-
enableProportionResize(turnOn = true) {
|
|
79
|
-
if (turnOn) {
|
|
80
|
-
const ResizePCT = {
|
|
81
|
-
widthPCT: 100,
|
|
82
|
-
heightPCT: 100,
|
|
83
|
-
}
|
|
84
|
-
const ResizeBasis = {
|
|
85
|
-
basisWidth: this.rx,
|
|
86
|
-
basisHeight: this.ry,
|
|
87
|
-
}
|
|
88
|
-
const ScaleLimit = {
|
|
89
|
-
maxScaleLimit: Math.min(
|
|
90
|
-
(this.maxWidth / (this.rx * 2)) * 100,
|
|
91
|
-
(this.maxHeight / (this.ry * 2)) * 100,
|
|
92
|
-
),
|
|
93
|
-
minScaleLimit: Math.max(
|
|
94
|
-
(this.minWidth / (this.rx * 2)) * 100,
|
|
95
|
-
(this.minHeight / (this.ry * 2)) * 100,
|
|
96
|
-
),
|
|
97
|
-
}
|
|
98
|
-
this.PCTResizeInfo = {
|
|
99
|
-
ResizePCT,
|
|
100
|
-
ResizeBasis,
|
|
101
|
-
ScaleLimit,
|
|
102
|
-
}
|
|
103
|
-
} else {
|
|
104
|
-
delete this.PCTResizeInfo
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export class DiamondResizeView extends DiamondNode {
|
|
110
|
-
getControlGroup() {
|
|
111
|
-
const { model, graphModel } = this.props
|
|
112
|
-
return <ControlGroup model={model} graphModel={graphModel} />
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// getResizeShape绘制图形,功能等同于基础菱形的getShape功能,可以通过复写此方法,进行节点自定义
|
|
116
|
-
getResizeShape() {
|
|
117
|
-
const { model } = this.props
|
|
118
|
-
const { points } = model
|
|
119
|
-
const style = model.getNodeStyle()
|
|
120
|
-
return (
|
|
121
|
-
<g>
|
|
122
|
-
<Polygon {...style} points={points} />
|
|
123
|
-
</g>
|
|
124
|
-
)
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
getShape() {
|
|
128
|
-
const {
|
|
129
|
-
model: { isSelected },
|
|
130
|
-
graphModel: {
|
|
131
|
-
editConfigModel: { isSilentMode },
|
|
132
|
-
},
|
|
133
|
-
} = this.props
|
|
134
|
-
return (
|
|
135
|
-
<g>
|
|
136
|
-
{this.getResizeShape()}
|
|
137
|
-
{isSelected && !isSilentMode ? this.getControlGroup() : ''}
|
|
138
|
-
</g>
|
|
139
|
-
)
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
export const DiamondResize = {
|
|
144
|
-
type: 'diamond',
|
|
145
|
-
view: DiamondResizeView,
|
|
146
|
-
model: DiamondResizeModel,
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export default DiamondResize
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import LogicFlow, {
|
|
2
|
-
GraphModel,
|
|
3
|
-
EllipseNode,
|
|
4
|
-
EllipseNodeModel,
|
|
5
|
-
} from '@logicflow/core'
|
|
6
|
-
import { PCTResizeParams } from './RectResize'
|
|
7
|
-
import ControlGroup from '../control/ControlGroup'
|
|
8
|
-
|
|
9
|
-
import NodeConfig = LogicFlow.NodeConfig
|
|
10
|
-
|
|
11
|
-
export type ResizeEllipseNodeConfig = NodeConfig & {
|
|
12
|
-
properties: {
|
|
13
|
-
nodeSize: {
|
|
14
|
-
rx: number
|
|
15
|
-
ry: number
|
|
16
|
-
}
|
|
17
|
-
} & Record<string, unknown>
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export class EllipseResizeModel extends EllipseNodeModel {
|
|
21
|
-
PCTResizeInfo?: PCTResizeParams
|
|
22
|
-
minWidth!: number
|
|
23
|
-
minHeight!: number
|
|
24
|
-
maxWidth!: number
|
|
25
|
-
maxHeight!: number
|
|
26
|
-
|
|
27
|
-
constructor(data: ResizeEllipseNodeConfig, graphModel: GraphModel) {
|
|
28
|
-
super(data, graphModel)
|
|
29
|
-
const { nodeSize } = data.properties
|
|
30
|
-
if (nodeSize) {
|
|
31
|
-
this.rx = nodeSize.rx
|
|
32
|
-
this.ry = nodeSize.ry
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
initNodeData(data: any): void {
|
|
37
|
-
super.initNodeData(data)
|
|
38
|
-
this.minWidth = 30
|
|
39
|
-
this.minHeight = 30
|
|
40
|
-
this.maxWidth = 2000
|
|
41
|
-
this.maxHeight = 2000
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
getOutlineStyle() {
|
|
45
|
-
const style = super.getOutlineStyle()
|
|
46
|
-
const {
|
|
47
|
-
editConfigModel: { isSilentMode },
|
|
48
|
-
} = this.graphModel
|
|
49
|
-
if (isSilentMode) return style
|
|
50
|
-
style.stroke = 'none'
|
|
51
|
-
if (style.hover) {
|
|
52
|
-
style.hover.stroke = 'none'
|
|
53
|
-
}
|
|
54
|
-
return style
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
getResizeOutlineStyle() {
|
|
58
|
-
return {
|
|
59
|
-
fill: 'none',
|
|
60
|
-
stroke: 'transparent',
|
|
61
|
-
strokeWidth: 1,
|
|
62
|
-
strokeDasharray: '3,3',
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
getControlPointStyle() {
|
|
67
|
-
return {
|
|
68
|
-
width: 7,
|
|
69
|
-
height: 7,
|
|
70
|
-
fill: '#FFFFFF',
|
|
71
|
-
stroke: '#000000',
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// 该方法需要在重设宽高和最大、最小限制后被调用,不建议在 initNodeData() 方法中使用
|
|
76
|
-
enableProportionResize(turnOn = true) {
|
|
77
|
-
if (turnOn) {
|
|
78
|
-
const ResizePCT = {
|
|
79
|
-
widthPCT: 100,
|
|
80
|
-
heightPCT: 100,
|
|
81
|
-
}
|
|
82
|
-
const ResizeBasis = {
|
|
83
|
-
basisWidth: this.rx,
|
|
84
|
-
basisHeight: this.ry,
|
|
85
|
-
}
|
|
86
|
-
const ScaleLimit = {
|
|
87
|
-
maxScaleLimit: Math.min(
|
|
88
|
-
(this.maxWidth / (this.rx * 2)) * 100,
|
|
89
|
-
(this.maxHeight / (this.ry * 2)) * 100,
|
|
90
|
-
),
|
|
91
|
-
minScaleLimit: Math.max(
|
|
92
|
-
(this.minWidth / (this.rx * 2)) * 100,
|
|
93
|
-
(this.minHeight / (this.ry * 2)) * 100,
|
|
94
|
-
),
|
|
95
|
-
}
|
|
96
|
-
this.PCTResizeInfo = {
|
|
97
|
-
ResizePCT,
|
|
98
|
-
ResizeBasis,
|
|
99
|
-
ScaleLimit,
|
|
100
|
-
}
|
|
101
|
-
} else {
|
|
102
|
-
delete this.PCTResizeInfo
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export class EllipseResizeView extends EllipseNode {
|
|
108
|
-
getControlGroup() {
|
|
109
|
-
const { model, graphModel } = this.props
|
|
110
|
-
return <ControlGroup model={model} graphModel={graphModel} />
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// getResizeShape绘制图形,功能等同于基础椭圆的getShape功能,可以通过复写此方法,进行节点自定义
|
|
114
|
-
getResizeShape() {
|
|
115
|
-
return super.getShape()
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
getShape() {
|
|
119
|
-
const {
|
|
120
|
-
model,
|
|
121
|
-
graphModel: {
|
|
122
|
-
editConfigModel: { isSilentMode },
|
|
123
|
-
},
|
|
124
|
-
} = this.props
|
|
125
|
-
return (
|
|
126
|
-
<g>
|
|
127
|
-
{this.getResizeShape()}
|
|
128
|
-
{model.isSelected && !isSilentMode ? this.getControlGroup() : ''}
|
|
129
|
-
</g>
|
|
130
|
-
)
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export const EllipseResize = {
|
|
135
|
-
type: 'ellipse',
|
|
136
|
-
view: EllipseResizeView,
|
|
137
|
-
model: EllipseResizeModel,
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export default EllipseResize
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { GraphModel, HtmlNode, HtmlNodeModel } from '@logicflow/core'
|
|
2
|
-
import { PCTResizeParams, ResizeNodeConfig } from './RectResize'
|
|
3
|
-
import ControlGroup from '../control/ControlGroup'
|
|
4
|
-
|
|
5
|
-
export class HtmlResizeModel extends HtmlNodeModel {
|
|
6
|
-
PCTResizeInfo?: PCTResizeParams
|
|
7
|
-
minWidth!: number
|
|
8
|
-
minHeight!: number
|
|
9
|
-
maxWidth!: number
|
|
10
|
-
maxHeight!: number
|
|
11
|
-
|
|
12
|
-
constructor(data: ResizeNodeConfig, graphModel: GraphModel) {
|
|
13
|
-
super(data, graphModel)
|
|
14
|
-
const { nodeSize } = data.properties
|
|
15
|
-
if (nodeSize) {
|
|
16
|
-
this.width = nodeSize.width
|
|
17
|
-
this.height = nodeSize.height
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
initNodeData(data: any): void {
|
|
22
|
-
super.initNodeData(data)
|
|
23
|
-
this.minWidth = 30
|
|
24
|
-
this.minHeight = 30
|
|
25
|
-
this.maxWidth = 2000
|
|
26
|
-
this.maxHeight = 2000
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
getOutlineStyle() {
|
|
30
|
-
const style = super.getOutlineStyle()
|
|
31
|
-
const {
|
|
32
|
-
editConfigModel: { isSilentMode },
|
|
33
|
-
} = this.graphModel
|
|
34
|
-
if (isSilentMode) return style
|
|
35
|
-
style.stroke = 'none'
|
|
36
|
-
if (style.hover) {
|
|
37
|
-
style.hover.stroke = 'none'
|
|
38
|
-
}
|
|
39
|
-
return style
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
getResizeOutlineStyle() {
|
|
43
|
-
return {
|
|
44
|
-
fill: 'none',
|
|
45
|
-
stroke: 'transparent',
|
|
46
|
-
strokeWidth: 1,
|
|
47
|
-
strokeDasharray: '3,3',
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
getControlPointStyle() {
|
|
52
|
-
return {
|
|
53
|
-
width: 7,
|
|
54
|
-
height: 7,
|
|
55
|
-
fill: '#FFFFFF',
|
|
56
|
-
stroke: '#000000',
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// 该方法需要在重设宽高和最大、最小限制后被调用,不建议在 initNodeData() 方法中使用
|
|
61
|
-
enableProportionResize(turnOn = true) {
|
|
62
|
-
if (turnOn) {
|
|
63
|
-
const ResizePCT = {
|
|
64
|
-
widthPCT: 100,
|
|
65
|
-
heightPCT: 100,
|
|
66
|
-
}
|
|
67
|
-
const ResizeBasis = {
|
|
68
|
-
basisWidth: this.width,
|
|
69
|
-
basisHeight: this.height,
|
|
70
|
-
}
|
|
71
|
-
const ScaleLimit = {
|
|
72
|
-
maxScaleLimit: Math.min(
|
|
73
|
-
(this.maxWidth / this.width) * 100,
|
|
74
|
-
(this.maxHeight / this.height) * 100,
|
|
75
|
-
),
|
|
76
|
-
minScaleLimit: Math.max(
|
|
77
|
-
(this.minWidth / this.width) * 100,
|
|
78
|
-
(this.minHeight / this.height) * 100,
|
|
79
|
-
),
|
|
80
|
-
}
|
|
81
|
-
this.PCTResizeInfo = {
|
|
82
|
-
ResizePCT,
|
|
83
|
-
ResizeBasis,
|
|
84
|
-
ScaleLimit,
|
|
85
|
-
}
|
|
86
|
-
} else {
|
|
87
|
-
delete this.PCTResizeInfo
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export class HtmlResizeView extends HtmlNode {
|
|
93
|
-
getControlGroup() {
|
|
94
|
-
const { model, graphModel } = this.props
|
|
95
|
-
return <ControlGroup model={model} graphModel={graphModel} />
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// getResizeShape绘制图形,功能等同于基础矩形的getShape功能,可以通过复写此方法,进行节点自定义
|
|
99
|
-
getResizeShape() {
|
|
100
|
-
return super.getShape()
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
getShape() {
|
|
104
|
-
const {
|
|
105
|
-
model: { isSelected },
|
|
106
|
-
graphModel: {
|
|
107
|
-
editConfigModel: { isSilentMode },
|
|
108
|
-
},
|
|
109
|
-
} = this.props
|
|
110
|
-
return (
|
|
111
|
-
<g>
|
|
112
|
-
{this.getResizeShape()}
|
|
113
|
-
{isSelected && !isSilentMode ? this.getControlGroup() : ''}
|
|
114
|
-
</g>
|
|
115
|
-
)
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export const HtmlResize = {
|
|
120
|
-
type: 'html',
|
|
121
|
-
view: HtmlResizeView,
|
|
122
|
-
model: HtmlResizeModel,
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export default HtmlResize
|