@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.
Files changed (125) hide show
  1. package/README.md +16 -0
  2. package/package.json +10 -7
  3. package/.turbo/turbo-build.log +0 -38
  4. package/CHANGELOG.md +0 -1829
  5. package/__test__/bpmn-adapter.test.js +0 -227
  6. package/es/materials/curved-edge/__test__/curved-edge.test.d.ts +0 -1
  7. package/es/materials/curved-edge/__test__/curved-edge.test.js +0 -18
  8. package/jest.config.js +0 -198
  9. package/lib/materials/curved-edge/__test__/curved-edge.test.d.ts +0 -1
  10. package/lib/materials/curved-edge/__test__/curved-edge.test.js +0 -20
  11. package/rollup.config.js +0 -52
  12. package/src/NodeResize/BasicShape/Ellipse.tsx +0 -22
  13. package/src/NodeResize/BasicShape/Polygon.tsx +0 -24
  14. package/src/NodeResize/BasicShape/Rect.tsx +0 -44
  15. package/src/NodeResize/control/Control.tsx +0 -537
  16. package/src/NodeResize/control/ControlGroup.tsx +0 -76
  17. package/src/NodeResize/control/Util.ts +0 -206
  18. package/src/NodeResize/index.ts +0 -26
  19. package/src/NodeResize/node/DiamondResize.tsx +0 -149
  20. package/src/NodeResize/node/EllipseResize.tsx +0 -140
  21. package/src/NodeResize/node/HtmlResize.tsx +0 -125
  22. package/src/NodeResize/node/RectResize.tsx +0 -126
  23. package/src/NodeResize/node/index.ts +0 -4
  24. package/src/bpmn/constant.ts +0 -56
  25. package/src/bpmn/events/EndEvent.ts +0 -73
  26. package/src/bpmn/events/StartEvent.ts +0 -52
  27. package/src/bpmn/events/index.ts +0 -2
  28. package/src/bpmn/flow/SequenceFlow.ts +0 -25
  29. package/src/bpmn/flow/index.ts +0 -1
  30. package/src/bpmn/gateways/ExclusiveGateway.ts +0 -71
  31. package/src/bpmn/gateways/index.ts +0 -1
  32. package/src/bpmn/getBpmnId.ts +0 -31
  33. package/src/bpmn/index.ts +0 -60
  34. package/src/bpmn/tasks/ServiceTask.ts +0 -63
  35. package/src/bpmn/tasks/UserTask.ts +0 -64
  36. package/src/bpmn/tasks/index.ts +0 -2
  37. package/src/bpmn-adapter/bpmnIds.ts +0 -31
  38. package/src/bpmn-adapter/index.ts +0 -835
  39. package/src/bpmn-adapter/json2xml.ts +0 -127
  40. package/src/bpmn-adapter/xml2json.ts +0 -544
  41. package/src/bpmn-elements/README.md +0 -223
  42. package/src/bpmn-elements/__tests__/definition.test.js +0 -72
  43. package/src/bpmn-elements/index.d.ts +0 -26
  44. package/src/bpmn-elements/index.ts +0 -107
  45. package/src/bpmn-elements/presets/Event/EndEventFactory.ts +0 -114
  46. package/src/bpmn-elements/presets/Event/IntermediateCatchEvent.ts +0 -108
  47. package/src/bpmn-elements/presets/Event/IntermediateThrowEvent.ts +0 -109
  48. package/src/bpmn-elements/presets/Event/StartEventFactory.ts +0 -114
  49. package/src/bpmn-elements/presets/Event/boundaryEventFactory.ts +0 -117
  50. package/src/bpmn-elements/presets/Event/index.ts +0 -14
  51. package/src/bpmn-elements/presets/Flow/flow.d.ts +0 -6
  52. package/src/bpmn-elements/presets/Flow/index.ts +0 -8
  53. package/src/bpmn-elements/presets/Flow/manhattan.ts +0 -691
  54. package/src/bpmn-elements/presets/Flow/sequenceFlow.ts +0 -65
  55. package/src/bpmn-elements/presets/Gateway/gateway.ts +0 -107
  56. package/src/bpmn-elements/presets/Gateway/index.ts +0 -23
  57. package/src/bpmn-elements/presets/Pool/Lane.ts +0 -211
  58. package/src/bpmn-elements/presets/Pool/Pool.ts +0 -284
  59. package/src/bpmn-elements/presets/Pool/index.ts +0 -89
  60. package/src/bpmn-elements/presets/Task/index.ts +0 -122
  61. package/src/bpmn-elements/presets/Task/subProcess.ts +0 -189
  62. package/src/bpmn-elements/presets/Task/task.ts +0 -193
  63. package/src/bpmn-elements/presets/icons.ts +0 -155
  64. package/src/bpmn-elements/utils.ts +0 -52
  65. package/src/bpmn-elements-adapter/README.md +0 -293
  66. package/src/bpmn-elements-adapter/__tests__/adapter_in.test.js +0 -528
  67. package/src/bpmn-elements-adapter/__tests__/adapter_out.test.js +0 -569
  68. package/src/bpmn-elements-adapter/constant.ts +0 -76
  69. package/src/bpmn-elements-adapter/index.ts +0 -1134
  70. package/src/bpmn-elements-adapter/json2xml.ts +0 -105
  71. package/src/bpmn-elements-adapter/xml2json.ts +0 -542
  72. package/src/components/context-menu/index.ts +0 -253
  73. package/src/components/control/index.ts +0 -155
  74. package/src/components/dnd-panel/index.ts +0 -137
  75. package/src/components/highlight/index.ts +0 -227
  76. package/src/components/menu/index.ts +0 -748
  77. package/src/components/mini-map/index.ts +0 -686
  78. package/src/components/selection-select/index.ts +0 -387
  79. package/src/dynamic-group/index.ts +0 -774
  80. package/src/dynamic-group/model.ts +0 -580
  81. package/src/dynamic-group/node.ts +0 -288
  82. package/src/dynamic-group/utils.ts +0 -46
  83. package/src/index.less +0 -1
  84. package/src/index.ts +0 -47
  85. package/src/insert-node-in-polyline/edge.ts +0 -175
  86. package/src/insert-node-in-polyline/index.ts +0 -193
  87. package/src/materials/curved-edge/__test__/curved-edge.test.ts +0 -46
  88. package/src/materials/curved-edge/index.ts +0 -217
  89. package/src/materials/group/GroupNode.ts +0 -437
  90. package/src/materials/group/index.ts +0 -542
  91. package/src/materials/node-selection/index.ts +0 -380
  92. package/src/mindmap/fakerRoot.ts +0 -19
  93. package/src/mindmap/index.ts +0 -328
  94. package/src/mindmap/markContent.ts +0 -81
  95. package/src/mindmap/markContentOption.ts +0 -81
  96. package/src/mindmap/markEntity.ts +0 -82
  97. package/src/mindmap/markRoot.ts +0 -83
  98. package/src/mindmap/theme.ts +0 -11
  99. package/src/pool/LaneModel.ts +0 -226
  100. package/src/pool/LaneView.ts +0 -220
  101. package/src/pool/PoolModel.ts +0 -631
  102. package/src/pool/PoolView.ts +0 -75
  103. package/src/pool/constant.ts +0 -19
  104. package/src/pool/index.ts +0 -621
  105. package/src/pool/utils.ts +0 -46
  106. package/src/rect-label-node/RectLabelNodeView.ts +0 -33
  107. package/src/rect-label-node/index.ts +0 -15
  108. package/src/style/index.less +0 -381
  109. package/src/style/raw.ts +0 -328
  110. package/src/tools/auto-layout/index.ts +0 -282
  111. package/src/tools/flow-path/index.ts +0 -233
  112. package/src/tools/label/Label.tsx +0 -357
  113. package/src/tools/label/LabelModel.ts +0 -83
  114. package/src/tools/label/LabelOverlay.tsx +0 -162
  115. package/src/tools/label/algorithm.ts +0 -42
  116. package/src/tools/label/index.ts +0 -479
  117. package/src/tools/label/mediumEditor.ts +0 -121
  118. package/src/tools/label/utils.ts +0 -395
  119. package/src/tools/proximity-connect/index.ts +0 -435
  120. package/src/tools/snapshot/README.md +0 -145
  121. package/src/tools/snapshot/index.ts +0 -701
  122. package/src/tools/snapshot/utils.ts +0 -163
  123. package/src/turbo-adapter/index.ts +0 -212
  124. package/stats.html +0 -4842
  125. package/tsconfig.json +0 -18
