power-link 2.0.4 → 2.0.5

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/dist/index.d.mts CHANGED
@@ -127,6 +127,8 @@ interface ExportNodeData {
127
127
  }
128
128
  /** 导出的单条连接数据 */
129
129
  interface ExportConnectionData {
130
+ /** 连接唯一标识,格式:fromId:fromDot-toId:toDot */
131
+ id: string;
130
132
  from: string;
131
133
  /** from 节点名称 */
132
134
  fromLabel?: string;
package/dist/index.d.ts CHANGED
@@ -127,6 +127,8 @@ interface ExportNodeData {
127
127
  }
128
128
  /** 导出的单条连接数据 */
129
129
  interface ExportConnectionData {
130
+ /** 连接唯一标识,格式:fromId:fromDot-toId:toDot */
131
+ id: string;
130
132
  from: string;
131
133
  /** from 节点名称 */
132
134
  fromLabel?: string;
@@ -740,7 +740,7 @@ var PowerLink = (function (exports) {
740
740
  this.ctx.svg.appendChild(connectionLine);
741
741
  const deleteButton = this.createDeleteButton();
742
742
  const connection = {
743
- id: `${fromNode.id}-${toNode.id}-${fromDot.position}-${toDot.position}-${Date.now()}`,
743
+ id: `${fromNode.id}:${fromDot.position}-${toNode.id}:${toDot.position}`,
744
744
  fromNode,
745
745
  toNode,
746
746
  fromDot,
@@ -1370,6 +1370,7 @@ var PowerLink = (function (exports) {
1370
1370
  dotPositions: node.dotPositions
1371
1371
  })),
1372
1372
  connections: this.ctx.connections.map((conn) => ({
1373
+ id: conn.id,
1373
1374
  from: conn.fromNode.id,
1374
1375
  fromLabel: conn.fromNode.label,
1375
1376
  fromInfo: conn.fromNode.info,
@@ -1423,9 +1424,7 @@ var PowerLink = (function (exports) {
1423
1424
  element.style.top = `${nodeData.y}px`;
1424
1425
  this.ctx.contentWrapper.appendChild(element);
1425
1426
  } else {
1426
- element = this.ctx.contentWrapper.querySelector(
1427
- `[id="${nodeData.id}"]`
1428
- );
1427
+ element = this.ctx.contentWrapper.querySelector(`[id="${nodeData.id}"]`);
1429
1428
  if (element) {
1430
1429
  element.style.left = `${nodeData.x}px`;
1431
1430
  element.style.top = `${nodeData.y}px`;
@@ -1436,6 +1435,7 @@ var PowerLink = (function (exports) {
1436
1435
  continue;
1437
1436
  }
1438
1437
  this.nodeManager.registerNode(nodeData.id, element, {
1438
+ label: nodeData.label,
1439
1439
  dotPositions: nodeData.dotPositions,
1440
1440
  info: nodeData.info
1441
1441
  });
package/dist/index.js CHANGED
@@ -741,7 +741,7 @@ var _ConnectionManager = class _ConnectionManager {
741
741
  this.ctx.svg.appendChild(connectionLine);
742
742
  const deleteButton = this.createDeleteButton();
743
743
  const connection = {
744
- id: `${fromNode.id}-${toNode.id}-${fromDot.position}-${toDot.position}-${Date.now()}`,
744
+ id: `${fromNode.id}:${fromDot.position}-${toNode.id}:${toDot.position}`,
745
745
  fromNode,
746
746
  toNode,
747
747
  fromDot,
@@ -1371,6 +1371,7 @@ var _Connector = class _Connector {
1371
1371
  dotPositions: node.dotPositions
1372
1372
  })),
1373
1373
  connections: this.ctx.connections.map((conn) => ({
1374
+ id: conn.id,
1374
1375
  from: conn.fromNode.id,
1375
1376
  fromLabel: conn.fromNode.label,
1376
1377
  fromInfo: conn.fromNode.info,
@@ -1424,9 +1425,7 @@ var _Connector = class _Connector {
1424
1425
  element.style.top = `${nodeData.y}px`;
1425
1426
  this.ctx.contentWrapper.appendChild(element);
1426
1427
  } else {
1427
- element = this.ctx.contentWrapper.querySelector(
1428
- `[id="${nodeData.id}"]`
1429
- );
1428
+ element = this.ctx.contentWrapper.querySelector(`[id="${nodeData.id}"]`);
1430
1429
  if (element) {
1431
1430
  element.style.left = `${nodeData.x}px`;
1432
1431
  element.style.top = `${nodeData.y}px`;
@@ -1437,6 +1436,7 @@ var _Connector = class _Connector {
1437
1436
  continue;
1438
1437
  }
1439
1438
  this.nodeManager.registerNode(nodeData.id, element, {
1439
+ label: nodeData.label,
1440
1440
  dotPositions: nodeData.dotPositions,
1441
1441
  info: nodeData.info
1442
1442
  });
package/dist/index.mjs CHANGED
@@ -737,7 +737,7 @@ var _ConnectionManager = class _ConnectionManager {
737
737
  this.ctx.svg.appendChild(connectionLine);
738
738
  const deleteButton = this.createDeleteButton();
739
739
  const connection = {
740
- id: `${fromNode.id}-${toNode.id}-${fromDot.position}-${toDot.position}-${Date.now()}`,
740
+ id: `${fromNode.id}:${fromDot.position}-${toNode.id}:${toDot.position}`,
741
741
  fromNode,
742
742
  toNode,
743
743
  fromDot,
@@ -1367,6 +1367,7 @@ var _Connector = class _Connector {
1367
1367
  dotPositions: node.dotPositions
1368
1368
  })),
1369
1369
  connections: this.ctx.connections.map((conn) => ({
1370
+ id: conn.id,
1370
1371
  from: conn.fromNode.id,
1371
1372
  fromLabel: conn.fromNode.label,
1372
1373
  fromInfo: conn.fromNode.info,
@@ -1420,9 +1421,7 @@ var _Connector = class _Connector {
1420
1421
  element.style.top = `${nodeData.y}px`;
1421
1422
  this.ctx.contentWrapper.appendChild(element);
1422
1423
  } else {
1423
- element = this.ctx.contentWrapper.querySelector(
1424
- `[id="${nodeData.id}"]`
1425
- );
1424
+ element = this.ctx.contentWrapper.querySelector(`[id="${nodeData.id}"]`);
1426
1425
  if (element) {
1427
1426
  element.style.left = `${nodeData.x}px`;
1428
1427
  element.style.top = `${nodeData.y}px`;
@@ -1433,6 +1432,7 @@ var _Connector = class _Connector {
1433
1432
  continue;
1434
1433
  }
1435
1434
  this.nodeManager.registerNode(nodeData.id, element, {
1435
+ label: nodeData.label,
1436
1436
  dotPositions: nodeData.dotPositions,
1437
1437
  info: nodeData.info
1438
1438
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "power-link",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": "A pure TypeScript visual node connector for creating draggable connections between nodes. Framework-agnostic and easy to use",
5
5
  "author": {
6
6
  "name": "Lin Ji Man",