@@ -36,6 +36,7 @@ function renderValue({
3636 endBracket = "}"
3737 path = { path }
3838 expandedPaths = { expandedPaths }
39+ hasWrapper = { Boolean ( wrapper ) }
3940 onClickPath = { onClickPath }
4041 renderPaths = { renderPaths }
4142 onToggleExpand = { onToggleExpand }
@@ -54,6 +55,7 @@ function renderValue({
5455 renderPaths = { renderPaths }
5556 path = { path }
5657 expandedPaths = { expandedPaths }
58+ hasWrapper = { Boolean ( wrapper ) }
5759 onClickPath = { onClickPath }
5860 onToggleExpand = { onToggleExpand }
5961 isArray
@@ -70,6 +72,7 @@ function renderValue({
7072 value = { value }
7173 onClickPath = { onClickPath }
7274 selectedStatePath = { selectedStatePath }
75+ hasWrapper = { Boolean ( wrapper ) }
7376 onSubmitState = { onSubmitState }
7477 />
7578 )
@@ -91,7 +94,7 @@ const PathTools: FunctionComponent<PathToolsProps> = ({
9194 disabled,
9295} ) => {
9396 return disabled ? (
94- < div > { children } </ div >
97+ < div className = { styles . pathToolsWrapper } > { children } </ div >
9598 ) : (
9699 < div className = { styles . pathToolsWrapper } >
97100 { children } { ' ' }
@@ -146,6 +149,7 @@ type NestedProps = {
146149 expandedPaths : string [ ]
147150 renderPaths : RenderPaths
148151 path : string
152+ hasWrapper : boolean
149153 isArray : boolean
150154 value : any
151155 onToggleExpand : ( path : string [ ] ) => void
@@ -162,6 +166,7 @@ const Nested: FunctionComponent<NestedProps> = memo(
162166 onClickPath,
163167 startBracket,
164168 renderPaths,
169+ hasWrapper,
165170 endBracket,
166171 isArray,
167172 selectedStatePath,
@@ -201,7 +206,7 @@ const Nested: FunctionComponent<NestedProps> = memo(
201206 < PathTools
202207 path = { path }
203208 onClickPath = { onClickPath }
204- disabled = { ! onSubmitState }
209+ disabled = { ! onSubmitState || hasWrapper }
205210 >
206211 { path . length ? (
207212 < span className = { styles . key } > { path . split ( '.' ) . pop ( ) } :</ span >
@@ -230,7 +235,7 @@ const Nested: FunctionComponent<NestedProps> = memo(
230235 < PathTools
231236 path = { path }
232237 onClickPath = { onClickPath }
233- disabled = { ! onSubmitState }
238+ disabled = { ! onSubmitState || hasWrapper }
234239 >
235240 { path . length ? (
236241 < span className = { styles . key } > { path . split ( '.' ) . pop ( ) } :</ span >
@@ -274,13 +279,21 @@ const Nested: FunctionComponent<NestedProps> = memo(
274279type ValueComponentProps = {
275280 value : string | number | boolean
276281 path : string
282+ hasWrapper : boolean
277283 onClickPath ?: ( path : string [ ] ) => void
278284 selectedStatePath : string
279285 onSubmitState : ( newState : string ) => void
280286}
281287
282288const ValueComponent : FunctionComponent < ValueComponentProps > = memo (
283- ( { value, path, onClickPath, selectedStatePath, onSubmitState } ) => {
289+ ( {
290+ value,
291+ path,
292+ onClickPath,
293+ selectedStatePath,
294+ onSubmitState,
295+ hasWrapper,
296+ } ) => {
284297 const [ isHoveringString , setHoveringString ] = useState ( false )
285298
286299 if ( selectedStatePath && path === selectedStatePath ) {
@@ -304,7 +317,7 @@ const ValueComponent: FunctionComponent<ValueComponentProps> = memo(
304317 < PathTools
305318 path = { path }
306319 onClickPath = { onClickPath }
307- disabled = { ! onSubmitState }
320+ disabled = { ! onSubmitState || hasWrapper }
308321 >
309322 { path . length ? (
310323 < span className = { styles . key } > { path . split ( '.' ) . pop ( ) } :</ span >
@@ -321,7 +334,7 @@ const ValueComponent: FunctionComponent<ValueComponentProps> = memo(
321334 < PathTools
322335 path = { path }
323336 onClickPath = { onClickPath }
324- disabled = { ! onSubmitState }
337+ disabled = { ! onSubmitState || hasWrapper }
325338 >
326339 { path . length ? (
327340 < span className = { styles . key } > { path . split ( '.' ) . pop ( ) } :</ span >
@@ -346,7 +359,7 @@ const ValueComponent: FunctionComponent<ValueComponentProps> = memo(
346359 < PathTools
347360 path = { path }
348361 onClickPath = { onClickPath }
349- disabled = { ! onSubmitState }
362+ disabled = { ! onSubmitState || hasWrapper }
350363 >
351364 { path . length ? (
352365 < span className = { styles . key } > { path . split ( '.' ) . pop ( ) } :</ span >
0 commit comments