victory-chart 36.9.2 → 37.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/victory-chart.js +4772 -6328
- package/dist/victory-chart.min.js +1 -1
- package/es/helper-methods.js +109 -113
- package/es/victory-chart.js +65 -81
- package/lib/helper-methods.js +109 -128
- package/lib/index.js +0 -2
- package/lib/victory-chart.js +65 -104
- package/package.json +5 -5
package/lib/helper-methods.js
CHANGED
|
@@ -7,87 +7,81 @@ exports.getBackgroundWithProps = getBackgroundWithProps;
|
|
|
7
7
|
exports.getCalculatedProps = getCalculatedProps;
|
|
8
8
|
exports.getChildComponents = void 0;
|
|
9
9
|
exports.getChildren = getChildren;
|
|
10
|
-
|
|
11
10
|
var _defaults2 = _interopRequireDefault(require("lodash/defaults"));
|
|
12
|
-
|
|
13
11
|
var _react = _interopRequireDefault(require("react"));
|
|
14
|
-
|
|
15
12
|
var _victoryCore = require("victory-core");
|
|
16
|
-
|
|
17
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
-
|
|
19
14
|
/* eslint-disable no-use-before-define */
|
|
20
|
-
|
|
15
|
+
|
|
16
|
+
const fallbackProps = {
|
|
21
17
|
width: 450,
|
|
22
18
|
height: 300,
|
|
23
19
|
padding: 50
|
|
24
20
|
};
|
|
25
|
-
|
|
26
21
|
function getAxisProps(child, props, calculatedProps) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
const {
|
|
23
|
+
domain,
|
|
24
|
+
scale,
|
|
25
|
+
stringMap,
|
|
26
|
+
categories,
|
|
27
|
+
horizontal
|
|
28
|
+
} = calculatedProps;
|
|
32
29
|
return {
|
|
33
|
-
stringMap
|
|
34
|
-
horizontal
|
|
35
|
-
categories
|
|
30
|
+
stringMap,
|
|
31
|
+
horizontal,
|
|
32
|
+
categories,
|
|
36
33
|
startAngle: props.startAngle,
|
|
37
34
|
endAngle: props.endAngle,
|
|
38
35
|
innerRadius: props.innerRadius,
|
|
39
|
-
domain
|
|
40
|
-
scale
|
|
36
|
+
domain,
|
|
37
|
+
scale
|
|
41
38
|
};
|
|
42
39
|
}
|
|
43
|
-
|
|
44
40
|
function getBackgroundWithProps(props, calculatedProps) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
height
|
|
41
|
+
const backgroundElement = props.backgroundComponent;
|
|
42
|
+
const height = props.polar ? calculatedProps.range.y[1] : calculatedProps.range.y[0] - calculatedProps.range.y[1];
|
|
43
|
+
const width = calculatedProps.range.x[1] - calculatedProps.range.x[0];
|
|
44
|
+
const xScale = props.horizontal ? calculatedProps.scale.y.range()[0] : calculatedProps.scale.x.range()[0];
|
|
45
|
+
const yScale = props.horizontal ? calculatedProps.scale.x.range()[1] : calculatedProps.scale.y.range()[1];
|
|
46
|
+
const xCoordinate = props.polar ? calculatedProps.origin.x : xScale;
|
|
47
|
+
const yCoordinate = props.polar ? calculatedProps.origin.y : yScale;
|
|
48
|
+
const parentName = props.name || "chart";
|
|
49
|
+
const backgroundProps = {
|
|
50
|
+
height,
|
|
55
51
|
polar: props.polar,
|
|
56
52
|
scale: calculatedProps.scale,
|
|
57
53
|
style: props.style.background,
|
|
58
54
|
x: xCoordinate,
|
|
59
55
|
y: yCoordinate,
|
|
60
|
-
key:
|
|
61
|
-
width
|
|
56
|
+
key: `${parentName}-background`,
|
|
57
|
+
width
|
|
62
58
|
};
|
|
63
59
|
return /*#__PURE__*/_react.default.cloneElement(backgroundElement, (0, _defaults2.default)({}, backgroundElement.props, backgroundProps));
|
|
64
60
|
}
|
|
65
|
-
|
|
66
61
|
function getChildProps(child, props, calculatedProps) {
|
|
67
|
-
|
|
68
|
-
|
|
62
|
+
const axisChild = _victoryCore.Axis.findAxisComponents([child]);
|
|
69
63
|
if (axisChild.length > 0) {
|
|
70
64
|
return getAxisProps(axisChild[0], props, calculatedProps);
|
|
71
65
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
66
|
+
const {
|
|
67
|
+
categories,
|
|
68
|
+
domain,
|
|
69
|
+
range,
|
|
70
|
+
scale,
|
|
71
|
+
stringMap,
|
|
72
|
+
horizontal
|
|
73
|
+
} = calculatedProps;
|
|
79
74
|
return {
|
|
80
|
-
categories
|
|
81
|
-
domain
|
|
82
|
-
range
|
|
83
|
-
scale
|
|
84
|
-
stringMap
|
|
85
|
-
horizontal
|
|
75
|
+
categories,
|
|
76
|
+
domain,
|
|
77
|
+
range,
|
|
78
|
+
scale,
|
|
79
|
+
stringMap,
|
|
80
|
+
horizontal
|
|
86
81
|
};
|
|
87
82
|
}
|
|
88
|
-
|
|
89
83
|
function getStyles(props) {
|
|
90
|
-
|
|
84
|
+
const styleProps = props.style && props.style.parent;
|
|
91
85
|
return {
|
|
92
86
|
parent: (0, _defaults2.default)({}, styleProps, {
|
|
93
87
|
height: "100%",
|
|
@@ -96,135 +90,122 @@ function getStyles(props) {
|
|
|
96
90
|
})
|
|
97
91
|
};
|
|
98
92
|
}
|
|
99
|
-
|
|
100
93
|
function getCalculatedProps(initialProps, childComponents) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
var stringMap = createStringMap(props, childComponents, allStrings);
|
|
113
|
-
var domain = {
|
|
94
|
+
const style = getStyles(initialProps);
|
|
95
|
+
const props = _victoryCore.Helpers.modifyProps(initialProps, fallbackProps, "chart");
|
|
96
|
+
const {
|
|
97
|
+
horizontal,
|
|
98
|
+
polar
|
|
99
|
+
} = props;
|
|
100
|
+
const allStrings = _victoryCore.Wrapper.getStringsFromChildren(props, childComponents);
|
|
101
|
+
const categories = _victoryCore.Wrapper.getCategories(props, childComponents, allStrings);
|
|
102
|
+
const stringMap = createStringMap(props, childComponents, allStrings);
|
|
103
|
+
const domain = {
|
|
114
104
|
x: getDomain(Object.assign({}, props, {
|
|
115
|
-
categories
|
|
105
|
+
categories
|
|
116
106
|
}), "x", childComponents),
|
|
117
107
|
y: getDomain(Object.assign({}, props, {
|
|
118
|
-
categories
|
|
108
|
+
categories
|
|
119
109
|
}), "y", childComponents)
|
|
120
110
|
};
|
|
121
|
-
|
|
111
|
+
const range = {
|
|
122
112
|
x: _victoryCore.Helpers.getRange(props, "x"),
|
|
123
113
|
y: _victoryCore.Helpers.getRange(props, "y")
|
|
124
114
|
};
|
|
125
|
-
|
|
115
|
+
const baseScale = {
|
|
126
116
|
x: _victoryCore.Scale.getScaleFromProps(props, "x") || _victoryCore.Wrapper.getScale(props, "x"),
|
|
127
117
|
y: _victoryCore.Scale.getScaleFromProps(props, "y") || _victoryCore.Wrapper.getScale(props, "y")
|
|
128
118
|
};
|
|
129
|
-
|
|
119
|
+
const scale = {
|
|
130
120
|
x: baseScale.x.domain(domain.x).range(horizontal ? range.y : range.x),
|
|
131
121
|
y: baseScale.y.domain(domain.y).range(horizontal ? range.x : range.y)
|
|
132
122
|
};
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
var padding = _victoryCore.Helpers.getPadding(props);
|
|
136
|
-
|
|
123
|
+
const origin = polar ? _victoryCore.Helpers.getPolarOrigin(props) : _victoryCore.Axis.getOrigin(domain);
|
|
124
|
+
const padding = _victoryCore.Helpers.getPadding(props);
|
|
137
125
|
return {
|
|
138
|
-
categories
|
|
139
|
-
domain
|
|
140
|
-
range
|
|
141
|
-
horizontal
|
|
142
|
-
scale
|
|
143
|
-
stringMap
|
|
144
|
-
style
|
|
145
|
-
origin
|
|
146
|
-
padding
|
|
126
|
+
categories,
|
|
127
|
+
domain,
|
|
128
|
+
range,
|
|
129
|
+
horizontal,
|
|
130
|
+
scale,
|
|
131
|
+
stringMap,
|
|
132
|
+
style,
|
|
133
|
+
origin,
|
|
134
|
+
padding
|
|
147
135
|
};
|
|
148
136
|
}
|
|
149
|
-
|
|
150
137
|
function getChildren(props, childComponents, calculatedProps) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
138
|
+
const children = childComponents || getChildComponents(props);
|
|
139
|
+
const newCalculatedProps = calculatedProps || getCalculatedProps(props, children);
|
|
140
|
+
const baseStyle = newCalculatedProps.style.parent;
|
|
141
|
+
const {
|
|
142
|
+
height,
|
|
143
|
+
polar,
|
|
144
|
+
theme,
|
|
145
|
+
width
|
|
146
|
+
} = props;
|
|
147
|
+
const {
|
|
148
|
+
origin,
|
|
149
|
+
horizontal
|
|
150
|
+
} = newCalculatedProps;
|
|
151
|
+
const parentName = props.name || "chart";
|
|
152
|
+
return children.filter(_react.default.isValidElement).map((child, index) => {
|
|
153
|
+
const role = child.type && child.type.role;
|
|
154
|
+
const style = Array.isArray(child.props.style) ? child.props.style : (0, _defaults2.default)({}, child.props.style, {
|
|
164
155
|
parent: baseStyle
|
|
165
156
|
});
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
horizontal
|
|
170
|
-
height
|
|
171
|
-
polar
|
|
172
|
-
theme
|
|
173
|
-
width
|
|
174
|
-
style
|
|
175
|
-
name
|
|
157
|
+
const childProps = getChildProps(child, props, newCalculatedProps);
|
|
158
|
+
const name = child.props.name || `${parentName}-${role}-${index}`;
|
|
159
|
+
const newProps = (0, _defaults2.default)({
|
|
160
|
+
horizontal,
|
|
161
|
+
height,
|
|
162
|
+
polar,
|
|
163
|
+
theme,
|
|
164
|
+
width,
|
|
165
|
+
style,
|
|
166
|
+
name,
|
|
176
167
|
origin: polar ? origin : undefined,
|
|
177
168
|
padding: newCalculatedProps.padding,
|
|
178
|
-
key:
|
|
169
|
+
key: `${name}-key-${index}`,
|
|
179
170
|
standalone: false
|
|
180
171
|
}, childProps);
|
|
181
172
|
return /*#__PURE__*/_react.default.cloneElement(child, newProps);
|
|
182
173
|
});
|
|
183
174
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
var childComponents = _react.default.Children.toArray(props.children);
|
|
187
|
-
|
|
175
|
+
const getChildComponents = (props, defaultAxes) => {
|
|
176
|
+
let childComponents = _react.default.Children.toArray(props.children);
|
|
188
177
|
if (childComponents.length === 0) {
|
|
189
178
|
childComponents.push(defaultAxes.independent, defaultAxes.dependent);
|
|
190
179
|
} else {
|
|
191
|
-
|
|
180
|
+
const axisComponents = {
|
|
192
181
|
dependent: _victoryCore.Axis.getAxisComponentsWithParent(childComponents, "dependent"),
|
|
193
182
|
independent: _victoryCore.Axis.getAxisComponentsWithParent(childComponents, "independent")
|
|
194
183
|
};
|
|
195
|
-
|
|
196
184
|
if (axisComponents.dependent.length === 0 && axisComponents.independent.length === 0) {
|
|
197
185
|
childComponents = props.prependDefaultAxes ? [defaultAxes.independent, defaultAxes.dependent].concat(childComponents) : childComponents.concat([defaultAxes.independent, defaultAxes.dependent]);
|
|
198
186
|
}
|
|
199
187
|
}
|
|
200
|
-
|
|
201
188
|
return childComponents;
|
|
202
189
|
};
|
|
203
|
-
|
|
204
190
|
exports.getChildComponents = getChildComponents;
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
var axisComponent = _victoryCore.Axis.getAxisComponent(children, axis);
|
|
212
|
-
|
|
213
|
-
var invertDomain = axisComponent && axisComponent.props && axisComponent.props.invertAxis;
|
|
191
|
+
const getDomain = (props, axis, childComponents) => {
|
|
192
|
+
const children = childComponents || _react.default.Children.toArray(props.children);
|
|
193
|
+
const domain = _victoryCore.Wrapper.getDomain(props, axis, children);
|
|
194
|
+
const axisComponent = _victoryCore.Axis.getAxisComponent(children, axis);
|
|
195
|
+
const invertDomain = axisComponent && axisComponent.props && axisComponent.props.invertAxis;
|
|
214
196
|
return invertDomain ? domain.concat().reverse() : domain;
|
|
215
197
|
};
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
var x = !allStrings.x || allStrings.x.length === 0 ? null : allStrings.x.reduce(function (memo, string, index) {
|
|
198
|
+
const createStringMap = (props, childComponents, allStrings) => {
|
|
199
|
+
const x = !allStrings.x || allStrings.x.length === 0 ? null : allStrings.x.reduce((memo, string, index) => {
|
|
219
200
|
memo[string] = index + 1;
|
|
220
201
|
return memo;
|
|
221
202
|
}, {});
|
|
222
|
-
|
|
203
|
+
const y = !allStrings.y || allStrings.y.length === 0 ? null : allStrings.y.reduce((memo, string, index) => {
|
|
223
204
|
memo[string] = index + 1;
|
|
224
205
|
return memo;
|
|
225
206
|
}, {});
|
|
226
207
|
return {
|
|
227
|
-
x
|
|
228
|
-
y
|
|
208
|
+
x,
|
|
209
|
+
y
|
|
229
210
|
};
|
|
230
211
|
};
|
package/lib/index.js
CHANGED
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
6
|
var _victoryChart = require("./victory-chart");
|
|
8
|
-
|
|
9
7
|
Object.keys(_victoryChart).forEach(function (key) {
|
|
10
8
|
if (key === "default" || key === "__esModule") return;
|
|
11
9
|
if (key in exports && exports[key] === _victoryChart[key]) return;
|
package/lib/victory-chart.js
CHANGED
|
@@ -4,39 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.VictoryChart = void 0;
|
|
7
|
-
|
|
8
7
|
var _isEmpty2 = _interopRequireDefault(require("lodash/isEmpty"));
|
|
9
|
-
|
|
10
8
|
var _defaults2 = _interopRequireDefault(require("lodash/defaults"));
|
|
11
|
-
|
|
12
9
|
var _react = _interopRequireDefault(require("react"));
|
|
13
|
-
|
|
14
10
|
var _victoryCore = require("victory-core");
|
|
15
|
-
|
|
16
11
|
var _victorySharedEvents = require("victory-shared-events");
|
|
17
|
-
|
|
18
12
|
var _victoryAxis = require("victory-axis");
|
|
19
|
-
|
|
20
13
|
var _victoryPolarAxis = require("victory-polar-axis");
|
|
21
|
-
|
|
22
14
|
var _helperMethods = require("./helper-methods");
|
|
23
|
-
|
|
24
15
|
var _reactFastCompare = _interopRequireDefault(require("react-fast-compare"));
|
|
25
|
-
|
|
26
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
-
|
|
28
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
29
|
-
|
|
30
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
31
|
-
|
|
32
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
33
|
-
|
|
34
|
-
var fallbackProps = {
|
|
17
|
+
const fallbackProps = {
|
|
35
18
|
width: 450,
|
|
36
19
|
height: 300,
|
|
37
20
|
padding: 50
|
|
38
21
|
};
|
|
39
|
-
|
|
22
|
+
const defaultProps = {
|
|
40
23
|
backgroundComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.Background, null),
|
|
41
24
|
containerComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryContainer, null),
|
|
42
25
|
defaultAxes: {
|
|
@@ -55,114 +38,96 @@ var defaultProps = {
|
|
|
55
38
|
standalone: true,
|
|
56
39
|
theme: _victoryCore.VictoryTheme.grayscale
|
|
57
40
|
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}, [initialProps]);
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
style = calculatedProps.style,
|
|
100
|
-
origin = calculatedProps.origin,
|
|
101
|
-
horizontal = calculatedProps.horizontal;
|
|
102
|
-
|
|
103
|
-
var newChildren = _react.default.useMemo(function () {
|
|
104
|
-
var children = (0, _helperMethods.getChildren)(props, childComponents, calculatedProps);
|
|
105
|
-
var mappedChildren = children.map(function (child, index) {
|
|
106
|
-
var childProps = Object.assign({
|
|
41
|
+
const VictoryChartImpl = initialProps => {
|
|
42
|
+
const propsWithDefaults = _react.default.useMemo(() => ({
|
|
43
|
+
...defaultProps,
|
|
44
|
+
...initialProps
|
|
45
|
+
}), [initialProps]);
|
|
46
|
+
const role = "chart";
|
|
47
|
+
const {
|
|
48
|
+
getAnimationProps,
|
|
49
|
+
setAnimationState,
|
|
50
|
+
getProps
|
|
51
|
+
} = _victoryCore.Hooks.useAnimationState();
|
|
52
|
+
const props = getProps(propsWithDefaults);
|
|
53
|
+
const modifiedProps = _victoryCore.Helpers.modifyProps(props, fallbackProps, role);
|
|
54
|
+
const {
|
|
55
|
+
desc,
|
|
56
|
+
eventKey,
|
|
57
|
+
containerComponent,
|
|
58
|
+
standalone,
|
|
59
|
+
groupComponent,
|
|
60
|
+
externalEventMutations,
|
|
61
|
+
width,
|
|
62
|
+
height,
|
|
63
|
+
theme,
|
|
64
|
+
polar,
|
|
65
|
+
name,
|
|
66
|
+
title
|
|
67
|
+
} = modifiedProps;
|
|
68
|
+
const axes = props.polar ? modifiedProps.defaultPolarAxes : modifiedProps.defaultAxes;
|
|
69
|
+
const childComponents = _react.default.useMemo(() => (0, _helperMethods.getChildComponents)(modifiedProps, axes), [modifiedProps, axes]);
|
|
70
|
+
const calculatedProps = _react.default.useMemo(() => (0, _helperMethods.getCalculatedProps)(modifiedProps, childComponents), [modifiedProps, childComponents]);
|
|
71
|
+
const {
|
|
72
|
+
domain,
|
|
73
|
+
scale,
|
|
74
|
+
style,
|
|
75
|
+
origin,
|
|
76
|
+
horizontal
|
|
77
|
+
} = calculatedProps;
|
|
78
|
+
const newChildren = _react.default.useMemo(() => {
|
|
79
|
+
const children = (0, _helperMethods.getChildren)(props, childComponents, calculatedProps);
|
|
80
|
+
const mappedChildren = children.map((child, index) => {
|
|
81
|
+
const childProps = Object.assign({
|
|
107
82
|
animate: getAnimationProps(props, child, index)
|
|
108
83
|
}, child.props);
|
|
109
84
|
return /*#__PURE__*/_react.default.cloneElement(child, childProps);
|
|
110
85
|
});
|
|
111
|
-
|
|
112
86
|
if (props.style && props.style.background) {
|
|
113
|
-
|
|
87
|
+
const backgroundComponent = (0, _helperMethods.getBackgroundWithProps)(props, calculatedProps);
|
|
114
88
|
mappedChildren.unshift(backgroundComponent);
|
|
115
89
|
}
|
|
116
|
-
|
|
117
90
|
return mappedChildren;
|
|
118
91
|
}, [getAnimationProps, childComponents, props, calculatedProps]);
|
|
119
|
-
|
|
120
|
-
var containerProps = _react.default.useMemo(function () {
|
|
92
|
+
const containerProps = _react.default.useMemo(() => {
|
|
121
93
|
if (standalone) {
|
|
122
94
|
return {
|
|
123
|
-
desc
|
|
124
|
-
domain
|
|
125
|
-
width
|
|
126
|
-
height
|
|
127
|
-
horizontal
|
|
128
|
-
name
|
|
95
|
+
desc,
|
|
96
|
+
domain,
|
|
97
|
+
width,
|
|
98
|
+
height,
|
|
99
|
+
horizontal,
|
|
100
|
+
name,
|
|
129
101
|
origin: polar ? origin : undefined,
|
|
130
|
-
polar
|
|
131
|
-
theme
|
|
132
|
-
title
|
|
133
|
-
scale
|
|
134
|
-
standalone
|
|
102
|
+
polar,
|
|
103
|
+
theme,
|
|
104
|
+
title,
|
|
105
|
+
scale,
|
|
106
|
+
standalone,
|
|
135
107
|
style: style.parent
|
|
136
108
|
};
|
|
137
109
|
}
|
|
138
|
-
|
|
139
110
|
return {};
|
|
140
111
|
}, [desc, domain, height, horizontal, name, origin, polar, scale, standalone, style, title, theme, width]);
|
|
141
|
-
|
|
142
|
-
var container = _react.default.useMemo(function () {
|
|
112
|
+
const container = _react.default.useMemo(() => {
|
|
143
113
|
if (standalone) {
|
|
144
|
-
|
|
114
|
+
const defaultContainerProps = (0, _defaults2.default)({}, containerComponent.props, containerProps, _victoryCore.UserProps.getSafeUserProps(propsWithDefaults));
|
|
145
115
|
return /*#__PURE__*/_react.default.cloneElement(containerComponent, defaultContainerProps);
|
|
146
116
|
}
|
|
147
|
-
|
|
148
117
|
return groupComponent;
|
|
149
118
|
}, [groupComponent, standalone, containerComponent, containerProps, propsWithDefaults]);
|
|
150
|
-
|
|
151
|
-
var events = _react.default.useMemo(function () {
|
|
119
|
+
const events = _react.default.useMemo(() => {
|
|
152
120
|
return _victoryCore.Wrapper.getAllEvents(props);
|
|
153
121
|
}, [props]);
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
_react.default.useEffect(function () {
|
|
122
|
+
const previousProps = _victoryCore.Hooks.usePreviousProps(propsWithDefaults);
|
|
123
|
+
_react.default.useEffect(() => {
|
|
158
124
|
// This is called before dismount to keep state in sync
|
|
159
|
-
return
|
|
125
|
+
return () => {
|
|
160
126
|
if (propsWithDefaults.animate) {
|
|
161
127
|
setAnimationState(previousProps, propsWithDefaults);
|
|
162
128
|
}
|
|
163
129
|
};
|
|
164
130
|
}, [setAnimationState, previousProps, propsWithDefaults]);
|
|
165
|
-
|
|
166
131
|
if (!(0, _isEmpty2.default)(events)) {
|
|
167
132
|
return /*#__PURE__*/_react.default.createElement(_victorySharedEvents.VictorySharedEvents, {
|
|
168
133
|
container: container,
|
|
@@ -171,13 +136,9 @@ var VictoryChartImpl = function (initialProps) {
|
|
|
171
136
|
externalEventMutations: externalEventMutations
|
|
172
137
|
}, newChildren);
|
|
173
138
|
}
|
|
174
|
-
|
|
175
139
|
return /*#__PURE__*/_react.default.cloneElement(container, container.props, newChildren);
|
|
176
140
|
};
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
exports.VictoryChart = VictoryChart;
|
|
181
|
-
VictoryChart.displayName = "VictoryChart"; // @ts-expect-error FIXME: Does this "expectedComponents" do anything?
|
|
182
|
-
|
|
141
|
+
const VictoryChart = exports.VictoryChart = /*#__PURE__*/_react.default.memo(VictoryChartImpl, _reactFastCompare.default);
|
|
142
|
+
VictoryChart.displayName = "VictoryChart";
|
|
143
|
+
// @ts-expect-error FIXME: Does this "expectedComponents" do anything?
|
|
183
144
|
VictoryChart.expectedComponents = ["groupComponent", "containerComponent"];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "victory-chart",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "37.0.0",
|
|
4
4
|
"description": "Chart Component for Victory",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data visualization",
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"lodash": "^4.17.19",
|
|
24
24
|
"react-fast-compare": "^3.2.0",
|
|
25
|
-
"victory-axis": "^
|
|
26
|
-
"victory-core": "^
|
|
27
|
-
"victory-polar-axis": "^
|
|
28
|
-
"victory-shared-events": "^
|
|
25
|
+
"victory-axis": "^37.0.0",
|
|
26
|
+
"victory-core": "^37.0.0",
|
|
27
|
+
"victory-polar-axis": "^37.0.0",
|
|
28
|
+
"victory-shared-events": "^37.0.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"react": ">=16.6.0"
|