mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-27 08:30:02 +03:00
stash
This commit is contained in:
parent
a559bd9d8f
commit
cedaa8f184
|
@ -1,2 +1,2 @@
|
||||||
export { default as tree } from './tree/tree';
|
export { default as tree } from './tree/tree';
|
||||||
export type { NodeWithId } from './tree/tree';
|
export type { InputOptions, NodeWithId } from './tree/tree';
|
||||||
|
|
|
@ -10,7 +10,7 @@ import {
|
||||||
} from './utils';
|
} from './utils';
|
||||||
import d3tooltip from 'd3tooltip';
|
import d3tooltip from 'd3tooltip';
|
||||||
|
|
||||||
interface InputOptions {
|
export interface InputOptions {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||||
state?: {} | null;
|
state?: {} | null;
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import * as charts from './charts';
|
import * as charts from './charts';
|
||||||
|
|
||||||
export { tree } from './charts';
|
export { tree } from './charts';
|
||||||
export type { NodeWithId } from './charts';
|
export type { InputOptions, NodeWithId } from './charts';
|
||||||
|
|
||||||
export default charts;
|
export default charts;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import React, { Component } from 'react';
|
import React, { Component, RefCallback } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import { connect, ResolveThunks } from 'react-redux';
|
import { connect, ResolveThunks } from 'react-redux';
|
||||||
import { withTheme } from 'styled-components';
|
import { withTheme } from 'styled-components';
|
||||||
import { tree } from 'd3-state-visualizer';
|
import { InputOptions, NodeWithId, tree } from 'd3-state-visualizer';
|
||||||
import { getPath } from '../ChartMonitorWrapper';
|
import { getPath } from '../ChartMonitorWrapper';
|
||||||
import { updateMonitorState } from '../../../actions';
|
import { updateMonitorState } from '../../../actions';
|
||||||
|
import { ThemeFromProvider } from 'devui';
|
||||||
|
|
||||||
const style = {
|
const style = {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
|
@ -12,9 +12,17 @@ const style = {
|
||||||
};
|
};
|
||||||
|
|
||||||
type DispatchProps = ResolveThunks<typeof actionCreators>;
|
type DispatchProps = ResolveThunks<typeof actionCreators>;
|
||||||
type Props = DispatchProps;
|
interface OwnProps {
|
||||||
|
data: unknown;
|
||||||
|
theme: ThemeFromProvider;
|
||||||
|
}
|
||||||
|
type Props = DispatchProps & OwnProps;
|
||||||
|
|
||||||
class ChartTab extends Component<Props> {
|
class ChartTab extends Component<Props> {
|
||||||
|
node?: HTMLDivElement | null;
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||||
|
renderChart?: (nextState?: {} | null | undefined) => void;
|
||||||
|
|
||||||
shouldComponentUpdate() {
|
shouldComponentUpdate() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -28,23 +36,25 @@ class ChartTab extends Component<Props> {
|
||||||
this.props.theme.scheme !== nextProps.theme.scheme ||
|
this.props.theme.scheme !== nextProps.theme.scheme ||
|
||||||
nextProps.theme.light !== this.props.theme.light
|
nextProps.theme.light !== this.props.theme.light
|
||||||
) {
|
) {
|
||||||
this.node.innerHTML = '';
|
this.node!.innerHTML = '';
|
||||||
this.createChart(nextProps);
|
this.createChart(nextProps);
|
||||||
} else if (nextProps.data !== this.props.data) {
|
} else if (nextProps.data !== this.props.data) {
|
||||||
this.renderChart(nextProps.data);
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||||
|
this.renderChart!(nextProps.data as {} | null | undefined);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getRef = (node) => {
|
getRef: RefCallback<HTMLDivElement> = (node) => {
|
||||||
this.node = node;
|
this.node = node;
|
||||||
};
|
};
|
||||||
|
|
||||||
createChart(props) {
|
createChart(props: Props) {
|
||||||
this.renderChart = tree(this.node, this.getChartTheme(props.theme));
|
this.renderChart = tree(this.node!, this.getChartTheme(props.theme));
|
||||||
this.renderChart(props.data);
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||||
|
this.renderChart(props.data as {} | null | undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
getChartTheme(theme) {
|
getChartTheme(theme: ThemeFromProvider): Partial<InputOptions> {
|
||||||
return {
|
return {
|
||||||
heightBetweenNodesCoeff: 1,
|
heightBetweenNodesCoeff: 1,
|
||||||
widthBetweenNodesCoeff: 1.3,
|
widthBetweenNodesCoeff: 1.3,
|
||||||
|
@ -81,8 +91,8 @@ class ChartTab extends Component<Props> {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
onClickText = (data) => {
|
onClickText = (data: NodeWithId) => {
|
||||||
const inspectedStatePath = [];
|
const inspectedStatePath: string[] = [];
|
||||||
getPath(data, inspectedStatePath);
|
getPath(data, inspectedStatePath);
|
||||||
this.props.updateMonitorState({
|
this.props.updateMonitorState({
|
||||||
inspectedStatePath,
|
inspectedStatePath,
|
||||||
|
@ -95,12 +105,6 @@ class ChartTab extends Component<Props> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ChartTab.propTypes = {
|
|
||||||
data: PropTypes.object,
|
|
||||||
updateMonitorState: PropTypes.func.isRequired,
|
|
||||||
theme: PropTypes.object.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
const actionCreators = {
|
const actionCreators = {
|
||||||
updateMonitorState,
|
updateMonitorState,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import { Delta, formatters } from 'jsondiffpatch';
|
import { Delta, formatters } from 'jsondiffpatch';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { effects } from 'devui';
|
import { effects } from 'devui';
|
||||||
|
|
Loading…
Reference in New Issue
Block a user