@flowgram.ai/free-auto-layout-plugin 0.5.1 → 0.5.3

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
@@ -229,6 +229,10 @@ interface LayoutOptions {
229
229
  enableAnimation?: boolean;
230
230
  animationDuration?: number;
231
231
  disableFitView?: boolean;
232
+ filterNode?: (params: {
233
+ node: WorkflowNodeEntity;
234
+ parent?: WorkflowNodeEntity;
235
+ }) => boolean;
232
236
  }
233
237
  interface LayoutConfig {
234
238
  /** Direction for rank nodes. Can be TB, BT, LR, or RL, where T = top, B = bottom, L = left, and R = right. */
package/dist/index.d.ts CHANGED
@@ -229,6 +229,10 @@ interface LayoutOptions {
229
229
  enableAnimation?: boolean;
230
230
  animationDuration?: number;
231
231
  disableFitView?: boolean;
232
+ filterNode?: (params: {
233
+ node: WorkflowNodeEntity;
234
+ parent?: WorkflowNodeEntity;
235
+ }) => boolean;
232
236
  }
233
237
  interface LayoutConfig {
234
238
  /** Direction for rank nodes. Can be TB, BT, LR, or RL, where T = top, B = bottom, L = left, and R = right. */
package/dist/index.js CHANGED
@@ -2126,6 +2126,7 @@ var DefaultLayoutConfig = {
2126
2126
  ranker: "network-simplex"
2127
2127
  };
2128
2128
  var DefaultLayoutOptions = {
2129
+ filterNode: void 0,
2129
2130
  getFollowNode: void 0,
2130
2131
  disableFitView: false,
2131
2132
  enableAnimation: false,
@@ -2632,7 +2633,9 @@ var AutoLayoutService = class {
2632
2633
  }
2633
2634
  /** 创建节点布局数据 */
2634
2635
  createLayoutNode(node, options) {
2635
- const { blocks } = node;
2636
+ const blocks = node.blocks.filter(
2637
+ (blockNode) => options.filterNode ? options.filterNode?.({ node: blockNode, parent: node.parent }) : true
2638
+ );
2636
2639
  const edges = this.getNodesAllLines(blocks);
2637
2640
  const layoutNodes = this.createLayoutNodes(blocks, options);
2638
2641
  const layoutEdges = this.createLayoutEdges(edges);