Skip to content

✨ Innovative and open-source visualization application that transforms various data formats, such as JSON, YAML, XML and CSV into interactive graphs.

hide null keys from node

Aykut Saraçb2d1891d64e5
diff --git a/src/containers/LiveEditor/CustomNode.tsx b/src/containers/LiveEditor/CustomNode.tsx
index eb15c5f5..c65f7d06 100644
--- a/src/containers/LiveEditor/CustomNode.tsx
+++ b/src/containers/LiveEditor/CustomNode.tsx
@@ -90,22 +90,25 @@ const CustomNode = ({ nodeProps }) => {
<StyledForeignObject width={width} height={height} x={0} y={0}>
<StyledTextWrapper>
<StyledText width={width} height={height}>
- {entries.map((val) => (
- <div
- key={nodeProps.id}
- style={{
- height: "fit-content",
- overflow: "hidden",
- textOverflow: "ellipsis",
- whiteSpace: "nowrap",
- padding: '0 auto',
- width: width - 20
- }}
- >
- <StyledKey>{val[0]}: </StyledKey>
- {val[1]}
- </div>
- ))}
+ {entries.map(
+ (val) =>
+ val[1] !== null && (
+ <div
+ key={nodeProps.id}
+ style={{
+ height: "fit-content",
+ overflow: "hidden",
+ textOverflow: "ellipsis",
+ whiteSpace: "nowrap",
+ padding: "0 auto",
+ width: width - 20,
+ }}
+ >
+ <StyledKey>{val[0]}: </StyledKey>
+ {val[1]}
+ </div>
+ )
+ )}
</StyledText>
</StyledTextWrapper>
</StyledForeignObject>
diff --git a/src/containers/LiveEditor/helpers.ts b/src/containers/LiveEditor/helpers.ts
index 4f09fcda..ea13c6e7 100644
--- a/src/containers/LiveEditor/helpers.ts
+++ b/src/containers/LiveEditor/helpers.ts
@@ -22,8 +22,8 @@ export function getEdgeNodes(graph: any, isExpanded: boolean = true): any {
nodes.push({
id: el.id,
text: el.text,
- width: isExpanded ? (35 + longestLine * 8) : 180,
- height: isExpanded ? (30 + lines.length * 10) : 50,
+ width: isExpanded ? 35 + longestLine * 8 : 180,
+ height: isExpanded ? 30 + lines.length * 10 : 50,
data: { type: "special" },
});
} else {