@flowgram.ai/free-layout-core 0.2.28 → 0.2.29

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
@@ -2,8 +2,8 @@ import { PlaygroundConfigEntity, CommandService, PlaygroundDragEvent, EntityData
2
2
  export { bindConfigEntity, useConfigEntity, useEntities, useEntityDataFromContext, useEntityFromContext, useListenEvents, usePlayground, usePlaygroundContainer, usePlaygroundContext, usePlaygroundLatest, useRefresh, useService } from '@flowgram.ai/core';
3
3
  import { NodeFormProps } from '@flowgram.ai/node';
4
4
  import { FlowOperationBaseService, FlowNodeType, FlowOperationBaseServiceImpl, FlowNodeEntityOrId, FlowNodeEntity } from '@flowgram.ai/document';
5
- import { W as WorkflowHoverService, a as WorkflowDocument, b as WorkflowLinesManager, c as WorkflowSelectService, d as WorkflowDocumentOptions, L as LineEventProps, N as NodesDragEvent, e as WorkflowNodeJSON, f as WorkflowPortEntity, g as WorkflowLineEntity, O as OnDragLineEnd, h as WorkflowJSON, i as WorkflowPorts, j as WorkflowPortType, k as WorkflowPort, l as LineRenderType, m as WorkflowLineRenderContribution, n as LinePosition } from './workflow-line-entity-JyclGGfq.mjs';
6
- export { K as HoverPosition, C as LINE_HOVER_DISTANCE, v as LineColor, w as LineColors, u as LineType, z as NodesDragEndEvent, y as NodesDragStartEvent, A as NodesDraggingEvent, P as POINT_RADIUS, H as PORT_SIZE, p as WORKFLOW_LINE_ENTITY, M as WorkfloEntityHoverable, s as WorkflowContentChangeEvent, r as WorkflowContentChangeType, R as WorkflowDocumentOptionsDefault, Q as WorkflowDocumentProvider, J as WorkflowEntityHoverable, E as WorkflowLineEntityOpts, F as WorkflowLineInfo, D as WorkflowLinePortInfo, x as WorkflowLineRenderContributionFactory, G as WorkflowLineUIState, t as WorkflowNodeMeta, I as WorkflowPortEntityOpts, q as domReactToBounds, o as getPortEntityId, B as onDragLineEndParams } from './workflow-line-entity-JyclGGfq.mjs';
5
+ import { W as WorkflowHoverService, a as WorkflowDocument, b as WorkflowLinesManager, c as WorkflowSelectService, d as WorkflowDocumentOptions, L as LineEventProps, N as NodesDragEvent, e as WorkflowNodeJSON, f as WorkflowPortEntity, g as WorkflowLineEntity, O as OnDragLineEnd, h as WorkflowJSON, i as WorkflowPorts, j as WorkflowPortType, k as WorkflowPort, l as LineRenderType, m as WorkflowLineRenderContribution, n as LinePosition } from './workflow-line-entity-Iq1OHmuK.mjs';
6
+ export { K as HoverPosition, C as LINE_HOVER_DISTANCE, v as LineColor, w as LineColors, u as LineType, z as NodesDragEndEvent, y as NodesDragStartEvent, A as NodesDraggingEvent, P as POINT_RADIUS, H as PORT_SIZE, p as WORKFLOW_LINE_ENTITY, M as WorkfloEntityHoverable, s as WorkflowContentChangeEvent, r as WorkflowContentChangeType, R as WorkflowDocumentOptionsDefault, Q as WorkflowDocumentProvider, J as WorkflowEntityHoverable, E as WorkflowLineEntityOpts, F as WorkflowLineInfo, D as WorkflowLinePortInfo, x as WorkflowLineRenderContributionFactory, G as WorkflowLineUIState, t as WorkflowNodeMeta, I as WorkflowPortEntityOpts, q as domReactToBounds, o as getPortEntityId, B as onDragLineEndParams } from './workflow-line-entity-Iq1OHmuK.mjs';
7
7
  import { W as WorkflowNodeEntity } from './workflow-sub-canvas-IQzlYvPD.mjs';
8
8
  export { a as WorkflowSubCanvas } from './workflow-sub-canvas-IQzlYvPD.mjs';
9
9
  import * as _flowgram_ai_utils from '@flowgram.ai/utils';
@@ -481,6 +481,7 @@ declare class WorkflowNodeLinesData extends EntityData<WorkflowNodeLines> {
481
481
  * 输出线条
482
482
  */
483
483
  get outputLines(): WorkflowLineEntity[];
484
+ get allLines(): WorkflowLineEntity[];
484
485
  /**
485
486
  * 输入节点
486
487
  */
package/dist/index.d.ts CHANGED
@@ -2,8 +2,8 @@ import { PlaygroundConfigEntity, CommandService, PlaygroundDragEvent, EntityData
2
2
  export { bindConfigEntity, useConfigEntity, useEntities, useEntityDataFromContext, useEntityFromContext, useListenEvents, usePlayground, usePlaygroundContainer, usePlaygroundContext, usePlaygroundLatest, useRefresh, useService } from '@flowgram.ai/core';
3
3
  import { NodeFormProps } from '@flowgram.ai/node';
4
4
  import { FlowOperationBaseService, FlowNodeType, FlowOperationBaseServiceImpl, FlowNodeEntityOrId, FlowNodeEntity } from '@flowgram.ai/document';
5
- import { W as WorkflowHoverService, a as WorkflowDocument, b as WorkflowLinesManager, c as WorkflowSelectService, d as WorkflowDocumentOptions, L as LineEventProps, N as NodesDragEvent, e as WorkflowNodeJSON, f as WorkflowPortEntity, g as WorkflowLineEntity, O as OnDragLineEnd, h as WorkflowJSON, i as WorkflowPorts, j as WorkflowPortType, k as WorkflowPort, l as LineRenderType, m as WorkflowLineRenderContribution, n as LinePosition } from './workflow-line-entity-A940oVos.js';
6
- export { K as HoverPosition, C as LINE_HOVER_DISTANCE, v as LineColor, w as LineColors, u as LineType, z as NodesDragEndEvent, y as NodesDragStartEvent, A as NodesDraggingEvent, P as POINT_RADIUS, H as PORT_SIZE, p as WORKFLOW_LINE_ENTITY, M as WorkfloEntityHoverable, s as WorkflowContentChangeEvent, r as WorkflowContentChangeType, R as WorkflowDocumentOptionsDefault, Q as WorkflowDocumentProvider, J as WorkflowEntityHoverable, E as WorkflowLineEntityOpts, F as WorkflowLineInfo, D as WorkflowLinePortInfo, x as WorkflowLineRenderContributionFactory, G as WorkflowLineUIState, t as WorkflowNodeMeta, I as WorkflowPortEntityOpts, q as domReactToBounds, o as getPortEntityId, B as onDragLineEndParams } from './workflow-line-entity-A940oVos.js';
5
+ import { W as WorkflowHoverService, a as WorkflowDocument, b as WorkflowLinesManager, c as WorkflowSelectService, d as WorkflowDocumentOptions, L as LineEventProps, N as NodesDragEvent, e as WorkflowNodeJSON, f as WorkflowPortEntity, g as WorkflowLineEntity, O as OnDragLineEnd, h as WorkflowJSON, i as WorkflowPorts, j as WorkflowPortType, k as WorkflowPort, l as LineRenderType, m as WorkflowLineRenderContribution, n as LinePosition } from './workflow-line-entity-LhmV98jq.js';
6
+ export { K as HoverPosition, C as LINE_HOVER_DISTANCE, v as LineColor, w as LineColors, u as LineType, z as NodesDragEndEvent, y as NodesDragStartEvent, A as NodesDraggingEvent, P as POINT_RADIUS, H as PORT_SIZE, p as WORKFLOW_LINE_ENTITY, M as WorkfloEntityHoverable, s as WorkflowContentChangeEvent, r as WorkflowContentChangeType, R as WorkflowDocumentOptionsDefault, Q as WorkflowDocumentProvider, J as WorkflowEntityHoverable, E as WorkflowLineEntityOpts, F as WorkflowLineInfo, D as WorkflowLinePortInfo, x as WorkflowLineRenderContributionFactory, G as WorkflowLineUIState, t as WorkflowNodeMeta, I as WorkflowPortEntityOpts, q as domReactToBounds, o as getPortEntityId, B as onDragLineEndParams } from './workflow-line-entity-LhmV98jq.js';
7
7
  import { W as WorkflowNodeEntity } from './workflow-sub-canvas-IQzlYvPD.js';
8
8
  export { a as WorkflowSubCanvas } from './workflow-sub-canvas-IQzlYvPD.js';
9
9
  import * as _flowgram_ai_utils from '@flowgram.ai/utils';
@@ -481,6 +481,7 @@ declare class WorkflowNodeLinesData extends EntityData<WorkflowNodeLines> {
481
481
  * 输出线条
482
482
  */
483
483
  get outputLines(): WorkflowLineEntity[];
484
+ get allLines(): WorkflowLineEntity[];
484
485
  /**
485
486
  * 输入节点
486
487
  */
package/dist/index.js CHANGED
@@ -243,15 +243,16 @@ var WorkflowPortEntity = class extends import_core4.Entity {
243
243
  }
244
244
  // 设置连线的错误态,外部应使用 validate 进行更新
245
245
  set hasError(hasError) {
246
- this._hasError = hasError;
247
- this._onErrorChangedEmitter.fire();
246
+ if (hasError !== this._hasError) {
247
+ this._hasError = hasError;
248
+ this._onErrorChangedEmitter.fire();
249
+ }
248
250
  }
249
251
  validate() {
250
252
  const anyLineHasError = this.allLines.some((line) => {
251
253
  if (line.disposed || line.isHidden) {
252
254
  return false;
253
255
  }
254
- line.validateSelf();
255
256
  return line.hasError;
256
257
  });
257
258
  const isPortHasError = this.node.document.isErrorPort(this);
@@ -445,7 +446,6 @@ var WorkflowNodePortsData = class extends import_core5.EntityData {
445
446
  port.allLines.forEach((line) => {
446
447
  line.validate();
447
448
  });
448
- port.validate();
449
449
  });
450
450
  }
451
451
  /**
@@ -576,6 +576,9 @@ var _WorkflowNodeLinesData = class _WorkflowNodeLinesData extends import_core6.E
576
576
  get outputLines() {
577
577
  return this.data.outputLines;
578
578
  }
579
+ get allLines() {
580
+ return this.data.inputLines.concat(this.data.outputLines);
581
+ }
579
582
  /**
580
583
  * 输入节点
581
584
  */
@@ -791,6 +794,14 @@ var _WorkflowLineEntity = class _WorkflowLineEntity extends import_core8.Entity
791
794
  if (opts.drawingTo) {
792
795
  this.isDrawing = true;
793
796
  }
797
+ this.onEntityChange(() => {
798
+ this.fromPort?.validate();
799
+ this.toPort?.validate();
800
+ });
801
+ this.onDispose(() => {
802
+ this.fromPort?.validate();
803
+ this.toPort?.validate();
804
+ });
794
805
  }
795
806
  /**
796
807
  * 转成线条 id
@@ -896,6 +907,7 @@ var _WorkflowLineEntity = class _WorkflowLineEntity extends import_core8.Entity
896
907
  if (this.toPort === toPort) {
897
908
  return;
898
909
  }
910
+ const prePort = this.toPort;
899
911
  if (toPort && toPort.portType === "input" && this.linesManager.canAddLine(this.fromPort, toPort, true)) {
900
912
  const { node, portID } = toPort;
901
913
  this._to = node;
@@ -908,6 +920,9 @@ var _WorkflowLineEntity = class _WorkflowLineEntity extends import_core8.Entity
908
920
  this.info.to = void 0;
909
921
  this.info.toPort = "";
910
922
  }
923
+ if (prePort) {
924
+ prePort.validate();
925
+ }
911
926
  this.fireChange();
912
927
  }
913
928
  /**
@@ -1021,11 +1036,12 @@ var _WorkflowLineEntity = class _WorkflowLineEntity extends import_core8.Entity
1021
1036
  }
1022
1037
  // 校验连线是否为错误态
1023
1038
  validate() {
1024
- const { fromPort, toPort } = this;
1025
1039
  this.validateSelf();
1026
- fromPort?.validate();
1027
- toPort?.validate();
1028
1040
  }
1041
+ /**
1042
+ * use `validate` instead
1043
+ * @deprecated
1044
+ */
1029
1045
  validateSelf() {
1030
1046
  const { fromPort, toPort } = this;
1031
1047
  if (fromPort) {
@@ -1486,7 +1502,6 @@ var WorkflowLinesManager = class {
1486
1502
  }
1487
1503
  fromNode.removeLine(line);
1488
1504
  toNode?.removeLine(line);
1489
- line.validate();
1490
1505
  });
1491
1506
  line.onDispose(() => {
1492
1507
  if (available) {