hide null keys from node

This commit is contained in:
Aykut Saraç 2022-02-15 12:44:44 +03:00
parent d7b8da00f9
commit b2d1891d64
2 changed files with 21 additions and 18 deletions

View File

@ -90,7 +90,9 @@ const CustomNode = ({ nodeProps }) => {
<StyledForeignObject width={width} height={height} x={0} y={0}> <StyledForeignObject width={width} height={height} x={0} y={0}>
<StyledTextWrapper> <StyledTextWrapper>
<StyledText width={width} height={height}> <StyledText width={width} height={height}>
{entries.map((val) => ( {entries.map(
(val) =>
val[1] !== null && (
<div <div
key={nodeProps.id} key={nodeProps.id}
style={{ style={{
@ -98,14 +100,15 @@ const CustomNode = ({ nodeProps }) => {
overflow: "hidden", overflow: "hidden",
textOverflow: "ellipsis", textOverflow: "ellipsis",
whiteSpace: "nowrap", whiteSpace: "nowrap",
padding: '0 auto', padding: "0 auto",
width: width - 20 width: width - 20,
}} }}
> >
<StyledKey>{val[0]}: </StyledKey> <StyledKey>{val[0]}: </StyledKey>
{val[1]} {val[1]}
</div> </div>
))} )
)}
</StyledText> </StyledText>
</StyledTextWrapper> </StyledTextWrapper>
</StyledForeignObject> </StyledForeignObject>

View File

@ -22,8 +22,8 @@ export function getEdgeNodes(graph: any, isExpanded: boolean = true): any {
nodes.push({ nodes.push({
id: el.id, id: el.id,
text: el.text, text: el.text,
width: isExpanded ? (35 + longestLine * 8) : 180, width: isExpanded ? 35 + longestLine * 8 : 180,
height: isExpanded ? (30 + lines.length * 10) : 50, height: isExpanded ? 30 + lines.length * 10 : 50,
data: { type: "special" }, data: { type: "special" },
}); });
} else { } else {