victory-chart 36.9.2-next.3 → 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 +5 -14
- package/README.md +2 -2
- package/dist/victory-chart.js +4844 -6775
- package/dist/victory-chart.min.js +1 -1
- package/es/helper-methods.d.ts +40 -40
- package/es/helper-methods.js +109 -113
- package/es/index.d.ts +1 -1
- package/es/victory-chart.d.ts +26 -26
- package/es/victory-chart.js +65 -81
- package/lib/helper-methods.d.ts +40 -40
- package/lib/helper-methods.js +109 -128
- package/lib/index.d.ts +1 -1
- package/lib/index.js +0 -2
- package/lib/victory-chart.d.ts +26 -26
- package/lib/victory-chart.js +65 -104
- package/package.json +9 -6
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",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"type": "git",
|
|
13
13
|
"url": "https://github.com/FormidableLabs/victory"
|
|
14
14
|
},
|
|
15
|
-
"homepage": "https://
|
|
15
|
+
"homepage": "https://commerce.nearform.com/open-source/victory",
|
|
16
16
|
"sideEffects": false,
|
|
17
17
|
"main": "lib/index.js",
|
|
18
18
|
"module": "es/index.js",
|
|
@@ -22,14 +22,17 @@
|
|
|
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"
|
|
32
32
|
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"provenance": true
|
|
35
|
+
},
|
|
33
36
|
"wireit": {
|
|
34
37
|
"### THESE WIREIT CONFIGS ARE GENERATED ####": {},
|
|
35
38
|
"### DO NOT MODIFY THESE MANUALLY ####": {},
|