@flowgram.ai/free-layout-core 0.1.0-alpha.5 → 0.1.0-alpha.6

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/esm/index.js CHANGED
@@ -247,10 +247,17 @@ var WorkflowPortEntity = class extends Entity {
247
247
  }
248
248
  /**
249
249
  * 当前点位上连接的线条
250
+ * @deprecated use `availableLines` instead
250
251
  */
251
252
  get lines() {
252
253
  return this.allLines.filter((line) => !line.isDrawing);
253
254
  }
255
+ /**
256
+ * 当前有效的线条,不包含正在画的线条和隐藏的线条(这个出现在线条重连会先把原来的线条隐藏)
257
+ */
258
+ get availableLines() {
259
+ return this.allLines.filter((line) => !line.isDrawing && !line.isHidden);
260
+ }
254
261
  /**
255
262
  * 当前点位上连接的线条(包含 isDrawing === true 的线条)
256
263
  */
@@ -2160,7 +2167,7 @@ var WorkflowDocument = class extends FlowDocument {
2160
2167
  }
2161
2168
  toLineJSON(line) {
2162
2169
  const lineJSON = line.toJSON();
2163
- if (!line.to || !line.info.to || !line.toPort) {
2170
+ if (!line.from || !line.info.from || !line.fromPort || !line.to || !line.info.to || !line.toPort) {
2164
2171
  return;
2165
2172
  }
2166
2173
  const fromSubCanvas = this.getNodeSubCanvas(line.from);
@@ -2457,10 +2464,7 @@ var WorkflowDragService = class {
2457
2464
  dragNodeType: type,
2458
2465
  dropNode
2459
2466
  });
2460
- if (!allowDrop) {
2461
- return this.clearDrop();
2462
- }
2463
- const dragNode = await this.dropCard(type, e, data, dropNode);
2467
+ const dragNode = allowDrop ? await this.dropCard(type, e, data, dropNode) : void 0;
2464
2468
  this.clearDrop();
2465
2469
  if (dragNode) {
2466
2470
  domNode.remove();
@@ -2709,7 +2713,10 @@ var WorkflowDragService = class {
2709
2713
  this.setLineColor(line, this.linesManager.lineColor.drawing);
2710
2714
  if (toNode && !this.isContainer(toNode)) {
2711
2715
  const portsData = toNode.getData(WorkflowNodePortsData);
2712
- toPort = portsData.inputPorts[0];
2716
+ const { inputPorts } = portsData;
2717
+ if (inputPorts.length === 1) {
2718
+ toPort = inputPorts[0];
2719
+ }
2713
2720
  const { hasError } = this.handleDragOnNode(toNode, fromPort, line, toPort, originLine);
2714
2721
  lineErrorReset = hasError;
2715
2722
  }