vue-wiring-diagram 1.0.7 → 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.7",
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,6 +217,7 @@ const initGraph = () => {
217
217
  controlsKey.value = moment().valueOf()
218
218
  })
219
219
 
220
+
220
221
  //选中节点
221
222
  graph.value.on('cell:click', ({cell}) => {
222
223
  console.log('cell:click', cell, cell?.data?.type ?? cell?.shape)
@@ -304,6 +305,16 @@ const initStencil = () => {
304
305
  },
305
306
  placeholder: '搜索',
306
307
  notFoundText: '未找到匹配项',
308
+ getDragNode: (node) => {
309
+ const copyNode = node.clone({ keepId: true })
310
+ if(copyNode.label !== '文本') {
311
+ copyNode.label = ''
312
+ }
313
+ return copyNode
314
+ },
315
+ getDropNode: (node) => {
316
+ return node.clone({keepId: true})
317
+ },
307
318
  })
308
319
  const text = graph.value.createNode({
309
320
  ...textOptions
@@ -7,6 +7,7 @@
7
7
  display: grid;
8
8
  grid-template-rows: auto 1fr;
9
9
  overflow: hidden;
10
+ //background: url("/packages/assets/image/background.png") #091757 no-repeat center center / cover;
10
11
  background: url("/packages/assets/image/background.png") #091757 no-repeat center center / cover;
11
12
 
12
13
  ::-webkit-scrollbar {