@@ -1,328 +0,0 @@
1
- import LogicFlow from '@logicflow/core'
2
- import Hierarchy from '@antv/hierarchy'
3
- import MarkEntity from './markEntity'
4
- import FakerRoot from './fakerRoot'
5
- import MarkRoot from './markRoot'
6
- import MarkContent from './markContent'
7
- import MarkContentOption from './markContentOption'
8
- import { theme } from './theme'
9
-
10
- import NodeConfig = LogicFlow.NodeConfig
11
- import EdgeConfig = LogicFlow.EdgeConfig
12
-
13
- export const ROOT_NODE = 'mark:root'
14
- export const FAKER_NODE = 'faker:root'
15
- const FIRST_ROOT_X = 10
16
- const FIRST_ROOT_Y = 10
17
-
18
- class MindMap {
19
- static pluginName = 'MindMap'
20
- lf: any
21
-
22
- constructor({ lf }) {
23
- this.lf = lf
24
- lf.adapterIn = this.adapterIn
25
- lf.adapterOut = this.adapterOut
26
-
27
- lf.setTheme(theme)
28
- lf.register(FakerRoot)
29
- lf.register(MarkRoot)
30
- lf.register(MarkContent)
31
- lf.register(MarkContentOption)
32
- lf.register(MarkEntity)
33
- lf.setDefaultEdgeType('bezier')
34
- lf.updateEditConfig({
35
- hideAnchors: true,
36
- adjustNodePosition: false,
37
- edgeTextEdit: false,
38
- adjustEdge: false,
39
- })
40
- lf.graphModel.transformModel.translate(200, 200)
41
- this.setContextMenu()
42
- /**
43
- * 删除树上的某一个点和这个点后面所有的点
44
- */
45
- lf.removeTreeNode = (nodeId) => {
46
- const { nodesMap } = this.getGraphTreeData()
47
- const node = nodesMap.get(nodeId)
48
- if (node.type === ROOT_NODE) {
49
- return
50
- }
51
- this.removeNode(node)
52
- this.renderTree()
53
- }
54
- /**
55
- * 重新排布树
56
- */
57
- lf.renderTree = () => {
58
- this.renderTree()
59
- }
60
- /**
61
- * 监听删除
62
- */
63
- this.lf.keyboard.on('backspace', () => {
64
- const { nodes } = this.lf.getSelectElements(true)
65
- if (nodes.length > 0) {
66
- this.lf.clearSelectElements()
67
- nodes.forEach((node) => {
68
- this.lf.removeTreeNode(node.id)
69
- })
70
- }
71
- })
72
- }
73
-
74
- setContextMenu() {
75
- const menuItem = [
76
- {
77
- icon: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAAA5NJREFUWEfNmOtRFEEQgHsiACIQIkAiADOQCMAI7I0AjOCaCMQIxAg4IlAjQCIQIhjrW3uuZvf2bmf2Vov+d3Xz+LbfPUFeuYS5+JqmOU1nxRhfzOzHHGdPAlTVwxDCaYzxvYicicj+BphnEbkLISxjjN/MjN9VUgWoqsB8FBHAkJ8ishSRXyLS11gCZ+0bX38rIp/MjPVFUgSoqmhoISKXIvIiIiYit6UXqepb/6grp7oWkZsSjY4Cuta+ighrAbOSg4fUg2uICHAXrvEPY766FVBV0dhnN+Xl2GFFNhMR/+g7EYki8m7buRsBM7gHzFOiNVXF357NDL/cKq5NIPHPjZCDgO4z92jOzHD2IlHVFqx0j/s2e4A8GfLpNUDf9N2D4axEc4m+FpB9rgwgH83spK+JIUBSQZvfan1uCqBDch+BSAoiiFbSAXS/eBxaWGLjqYAOiRaPReQot1ofMGnvsMa0u5g420uuxLU6WlwBuu/9nqq9TAvFQdK3iqqioFMzO0r/5YAp5xFNkwr9Lib2D1xjyAGhJzDI9pNkBkBKKlZsKFdA5ID88cXMdBLd35RRlQeH7umfkQNSdtbCvAZ2JkAseZxyYguYpZdzM6P8TJKZAMmDV2bWsiVAyhmljZq4qqNeW+n/SoVUsal5HTqDBrZTh1W1CjD1caWARCGCmUql074NArqZ8UH6s5rDOxD/zMQZ4GsIEmJgP3VEeRQzJyzNLJmp1ESrdTNpkHL3ZGbt3JMDkhgvzOygmsw37AqYZZOVq+WAqeXpRHIN7AyAFAmGMzqadvLrdzPtHDvVzDMAkuoOzIzs0UofsM1B+Rf8Lw1mM1Ankww1rHQy92Z2XgPnmWByLVZVGuXQb1aGWv6kxeqc6CZmqksvD0XfmJJzv5KtmTid5hfRfm+dWfu3+z5SVWeu2EaZmZZOai3FbRo76QkxNdWlMyOMXIaJiwGz8fbJe9G1x6VtgzuRxIWj03+mefZg4tHHIdccKWUj3EYT9y4Eci+EoIvF4qbIqUYWqSqZAjfgdWzr7F3yeET7RH3kgRJY6vXo08YQY9M0FzFGwHAhPvZ6bHocBcy0iQNTDvcADSHcxhgfxsyJn/ljJ1UCMEzKQ1TRRxYDep5Dm6QQLiPKEYIJ584vZB3+CFAawjAnvV9VO1cFmJvNCzudOMAAAZJeUtESgdJ2SF4+q59/R4NkjoDY9YzJGtz14tL9fwB50PM48Yfe+AAAAABJRU5ErkJggg==',
78
- className: 'lf-mindmap_addIcon',
79
- callback: (data) => {
80
- this.addChild(data)
81
- },
82
- },
83
- ]
84
- this.lf.setContextMenuByType(ROOT_NODE, menuItem)
85
- this.lf.setContextMenuByType('mark:entity', menuItem)
86
- this.lf.setContextMenuByType('mark:content', menuItem)
87
- this.lf.setContextMenuByType('mark:content-option', menuItem)
88
- }
89
-
90
- private addChild(data) {
91
- let type = 'mark:content-option'
92
- switch (data.type) {
93
- case ROOT_NODE:
94
- type = 'mark:entity'
95
- break
96
- case 'mark:entity':
97
- type = 'mark:content'
98
- break
99
- default:
100
- break
101
- }
102
- const nodeModel = this.lf.addNode({
103
- type,
104
- x: data.x,
105
- y: data.y,
106
- })
107
- this.lf.addEdge({
108
- sourceNodeId: data.id,
109
- targetNodeId: nodeModel.id,
110
- })
111
- this.renderTree()
112
- }
113
-
114
- private removeNode(node) {
115
- if (node.children && node.children.length > 0) {
116
- node.children.forEach((subNode) => {
117
- this.removeNode(subNode)
118
- })
119
- }
120
- this.lf.deleteNode(node.id)
121
- }
122
-
123
- private getGraphTreeData() {
124
- const graphData = this.lf.getGraphRawData()
125
- const nodesMap = new Map()
126
- const rootNodes: string[] = []
127
- let root: any = null
128
- graphData.nodes.forEach((node) => {
129
- const treeNode = {
130
- id: node.id,
131
- type: node.type,
132
- properties: node.properties,
133
- x: node.x,
134
- y: node.y,
135
- children: [],
136
- }
137
- nodesMap.set(node.id, treeNode)
138
- if (node.type === ROOT_NODE) {
139
- rootNodes.push(node.id)
140
- }
141
- if (node.type === FAKER_NODE) {
142
- root = treeNode
143
- }
144
- })
145
-
146
- graphData.edges.forEach((edge) => {
147
- const node = nodesMap.get(edge.sourceNodeId)
148
- node.children.push(nodesMap.get(edge.targetNodeId))
149
- })
150
- rootNodes.forEach((nodeId) => {
151
- root.children.push(nodesMap.get(nodeId))
152
- })
153
- return {
154
- root,
155
- nodesMap,
156
- }
157
- }
158
-
159
- private renderTree() {
160
- let graphData = this.lf.getGraphRawData()
161
- let tree = this.graphToTree(graphData)
162
- tree = this.layoutTree(tree)
163
- graphData = this.treeToGraph(tree)
164
- this.lf.graphModel.graphDataToModel(graphData)
165
- }
166
-
167
- private graphToTree(graphData) {
168
- let tree: any = null
169
- const nodesMap = new Map()
170
- const roots: any = []
171
- graphData.nodes.forEach((node) => {
172
- const treeNode = {
173
- id: node.id,
174
- type: node.type,
175
- properties: node.proerties,
176
- text: node.text,
177
- children: [],
178
- }
179
- nodesMap.set(node.id, treeNode)
180
- if (node.type === 'mark:root') {
181
- roots.push(node)
182
- }
183
- if (node.type === FAKER_NODE) {
184
- tree = treeNode
185
- }
186
- })
187
- graphData.edges.forEach((edge) => {
188
- const node = nodesMap.get(edge.sourceNodeId)
189
- node.children.push(nodesMap.get(edge.targetNodeId))
190
- })
191
- if (tree && tree.children) {
192
- tree.children = roots.map((root: any) => nodesMap.get(root.id))
193
- }
194
- return tree
195
- }
196
-
197
- /**
198
- * 将树这种数据格式转换为图
199
- */
200
- private treeToGraph(rootNode) {
201
- const nodes: NodeConfig[] = []
202
- const edges: EdgeConfig[] = []
203
-
204
- function getNode(current, parent: any = null) {
205
- const node: NodeConfig = {
206
- id: current.id,
207
- x: current.x,
208
- y: current.y,
209
- type: current.type || current.data.type,
210
- properties: current.properties || {},
211
- }
212
- nodes.push(node)
213
- if (current.children) {
214
- current.children.forEach((subNode) => {
215
- getNode(subNode, node)
216
- })
217
- }
218
- if (parent && parent.type !== FAKER_NODE) {
219
- const edge: EdgeConfig = {
220
- sourceNodeId: parent.id,
221
- targetNodeId: node.id as string,
222
- type: 'bezier',
223
- }
224
- edges.push(edge)
225
- }
226
- }
227
-
228
- getNode(rootNode)
229
- return {
230
- nodes,
231
- edges,
232
- }
233
- }
234
-
235
- /**
236
- * 由于树这种数据格式本身是没有坐标的
237
- * 需要使用一些算法来将树转换为有坐标的树
238
- */
239
- layoutTree(tree) {
240
- if (!tree || !tree.children || tree.children.length === 0) return tree
241
- const NODE_SIZE = 40
242
- const PEM = 20
243
- tree.isRoot = true
244
- const rootNode = Hierarchy.compactBox(tree, {
245
- direction: 'LR',
246
- getId(d) {
247
- return d.id
248
- },
249
- getHeight(d) {
250
- if (d.type === ROOT_NODE) {
251
- return NODE_SIZE * 4
252
- }
253
- return NODE_SIZE
254
- },
255
- getWidth() {
256
- return 200 + PEM * 1.6
257
- },
258
- getHGap() {
259
- return PEM
260
- },
261
- getVGap() {
262
- return PEM
263
- },
264
- getSubTreeSep(d) {
265
- if (!d.children || !d.children.length) {
266
- return 0
267
- }
268
- return PEM
269
- },
270
- })
271
- // const { nodes, edges } = this.treeToGraph(rootNode);
272
- // 将根节点位置平移回原位置
273
- // 保证第一个根节点在画布位置不变
274
- // 为什么取第一个child呢,这里是因为一张图上存在多个树的情况下
275
- // 我们需要使用一个虚拟的节点(faker:root)作为所有树的根节点
276
- // 这样在使用树布局算法的时候方便统一处理。
277
- // 但是为了在视觉上保证图形不抖动,
278
- // 我们需要把第一个真实的根节点位置保持不动
279
- const x = tree.children[0].x || FIRST_ROOT_X
280
- const y = tree.children[0].y || FIRST_ROOT_Y
281
- const x1 = rootNode.children[0].x
282
- const y1 = rootNode.children[0].y
283
- const moveX = x - x1
284
- const moveY = y - y1
285
- const newTree = this.dfsTree(rootNode, (currentNode) => ({
286
- id: currentNode.id,
287
- x: currentNode.x + moveX,
288
- y: currentNode.y + moveY,
289
- type: currentNode.data.type,
290
- }))
291
- return newTree
292
- }
293
-
294
- /**
295
- * 遍历树的每一项,已传入的回调方法重新构建一个新的树
296
- */
297
- dfsTree(tree, callback) {
298
- const newTree = callback(tree)
299
- if (tree.children && tree.children.length > 0) {
300
- newTree.children = tree.children.map((treeNode) =>
301
- this.dfsTree(treeNode, callback),
302
- )
303
- }
304
- return newTree
305
- }
306
-
307
- /**
308
- * 将传入的数据转换为logicflow格式的数据
309
- */
310
- adapterIn = (trees) => {
311
- const tree = {
312
- id: 'faker:root',
313
- type: 'faker:root',
314
- x: 0,
315
- y: 0,
316
- children: trees,
317
- }
318
- const newtree = this.layoutTree(tree)
319
- const graphData = this.treeToGraph(newtree)
320
- return graphData
321
- }
322
- /**
323
- * 将logicflow格式的数据转换为mindmap需要的数据
324
- */
325
- adapterOut = (graphData) => this.graphToTree(graphData).children
326
- }
327
-
328
- export { MindMap }
@@ -1,81 +0,0 @@
1
- import { h, RectNode, RectNodeModel } from '@logicflow/core'
2
-
3
- class MarkContentModel extends RectNodeModel {
4
- static extendKey = 'MarkContentModel'
5
-
6
- constructor(data, graphModel) {
7
- if (!data.text) {
8
- data.text = {
9
- x: data.x,
10
- y: data.y + 15,
11
- value: '',
12
- }
13
- }
14
- super(data, graphModel)
15
- }
16
-
17
- setAttributes() {
18
- this.height = 60
19
- this.strokeWidth = 1
20
- }
21
- }
22
-
23
- class MarkContentView extends RectNode {
24
- static extendKey = 'MarkContent'
25
-
26
- getLabelShape(): h.JSX.Element {
27
- const { x, y, width, height } = this.props.model
28
- const style = this.props.model.getNodeStyle()
29
- return h(
30
- 'svg',
31
- {
32
- x: x - width / 2 + 5,
33
- y: y - height / 2 + 5,
34
- width: 25,
35
- height: 25,
36
- viewBox: '0 0 1274 1024',
37
- },
38
- h('path', {
39
- fill: style.stroke,
40
- d: 'M655.807326 287.35973m-223.989415 0a218.879 218.879 0 1 0 447.978829 0 218.879 218.879 0 1 0-447.978829 0ZM1039.955839 895.482975c-0.490184-212.177424-172.287821-384.030443-384.148513-384.030443-211.862739 0-383.660376 171.85302-384.15056 384.030443L1039.955839 895.482975z',
41
- }),
42
- )
43
- }
44
-
45
- getShape(): h.JSX.Element {
46
- const { x, y, width, height, radius } = this.props.model
47
- const style = this.props.model.getNodeStyle()
48
- return h('g', {}, [
49
- h('rect', {
50
- ...style,
51
- x: x - width / 2,
52
- y: y - height / 2,
53
- rx: radius,
54
- ry: radius,
55
- width,
56
- height,
57
- }),
58
- this.getLabelShape(),
59
- h(
60
- 'text',
61
- {
62
- fill: style.stroke,
63
- fontSize: 12,
64
- x: x - width / 2 + 30,
65
- y: y - height / 2 + 20,
66
- width: 50,
67
- height: 25,
68
- },
69
- '二级主题',
70
- ),
71
- ])
72
- }
73
- }
74
-
75
- const MarkContent = {
76
- type: 'mark:content',
77
- view: MarkContentView,
78
- model: MarkContentModel,
79
- }
80
-
81
- export default MarkContent
@@ -1,81 +0,0 @@
1
- import { h, RectNode, RectNodeModel } from '@logicflow/core'
2
-
3
- class MarkContentOptionModel extends RectNodeModel {
4
- static extendKey = 'MarkContentOptionModel'
5
-
6
- constructor(data, graphModel) {
7
- if (!data.text) {
8
- data.text = {
9
- x: data.x,
10
- y: data.y + 15,
11
- value: '',
12
- }
13
- }
14
- super(data, graphModel)
15
- }
16
-
17
- setAttributes() {
18
- this.height = 60
19
- this.strokeWidth = 1
20
- }
21
- }
22
-
23
- export class MarkContentOptionView extends RectNode {
24
- static extendKey = 'MarkContentOption'
25
-
26
- getLabelShape(): h.JSX.Element {
27
- const { x, y, width, height } = this.props.model
28
- const style = this.props.model.getNodeStyle()
29
- return h(
30
- 'svg',
31
- {
32
- x: x - width / 2 + 5,
33
- y: y - height / 2 + 5,
34
- width: 25,
35
- height: 25,
36
- viewBox: '0 0 1274 1024',
37
- },
38
- h('path', {
39
- fill: style.stroke,
40
- d: 'M655.807326 287.35973m-223.989415 0a218.879 218.879 0 1 0 447.978829 0 218.879 218.879 0 1 0-447.978829 0ZM1039.955839 895.482975c-0.490184-212.177424-172.287821-384.030443-384.148513-384.030443-211.862739 0-383.660376 171.85302-384.15056 384.030443L1039.955839 895.482975z',
41
- }),
42
- )
43
- }
44
-
45
- getShape(): h.JSX.Element {
46
- const { x, y, width, height, radius } = this.props.model
47
- const style = this.props.model.getNodeStyle()
48
- return h('g', {}, [
49
- h('rect', {
50
- x: x - width / 2,
51
- y: y - height / 2,
52
- ...style,
53
- rx: radius,
54
- ry: radius,
55
- width,
56
- height,
57
- }),
58
- this.getLabelShape(),
59
- h(
60
- 'text',
61
- {
62
- fill: style.stroke,
63
- fontSize: 12,
64
- x: x - width / 2 + 30,
65
- y: y - height / 2 + 20,
66
- width: 50,
67
- height: 25,
68
- },
69
- '主题内容',
70
- ),
71
- ])
72
- }
73
- }
74
-
75
- const MarkContentOption = {
76
- type: 'mark:content-option',
77
- view: MarkContentOptionView,
78
- model: MarkContentOptionModel,
79
- }
80
-
81
- export default MarkContentOption
@@ -1,82 +0,0 @@
1
- import { h, RectNode, RectNodeModel } from '@logicflow/core'
2
-
3
- class MarkEntityModel extends RectNodeModel {
4
- static extendKey = 'MarkEntityModel'
5
-
6
- constructor(data, graphModel) {
7
- if (!data.text) {
8
- data.text = {
9
- x: data.x,
10
- y: data.y + 15,
11
- value: '',
12
- }
13
- }
14
- super(data, graphModel)
15
- }
16
-
17
- setAttributes() {
18
- this.height = 60
19
- this.strokeWidth = 1
20
- }
21
- }
22
-
23
- class MarkEntityView extends RectNode {
24
- static extendKey = 'MarkEntity'
25
-
26
- getLabelShape(): h.JSX.Element {
27
- const { x, y, width, height } = this.props.model
28
- const style = this.props.model.getNodeStyle()
29
- return h(
30
- 'svg',
31
- {
32
- x: x - width / 2 + 5,
33
- y: y - height / 2 + 5,
34
- width: 25,
35
- height: 25,
36
- viewBox: '0 0 1274 1024',
37
- },
38
- h('path', {
39
- fill: style.stroke,
40
- d: 'M655.807326 287.35973m-223.989415 0a218.879 218.879 0 1 0 447.978829 0 218.879 218.879 0 1 0-447.978829 0ZM1039.955839 895.482975c-0.490184-212.177424-172.287821-384.030443-384.148513-384.030443-211.862739 0-383.660376 171.85302-384.15056 384.030443L1039.955839 895.482975z',
41
- }),
42
- )
43
- }
44
-
45
- getShape(): h.JSX.Element {
46
- const { x, y, width, height, radius } = this.props.model
47
- const style = this.props.model.getNodeStyle()
48
- // todo: 将basic-shape对外暴露,在这里可以直接用。现在纯手写有点麻烦。
49
- return h('g', {}, [
50
- h('rect', {
51
- x: x - width / 2,
52
- y: y - height / 2,
53
- rx: radius,
54
- ry: radius,
55
- width,
56
- height,
57
- ...style,
58
- }),
59
- this.getLabelShape(),
60
- h(
61
- 'text',
62
- {
63
- fill: style.stroke,
64
- fontSize: 12,
65
- x: x - width / 2 + 30,
66
- y: y - height / 2 + 20,
67
- width: 50,
68
- height: 25,
69
- },
70
- '一级主题',
71
- ),
72
- ])
73
- }
74
- }
75
-
76
- const MarkEntity = {
77
- type: 'mark:entity',
78
- view: MarkEntityView,
79
- model: MarkEntityModel,
80
- }
81
-
82
- export default MarkEntity
@@ -1,83 +0,0 @@
1
- import { h, RectNode, RectNodeModel } from '@logicflow/core'
2
-
3
- class MarkRootModel extends RectNodeModel {
4
- static extendKey = 'MarkRootModel'
5
-
6
- constructor(data, graphModel) {
7
- if (!data.text) {
8
- data.text = {
9
- x: data.x,
10
- y: data.y + 15,
11
- value: '',
12
- }
13
- }
14
- super(data, graphModel)
15
- }
16
-
17
- setAttributes() {
18
- this.height = 60
19
- this.strokeWidth = 1
20
- this.stroke = '#646764'
21
- }
22
- }
23
-
24
- class MarkRootView extends RectNode {
25
- static extendKey = 'MarkRoot'
26
-
27
- getLabelShape(): h.JSX.Element {
28
- const { x, y, width, height } = this.props.model
29
- const style = this.props.model.getNodeStyle()
30
- return h(
31
- 'svg',
32
- {
33
- x: x - width / 2 + 5,
34
- y: y - height / 2 + 5,
35
- width: 25,
36
- height: 25,
37
- viewBox: '0 0 1274 1024',
38
- },
39
- h('path', {
40
- fill: style.stroke,
41
- d: 'M655.807326 287.35973m-223.989415 0a218.879 218.879 0 1 0 447.978829 0 218.879 218.879 0 1 0-447.978829 0ZM1039.955839 895.482975c-0.490184-212.177424-172.287821-384.030443-384.148513-384.030443-211.862739 0-383.660376 171.85302-384.15056 384.030443L1039.955839 895.482975z',
42
- }),
43
- )
44
- }
45
-
46
- getShape(): h.JSX.Element {
47
- const style = this.props.model.getNodeStyle()
48
- const { x, y, width, height, radius } = this.props.model
49
- // todo: 将basic-shape对外暴露,在这里可以直接用。现在纯手写有点麻烦。
50
- return h('g', {}, [
51
- h('rect', {
52
- x: x - width / 2,
53
- y: y - height / 2,
54
- rx: radius,
55
- ry: radius,
56
- width,
57
- height,
58
- ...style,
59
- }),
60
- this.getLabelShape(),
61
- h(
62
- 'text',
63
- {
64
- fill: style.stroke,
65
- fontSize: 12,
66
- x: x - width / 2 + 30,
67
- y: y - height / 2 + 20,
68
- width: 50,
69
- height: 25,
70
- },
71
- '中心主题',
72
- ),
73
- ])
74
- }
75
- }
76
-
77
- const MarkRoot = {
78
- type: 'mark:root',
79
- view: MarkRootView,
80
- model: MarkRootModel,
81
- }
82
-
83
- export default MarkRoot
@@ -1,11 +0,0 @@
1
- export const theme = {
2
- rect: {
3
- // outlineColor: 'transparent'
4
- stroke: '#187DFF',
5
- },
6
- bezier: {
7
- offset: 100,
8
- strokeWidth: 1,
9
- stroke: '#a4a5a6',
10
- },
11
- }