@flowgram.ai/free-auto-layout-plugin 1.0.0 → 1.0.2
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 +4 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.d.mts
CHANGED
|
@@ -234,6 +234,9 @@ interface LayoutOptions {
|
|
|
234
234
|
node: WorkflowNodeEntity;
|
|
235
235
|
parent?: WorkflowNodeEntity;
|
|
236
236
|
}) => boolean;
|
|
237
|
+
filterLine?: (params: {
|
|
238
|
+
line: WorkflowLineEntity;
|
|
239
|
+
}) => boolean;
|
|
237
240
|
}
|
|
238
241
|
interface LayoutConfig {
|
|
239
242
|
/** 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
|
@@ -234,6 +234,9 @@ interface LayoutOptions {
|
|
|
234
234
|
node: WorkflowNodeEntity;
|
|
235
235
|
parent?: WorkflowNodeEntity;
|
|
236
236
|
}) => boolean;
|
|
237
|
+
filterLine?: (params: {
|
|
238
|
+
line: WorkflowLineEntity;
|
|
239
|
+
}) => boolean;
|
|
237
240
|
}
|
|
238
241
|
interface LayoutConfig {
|
|
239
242
|
/** 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
|
@@ -2640,7 +2640,9 @@ var AutoLayoutService = class {
|
|
|
2640
2640
|
const blocks = node.blocks.filter(
|
|
2641
2641
|
(blockNode) => options.filterNode ? options.filterNode?.({ node: blockNode, parent: node.parent }) : true
|
|
2642
2642
|
);
|
|
2643
|
-
const edges = this.getNodesAllLines(blocks)
|
|
2643
|
+
const edges = this.getNodesAllLines(blocks).filter(
|
|
2644
|
+
(edge) => options.filterLine ? options.filterLine?.({ line: edge }) : true
|
|
2645
|
+
);
|
|
2644
2646
|
const layoutNodes = this.createLayoutNodes(blocks, options);
|
|
2645
2647
|
const layoutEdges = this.createLayoutEdges(edges);
|
|
2646
2648
|
const { bounds, padding } = node.transform;
|
|
@@ -2671,7 +2673,7 @@ var AutoLayoutService = class {
|
|
|
2671
2673
|
/** 创建线条布局数据 */
|
|
2672
2674
|
createLayoutEdge(edge) {
|
|
2673
2675
|
const { from, to } = edge.info;
|
|
2674
|
-
if (!from || !to
|
|
2676
|
+
if (!from || !to) {
|
|
2675
2677
|
return;
|
|
2676
2678
|
}
|
|
2677
2679
|
const layoutEdge = {
|