From 974d94f8b53d90b9d68534f2fe9caf075ae1ddc6 Mon Sep 17 00:00:00 2001 From: Michael Xu Date: Mon, 30 Sep 2019 20:55:32 +0000 Subject: [PATCH 1/2] put in a line renderer that gives an opportunity to customize key/value key /nestedvalue behavior --- .../react-json-tree/src/JSONNestedNode.js | 47 +++++++++++-------- packages/react-json-tree/src/JSONNode.js | 3 ++ packages/react-json-tree/src/JSONValueNode.js | 20 ++++---- packages/react-json-tree/src/index.js | 2 + 4 files changed, 45 insertions(+), 27 deletions(-) diff --git a/packages/react-json-tree/src/JSONNestedNode.js b/packages/react-json-tree/src/JSONNestedNode.js index e19aa253..3a0c9073 100644 --- a/packages/react-json-tree/src/JSONNestedNode.js +++ b/packages/react-json-tree/src/JSONNestedNode.js @@ -90,6 +90,7 @@ export default class JSONNestedNode extends React.Component { PropTypes.oneOfType([PropTypes.string, PropTypes.number]) ).isRequired, labelRenderer: PropTypes.func.isRequired, + lineRenderer: PropTypes.func.isRequired, shouldExpandNode: PropTypes.func, level: PropTypes.number.isRequired, sortObjectKeys: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]), @@ -140,6 +141,7 @@ export default class JSONNestedNode extends React.Component { collectionLimit, keyPath, labelRenderer, + lineRenderer, expandable } = this.props; const { expanded } = this.state; @@ -161,23 +163,16 @@ export default class JSONNestedNode extends React.Component { ); const stylingArgs = [keyPath, nodeType, expanded, expandable]; - return hideRoot ? ( -
  • - -
  • - ) : ( -
  • - {expandable && ( - - )} -