mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-27 00:19:55 +03:00
Merge 045c1579cc
into 40b024a308
This commit is contained in:
commit
0edb54bc5f
|
@ -146,6 +146,7 @@ Their full signatures are:
|
||||||
- `isCustomNode: function(value)` - overrides the default object type detection and renders the value as a single value
|
- `isCustomNode: function(value)` - overrides the default object type detection and renders the value as a single value
|
||||||
- `collectionLimit: number` - sets the number of nodes that will be rendered in a collection before rendering them in collapsed ranges
|
- `collectionLimit: number` - sets the number of nodes that will be rendered in a collection before rendering them in collapsed ranges
|
||||||
- `keyPath: (string | number)[]` - overrides the initial key path for the root node (defaults to `[root]`)
|
- `keyPath: (string | number)[]` - overrides the initial key path for the root node (defaults to `[root]`)
|
||||||
|
- `onExpand: function(data, level, keyPath)` - on expand callback
|
||||||
|
|
||||||
### Credits
|
### Credits
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,7 @@ interface Props extends CircularPropsPassedThroughJSONNestedNode {
|
||||||
nodeTypeIndicator: string;
|
nodeTypeIndicator: string;
|
||||||
createItemString: (data: any, collectionLimit: number) => string;
|
createItemString: (data: any, collectionLimit: number) => string;
|
||||||
expandable: boolean;
|
expandable: boolean;
|
||||||
|
onExpand?: (data: any, level: number, keyPath: any[]) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
|
@ -130,6 +131,7 @@ export default class JSONNestedNode extends React.Component<Props, State> {
|
||||||
sortObjectKeys: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
|
sortObjectKeys: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
|
||||||
isCircular: PropTypes.bool,
|
isCircular: PropTypes.bool,
|
||||||
expandable: PropTypes.bool,
|
expandable: PropTypes.bool,
|
||||||
|
onExpand: PropTypes.func
|
||||||
};
|
};
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
|
@ -234,6 +236,14 @@ export default class JSONNestedNode extends React.Component<Props, State> {
|
||||||
|
|
||||||
handleClick = () => {
|
handleClick = () => {
|
||||||
if (this.props.expandable) {
|
if (this.props.expandable) {
|
||||||
|
if (this.props.onExpand && !this.state.expanded) {
|
||||||
|
const {
|
||||||
|
data,
|
||||||
|
level,
|
||||||
|
keyPath
|
||||||
|
} = this.props;
|
||||||
|
this.props.onExpand(data, level, keyPath);
|
||||||
|
}
|
||||||
this.setState({ expanded: !this.state.expanded });
|
this.setState({ expanded: !this.state.expanded });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -20,6 +20,7 @@ interface Props extends CircularPropsPassedThroughJSONTree {
|
||||||
data: any;
|
data: any;
|
||||||
theme?: Theme;
|
theme?: Theme;
|
||||||
invertTheme: boolean;
|
invertTheme: boolean;
|
||||||
|
onExpand?: (data: any, level: number, keyPath: any[]) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
|
|
|
@ -9,6 +9,7 @@ interface SharedCircularPropsPassedThroughJSONTree {
|
||||||
expanded: boolean,
|
expanded: boolean,
|
||||||
expandable: boolean
|
expandable: boolean
|
||||||
) => React.ReactNode;
|
) => React.ReactNode;
|
||||||
|
onExpand?: (data: any, level: number, keyPath: any[]) => void;
|
||||||
}
|
}
|
||||||
interface SharedCircularPropsProvidedByJSONTree
|
interface SharedCircularPropsProvidedByJSONTree
|
||||||
extends SharedCircularPropsPassedThroughJSONTree {
|
extends SharedCircularPropsPassedThroughJSONTree {
|
||||||
|
@ -43,6 +44,7 @@ interface JSONNestedNodeCircularPropsPassedThroughJSONTree {
|
||||||
isCustomNode: (value: any) => boolean;
|
isCustomNode: (value: any) => boolean;
|
||||||
collectionLimit: number;
|
collectionLimit: number;
|
||||||
sortObjectKeys?: ((a: any, b: any) => number) | boolean;
|
sortObjectKeys?: ((a: any, b: any) => number) | boolean;
|
||||||
|
onExpand?: (data: any, level: number, keyPath: any[]) => void;
|
||||||
}
|
}
|
||||||
export type CircularPropsPassedThroughJSONTree =
|
export type CircularPropsPassedThroughJSONTree =
|
||||||
SharedCircularPropsPassedThroughJSONTree &
|
SharedCircularPropsPassedThroughJSONTree &
|
||||||
|
|
Loading…
Reference in New Issue
Block a user