@flowgram.ai/document 0.2.3 → 0.2.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
@@ -9,6 +9,7 @@ import { ContainerModule } from 'inversify';
9
9
  */
10
10
  declare class FlowVirtualTree<T extends {
11
11
  id: string;
12
+ flowNodeType?: FlowNodeType;
12
13
  }> implements Disposable {
13
14
  readonly root: T;
14
15
  protected onTreeChangeEmitter: Emitter<void>;
@@ -45,7 +46,7 @@ declare class FlowVirtualTree<T extends {
45
46
  */
46
47
  fireTreeChange(): void;
47
48
  get size(): number;
48
- toString(): string;
49
+ toString(showType?: boolean): string;
49
50
  }
50
51
  declare namespace FlowVirtualTree {
51
52
  interface NodeInfo<T> {
@@ -395,7 +396,7 @@ declare class FlowDocument<T = FlowDocumentJSON> implements Disposable {
395
396
  get size(): number;
396
397
  hasNode(nodeId: string): boolean;
397
398
  getAllNodes(): FlowNodeEntity[];
398
- toString(): string;
399
+ toString(showType?: boolean): string;
399
400
  /**
400
401
  * 返回需要渲染的数据
401
402
  */
@@ -1124,6 +1125,7 @@ interface FlowNodeRegistry<M extends FlowNodeMeta = FlowNodeMeta> {
1124
1125
  */
1125
1126
  extendChildRegistries?: FlowNodeRegistry[];
1126
1127
  /**
1128
+ * @deprecated
1127
1129
  * 自定义子节点添加逻辑
1128
1130
  * @param node 节点
1129
1131
  * @param json 添加的节点 JSON
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ import { ContainerModule } from 'inversify';
9
9
  */
10
10
  declare class FlowVirtualTree<T extends {
11
11
  id: string;
12
+ flowNodeType?: FlowNodeType;
12
13
  }> implements Disposable {
13
14
  readonly root: T;
14
15
  protected onTreeChangeEmitter: Emitter<void>;
@@ -45,7 +46,7 @@ declare class FlowVirtualTree<T extends {
45
46
  */
46
47
  fireTreeChange(): void;
47
48
  get size(): number;
48
- toString(): string;
49
+ toString(showType?: boolean): string;
49
50
  }
50
51
  declare namespace FlowVirtualTree {
51
52
  interface NodeInfo<T> {
@@ -395,7 +396,7 @@ declare class FlowDocument<T = FlowDocumentJSON> implements Disposable {
395
396
  get size(): number;
396
397
  hasNode(nodeId: string): boolean;
397
398
  getAllNodes(): FlowNodeEntity[];
398
- toString(): string;
399
+ toString(showType?: boolean): string;
399
400
  /**
400
401
  * 返回需要渲染的数据
401
402
  */
@@ -1124,6 +1125,7 @@ interface FlowNodeRegistry<M extends FlowNodeMeta = FlowNodeMeta> {
1124
1125
  */
1125
1126
  extendChildRegistries?: FlowNodeRegistry[];
1126
1127
  /**
1128
+ * @deprecated
1127
1129
  * 自定义子节点添加逻辑
1128
1130
  * @param node 节点
1129
1131
  * @param json 添加的节点 JSON
package/dist/index.js CHANGED
@@ -1478,13 +1478,15 @@ var FlowVirtualTree = class _FlowVirtualTree {
1478
1478
  get size() {
1479
1479
  return this.map.size;
1480
1480
  }
1481
- toString() {
1481
+ toString(showType) {
1482
1482
  const ret = [];
1483
1483
  this.traverse((node, depth) => {
1484
1484
  if (depth === 0) {
1485
1485
  ret.push(node.id);
1486
1486
  } else {
1487
- ret.push(`|${new Array(depth).fill("--").join("")} ${node.id}`);
1487
+ ret.push(
1488
+ `|${new Array(depth).fill("--").join("")} ${showType ? `${node.flowNodeType}(${node.id})` : node.id}`
1489
+ );
1488
1490
  }
1489
1491
  });
1490
1492
  return `${ret.join("\n")}`;
@@ -2142,8 +2144,8 @@ var FlowDocument = class {
2142
2144
  getAllNodes() {
2143
2145
  return this.entityManager.getEntities(FlowNodeEntity);
2144
2146
  }
2145
- toString() {
2146
- return this.originTree.toString();
2147
+ toString(showType) {
2148
+ return this.originTree.toString(showType);
2147
2149
  }
2148
2150
  /**
2149
2151
  * 返回需要渲染的数据