sample-ui-component-library 0.0.1-beta → 0.0.2-beta

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sample-ui-component-library",
3
- "version": "0.0.1-beta",
3
+ "version": "0.0.2-beta",
4
4
  "description": "A library which contains sample UI elements that can be used for populating layouts.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -15,11 +15,11 @@ import { getLayoutInfoFromTree } from "./helper.js"
15
15
  const Flow = ({tree}) => {
16
16
  const { fitView } = useReactFlow();
17
17
  const [nodes, setNodes, onNodesChange] = useNodesState([]);
18
- const [edges, setEdges, onEdgesChange] = useEdgesState([]);
18
+ const [edges, setEdges, onEdgesChange] = useEdgesState([]);
19
19
 
20
20
  useEffect(() => {
21
21
  if (tree) {
22
- const flowInfo = getLayoutInfoFromTree(tree.data);
22
+ const flowInfo = getLayoutInfoFromTree(tree.data, tree.animated ?? false);
23
23
 
24
24
  //direction: TB, BT, LR, or RL, where T = top, B = bottom, L = left, and R = right.
25
25
  const layouted = getLayoutedElements(
@@ -14,10 +14,11 @@ const arrowStyle = {
14
14
 
15
15
  /**
16
16
  * Returns react flow nodes and edges from the given tree.
17
- * @param {Object} tree
18
- * @returns {Array} An array co
17
+ * @param {Object} tree Layout tree object.
18
+ * @param {boolean} animated Indicates if the edges should be animated.
19
+ * @returns {Array} An object containing nodes and edges arrays.
19
20
  */
20
- export const getLayoutInfoFromTree = (tree) => {
21
+ export const getLayoutInfoFromTree = (tree, animated) => {
21
22
  const edges = [];
22
23
  const nodes = [];
23
24
  Object.keys(tree).forEach((branchName, index1) => {
@@ -41,7 +42,7 @@ export const getLayoutInfoFromTree = (tree) => {
41
42
  id: prevNode.flowId + "-" + branchName + "-" + index + "-" + flowNode.flowId,
42
43
  source: prevNode.flowId,
43
44
  target: flowNode.flowId,
44
- animated: true,
45
+ animated: animated,
45
46
  markerEnd: marker,
46
47
  style: arrowStyle
47
48
  }