mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-26 16:09:50 +03:00
Add onExpand callback
This commit is contained in:
parent
c980eadec7
commit
779abfb2fa
|
@ -95,6 +95,7 @@ interface Props extends CircularPropsPassedThroughJSONNestedNode {
|
|||
nodeTypeIndicator: string;
|
||||
createItemString: (data: any, collectionLimit: number) => string;
|
||||
expandable: boolean;
|
||||
onExpand?: () => void;
|
||||
}
|
||||
|
||||
interface State {
|
||||
|
@ -131,6 +132,7 @@ export default class JSONNestedNode extends React.Component<Props, State> {
|
|||
sortObjectKeys: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
|
||||
isCircular: PropTypes.bool,
|
||||
expandable: PropTypes.bool,
|
||||
onExpand: PropTypes.func
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
|
@ -234,6 +236,9 @@ export default class JSONNestedNode extends React.Component<Props, State> {
|
|||
|
||||
handleClick = () => {
|
||||
if (this.props.expandable) {
|
||||
if (this.props.onExpand && this.state.expanded) {
|
||||
this.props.onExpand();
|
||||
}
|
||||
this.setState({ expanded: !this.state.expanded });
|
||||
}
|
||||
};
|
||||
|
|
|
@ -20,6 +20,7 @@ interface Props extends CircularPropsPassedThroughJSONTree {
|
|||
data: any;
|
||||
theme?: Theme;
|
||||
invertTheme: boolean;
|
||||
onExpand?: () => void;
|
||||
}
|
||||
|
||||
interface State {
|
||||
|
|
Loading…
Reference in New Issue
Block a user