vue-wiring-diagram 1.0.8 → 1.0.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-wiring-diagram",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "A Vue 3.x component for wiring diagram",
5
5
  "type": "module",
6
6
  "main": "dist/vue-wiring-diagram.umd.js",
@@ -26,8 +26,8 @@ export const showPorts = (div, show) => {
26
26
  /**
27
27
  * 获取数据
28
28
  */
29
- export const getData = () => {
30
- return get('/cny/template/selectOne', {id: 36}).then(res => {
29
+ export const getData = (id) => {
30
+ return get('/cny/template/selectOne', {id: id}).then(res => {
31
31
  if (res?.isOk) {
32
32
  const data = JSON.parse(res.data.remark)
33
33
  return {
@@ -217,12 +217,6 @@ const initGraph = () => {
217
217
  controlsKey.value = moment().valueOf()
218
218
  })
219
219
 
220
- // graph.value.on('node:added', ({node}) => {
221
- // if(!node.label) {
222
- // return
223
- // }
224
- // node.label = ''
225
- // })
226
220
 
227
221
  //选中节点
228
222
  graph.value.on('cell:click', ({cell}) => {
@@ -313,7 +307,9 @@ const initStencil = () => {
313
307
  notFoundText: '未找到匹配项',
314
308
  getDragNode: (node) => {
315
309
  const copyNode = node.clone({ keepId: true })
316
- copyNode.label = ''
310
+ if(copyNode.label !== '文本') {
311
+ copyNode.label = ''
312
+ }
317
313
  return copyNode
318
314
  },
319
315
  getDropNode: (node) => {