repeat node initial support
This commit is contained in:
1 parent
f392cf17fd
commit
de2307901b
13 files changed
+301
-77
No files matched your search
@@ -5,14 +5,18 @@ import { CollectionNode } from "./CollectionNode";
|
||||
import { DAGGraphBoard } from "components/DAGGraph/board";
|
||||
import { CollectionNodeMaker } from "./index";
|
||||
import { DEFAULT_DIMS } from "components/DAGGraph/elements/constants";
|
||||
import { ButtonNodeMaker } from "../ButtonNode";
|
||||
import { AddCircle } from "@mui/icons-material";
|
||||
import { MarkerType } from "react-flow-renderer";
|
||||
|
||||
const Demo: FC<{
|
||||
type DemoProps = {
|
||||
height: number;
|
||||
width: number;
|
||||
totalChildNodes: number;
|
||||
onAddNode: () => void;
|
||||
enabledChild: boolean;
|
||||
}> = (args) => {
|
||||
};
|
||||
const Demo: FC<DemoProps> = (args) => {
|
||||
return (
|
||||
<Page>
|
||||
<DAGGraphBoard
|
||||
@@ -124,3 +128,95 @@ Empty.args = {
|
||||
...Empty.args,
|
||||
totalChildNodes: 0,
|
||||
};
|
||||
|
||||
export const ReturnTarget: ComponentStory<typeof Demo> = (args) => {
|
||||
return (
|
||||
<Page>
|
||||
<DAGGraphBoard
|
||||
closeModal={() => {}}
|
||||
state={{
|
||||
ready: true,
|
||||
data: {
|
||||
elements: {
|
||||
edges: [
|
||||
{
|
||||
id: "1",
|
||||
source: "root",
|
||||
target: "btn",
|
||||
label: "1",
|
||||
},
|
||||
{
|
||||
id: "2",
|
||||
target: "root",
|
||||
source: "btn",
|
||||
animated: true,
|
||||
targetHandle: "return",
|
||||
label: "2",
|
||||
markerEnd: {
|
||||
type: MarkerType.ArrowClosed,
|
||||
width: 25,
|
||||
height: 25,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "3",
|
||||
target: "root",
|
||||
source: "btn",
|
||||
label: "3",
|
||||
},
|
||||
],
|
||||
nodes: [
|
||||
ButtonNodeMaker.makeElement(
|
||||
{
|
||||
id: "btn",
|
||||
position: {
|
||||
x: 50 + (args.width - DEFAULT_DIMS.node.width) / 2,
|
||||
y:
|
||||
50 +
|
||||
args.height *
|
||||
2 *
|
||||
DEFAULT_DIMS.distanceFactor.collection,
|
||||
},
|
||||
},
|
||||
DEFAULT_DIMS,
|
||||
{
|
||||
icon: <AddCircle />,
|
||||
onClick: () => {},
|
||||
}
|
||||
),
|
||||
CollectionNodeMaker.makeElement(
|
||||
{
|
||||
id: "root",
|
||||
position: {
|
||||
x: 50,
|
||||
y: 50,
|
||||
},
|
||||
},
|
||||
DEFAULT_DIMS,
|
||||
{
|
||||
onAddNode: args.onAddNode,
|
||||
width: args.width,
|
||||
height: args.height,
|
||||
nodes: [
|
||||
{
|
||||
enabled: args.enabledChild,
|
||||
label: "condition",
|
||||
},
|
||||
...Array.from(Array(args.totalChildNodes)).map(
|
||||
(_, i) => ({
|
||||
enabled: true,
|
||||
label: `Dummy Node #${i + 1}`,
|
||||
})
|
||||
),
|
||||
],
|
||||
collectionType: "condition",
|
||||
}
|
||||
),
|
||||
],
|
||||
},
|
||||
},
|
||||
}}
|
||||
/>
|
||||
</Page>
|
||||
);
|
||||
};
|
||||
Reference in new issue
Block a user