refactor(dev): rename dev-flows to example

This commit is contained in:
moklick
2020-10-06 11:54:02 +02:00
parent 49906ddda8
commit 7ec68efea6
31 changed files with 4 additions and 4 deletions
+28
View File
@@ -0,0 +1,28 @@
export function getElements(xElements = 10, yElements = 10) {
const initialElements = [];
let nodeId = 1;
let recentNodeId = null;
for (let y = 0; y < yElements; y++) {
for (let x = 0; x < xElements; x++) {
const position = { x: x * 100, y: y * 50 };
const data = { label: `Node ${nodeId}` };
const node = {
id: nodeId.toString(),
style: { width: 50, fontSize: 11 },
data,
position,
};
initialElements.push(node);
if (recentNodeId && nodeId <= (xElements * yElements)) {
initialElements.push({ id: `${x}-${y}`, source: recentNodeId.toString(), target: nodeId.toString() });
}
recentNodeId = nodeId;
nodeId++;
}
}
return initialElements;
}