mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-25 02:53:53 +03:00
feat(react-json-tree): Add keyPath to getItemString (#694)
This commit is contained in:
parent
a46b43209d
commit
85b4b0fb04
|
@ -102,14 +102,14 @@ You can pass `getItemString` to customize the way arrays, objects, and iterable
|
||||||
By default, it'll be:
|
By default, it'll be:
|
||||||
|
|
||||||
```jsx
|
```jsx
|
||||||
<JSONTree getItemString={(type, data, itemType, itemString)
|
<JSONTree getItemString={(type, data, itemType, itemString, keyPath)
|
||||||
=> <span>{itemType} {itemString}</span>}
|
=> <span>{itemType} {itemString}</span>}
|
||||||
```
|
```
|
||||||
|
|
||||||
But if you pass the following:
|
But if you pass the following:
|
||||||
|
|
||||||
```jsx
|
```jsx
|
||||||
const getItemString = (type, data, itemType, itemString)
|
const getItemString = (type, data, itemType, itemString, keyPath)
|
||||||
=> (<span> // {type}</span>);
|
=> (<span> // {type}</span>);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -193,7 +193,8 @@ export default class JSONNestedNode extends React.Component<Props, State> {
|
||||||
nodeType,
|
nodeType,
|
||||||
data,
|
data,
|
||||||
itemType,
|
itemType,
|
||||||
createItemString(data, collectionLimit)
|
createItemString(data, collectionLimit),
|
||||||
|
keyPath
|
||||||
);
|
);
|
||||||
const stylingArgs = [keyPath, nodeType, expanded, expandable] as const;
|
const stylingArgs = [keyPath, nodeType, expanded, expandable] as const;
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,8 @@ interface JSONNestedNodeCircularPropsPassedThroughJSONTree {
|
||||||
nodeType: string,
|
nodeType: string,
|
||||||
data: any,
|
data: any,
|
||||||
itemType: React.ReactNode,
|
itemType: React.ReactNode,
|
||||||
itemString: string
|
itemString: string,
|
||||||
|
keyPath: (string | number)[]
|
||||||
) => React.ReactNode;
|
) => React.ReactNode;
|
||||||
postprocessValue: (value: any) => any;
|
postprocessValue: (value: any) => any;
|
||||||
isCustomNode: (value: any) => boolean;
|
isCustomNode: (value: any) => boolean;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user