@flowgram.ai/free-auto-layout-plugin 0.1.0-alpha.18 → 0.1.0-alpha.19
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 +9 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/esm/index.js
CHANGED
|
@@ -2101,6 +2101,7 @@ var DefaultLayoutConfig = {
|
|
|
2101
2101
|
ranker: "network-simplex"
|
|
2102
2102
|
};
|
|
2103
2103
|
var DefaultLayoutOptions = {
|
|
2104
|
+
filterNode: void 0,
|
|
2104
2105
|
getFollowNode: void 0,
|
|
2105
2106
|
disableFitView: false,
|
|
2106
2107
|
enableAnimation: false,
|
|
@@ -2592,7 +2593,11 @@ var AutoLayoutService = class {
|
|
|
2592
2593
|
return [];
|
|
2593
2594
|
}
|
|
2594
2595
|
const childrenLayouts = (await Promise.all(layoutNodes.map((n) => this.layoutNode(n, options)))).flat();
|
|
2595
|
-
const
|
|
2596
|
+
const layoutConfig = {
|
|
2597
|
+
...this.layoutConfig,
|
|
2598
|
+
...options.layoutConfig
|
|
2599
|
+
};
|
|
2600
|
+
const layout2 = new Layout(layoutConfig);
|
|
2596
2601
|
layout2.init({ container, layoutNodes, layoutEdges }, options);
|
|
2597
2602
|
layout2.layout();
|
|
2598
2603
|
const rect = this.getLayoutNodeRect(container);
|
|
@@ -2607,7 +2612,9 @@ var AutoLayoutService = class {
|
|
|
2607
2612
|
}
|
|
2608
2613
|
/** 创建节点布局数据 */
|
|
2609
2614
|
createLayoutNode(node, options) {
|
|
2610
|
-
const
|
|
2615
|
+
const blocks = node.blocks.filter(
|
|
2616
|
+
(blockNode) => options.filterNode ? options.filterNode?.({ node: blockNode, parent: node.parent }) : true
|
|
2617
|
+
);
|
|
2611
2618
|
const edges = this.getNodesAllLines(blocks);
|
|
2612
2619
|
const layoutNodes = this.createLayoutNodes(blocks, options);
|
|
2613
2620
|
const layoutEdges = this.createLayoutEdges(edges);
|