import React from 'react';
const JSONTreeNodeIndicator = ({ toExpand, toShowNodeIndicator, handleToggle, ...restProps }) => {
const {
renderCustomIndicator,
typeofCurrentNode,
currentNode,
isSelected,
toExpandNode,
data,
path,
toExpandWithLabels,
toggleWithLabels,
} = restProps;
const defaultStyles = {
transform: toExpandNode && toExpand ? 'rotate(90deg)' : 'rotate(0deg)',
transition: '0.2s all',
display: 'inline-block',
cursor: 'pointer',
};
const handleToggleForNode = () => {
if (!toExpandNode) return;
if (toExpandWithLabels) {
return toggleWithLabels(data, currentNode, path);
}
return handleToggle(currentNode);
};
const renderDefaultIndicator = () => (
);
if (!toShowNodeIndicator && (typeofCurrentNode !== 'Object' || typeofCurrentNode !== 'Array')) return null;
return (
{renderCustomIndicator ? renderCustomIndicator() : renderDefaultIndicator()}
);
};
export default JSONTreeNodeIndicator;