victory-stack 36.4.0 → 36.5.1
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/dist/victory-stack.js +716 -601
- package/dist/victory-stack.min.js +1 -1
- package/es/helper-methods.js +2 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +2 -1
- package/es/victory-stack.js +2 -1
- package/lib/helper-methods.js +2 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -1
- package/lib/victory-stack.js +2 -1
- package/package.json +7 -7
- package/src/helper-methods.js +15 -16
- package/src/index.d.ts +1 -1
- package/src/victory-stack.js +21 -21
package/es/helper-methods.js
CHANGED
package/es/index.d.ts
CHANGED
package/es/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { default as VictoryStack } from "./victory-stack";
|
|
1
|
+
export { default as VictoryStack } from "./victory-stack";
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
package/es/victory-stack.js
CHANGED
|
@@ -152,4 +152,5 @@ VictoryStackMemo.displayName = "VictoryStack";
|
|
|
152
152
|
VictoryStackMemo.role = "stack";
|
|
153
153
|
VictoryStackMemo.expectedComponents = ["groupComponent", "containerComponent", "labelComponent"];
|
|
154
154
|
VictoryStackMemo.getChildren = getChildren;
|
|
155
|
-
export default VictoryStackMemo;
|
|
155
|
+
export default VictoryStackMemo;
|
|
156
|
+
//# sourceMappingURL=victory-stack.js.map
|
package/lib/helper-methods.js
CHANGED
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -12,4 +12,5 @@ Object.defineProperty(exports, "VictoryStack", {
|
|
|
12
12
|
|
|
13
13
|
var _victoryStack = _interopRequireDefault(require("./victory-stack"));
|
|
14
14
|
|
|
15
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
package/lib/victory-stack.js
CHANGED
|
@@ -181,4 +181,5 @@ VictoryStackMemo.role = "stack";
|
|
|
181
181
|
VictoryStackMemo.expectedComponents = ["groupComponent", "containerComponent", "labelComponent"];
|
|
182
182
|
VictoryStackMemo.getChildren = _helperMethods.getChildren;
|
|
183
183
|
var _default = VictoryStackMemo;
|
|
184
|
-
exports.default = _default;
|
|
184
|
+
exports.default = _default;
|
|
185
|
+
//# sourceMappingURL=victory-stack.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "victory-stack",
|
|
3
|
-
"version": "36.
|
|
3
|
+
"version": "36.5.1",
|
|
4
4
|
"description": "Stack Layout Component for Victory",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data visualization",
|
|
@@ -20,17 +20,17 @@
|
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"lodash": "^4.17.19",
|
|
23
|
-
"prop-types": "^15.
|
|
24
|
-
"react-fast-compare": "^2.0
|
|
25
|
-
"victory-core": "^36.
|
|
26
|
-
"victory-shared-events": "^36.
|
|
23
|
+
"prop-types": "^15.8.1",
|
|
24
|
+
"react-fast-compare": "^3.2.0",
|
|
25
|
+
"victory-core": "^36.5.1",
|
|
26
|
+
"victory-shared-events": "^36.5.1"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"react": "
|
|
29
|
+
"react": ">=16.6.0"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"version": "yarn run nps build-libs && nps build-dists"
|
|
33
33
|
},
|
|
34
34
|
"sideEffects": false,
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "fbe60407533cd7a6da4f8155d2ef8e189583c5a2"
|
|
36
36
|
}
|
package/src/helper-methods.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable func-style */
|
|
2
1
|
/* eslint-disable no-use-before-define */
|
|
3
2
|
import { assign, keys, orderBy } from "lodash";
|
|
4
3
|
import React from "react";
|
|
@@ -8,7 +7,7 @@ import isEqual from "react-fast-compare";
|
|
|
8
7
|
const fallbackProps = {
|
|
9
8
|
width: 450,
|
|
10
9
|
height: 300,
|
|
11
|
-
padding: 50
|
|
10
|
+
padding: 50,
|
|
12
11
|
};
|
|
13
12
|
|
|
14
13
|
// Assumes data in `datasets` is sorted by `Data.getData`.
|
|
@@ -66,9 +65,9 @@ function getY0(datum, index, datasets) {
|
|
|
66
65
|
.filter((previousDatum) =>
|
|
67
66
|
datum._x instanceof Date
|
|
68
67
|
? previousDatum._x.getTime() === datum._x.getTime()
|
|
69
|
-
: previousDatum._x === datum._x
|
|
68
|
+
: previousDatum._x === datum._x,
|
|
70
69
|
)
|
|
71
|
-
.map((previousDatum) => previousDatum._y || 0)
|
|
70
|
+
.map((previousDatum) => previousDatum._y || 0),
|
|
72
71
|
);
|
|
73
72
|
}, []);
|
|
74
73
|
|
|
@@ -105,7 +104,7 @@ function addLayoutData(props, datasets, index) {
|
|
|
105
104
|
? null
|
|
106
105
|
: datum._x instanceof Date
|
|
107
106
|
? new Date(+datum._x + +xOffset)
|
|
108
|
-
: datum._x + xOffset
|
|
107
|
+
: datum._x + xOffset,
|
|
109
108
|
});
|
|
110
109
|
});
|
|
111
110
|
}
|
|
@@ -114,7 +113,7 @@ function addLayoutData(props, datasets, index) {
|
|
|
114
113
|
function stackData(props, childComponents) {
|
|
115
114
|
const dataFromChildren = Wrapper.getDataFromChildren(props, childComponents);
|
|
116
115
|
const filterNullChildData = dataFromChildren.map((dataset) =>
|
|
117
|
-
dataset.filter((datum) => datum._x !== null && datum._y !== null)
|
|
116
|
+
dataset.filter((datum) => datum._x !== null && datum._y !== null),
|
|
118
117
|
);
|
|
119
118
|
const datasets = fillData(props, filterNullChildData);
|
|
120
119
|
return datasets.map((d, i) => addLayoutData(props, datasets, i));
|
|
@@ -133,19 +132,19 @@ export function getCalculatedProps(props, childComponents) {
|
|
|
133
132
|
});
|
|
134
133
|
const domain = {
|
|
135
134
|
x: Wrapper.getDomain(assign({}, props, { categories }), "x", children),
|
|
136
|
-
y: Wrapper.getDomain(assign({}, props, { categories }), "y", children)
|
|
135
|
+
y: Wrapper.getDomain(assign({}, props, { categories }), "y", children),
|
|
137
136
|
};
|
|
138
137
|
const range = props.range || {
|
|
139
138
|
x: Helpers.getRange(props, "x"),
|
|
140
|
-
y: Helpers.getRange(props, "y")
|
|
139
|
+
y: Helpers.getRange(props, "y"),
|
|
141
140
|
};
|
|
142
141
|
const baseScale = {
|
|
143
142
|
x: Scale.getScaleFromProps(props, "x") || Wrapper.getScale(props, "x"),
|
|
144
|
-
y: Scale.getScaleFromProps(props, "y") || Wrapper.getScale(props, "y")
|
|
143
|
+
y: Scale.getScaleFromProps(props, "y") || Wrapper.getScale(props, "y"),
|
|
145
144
|
};
|
|
146
145
|
const scale = {
|
|
147
146
|
x: baseScale.x.domain(domain.x).range(props.horizontal ? range.y : range.x),
|
|
148
|
-
y: baseScale.y.domain(domain.y).range(props.horizontal ? range.x : range.y)
|
|
147
|
+
y: baseScale.y.domain(domain.y).range(props.horizontal ? range.x : range.y),
|
|
149
148
|
};
|
|
150
149
|
const { colorScale, horizontal } = props;
|
|
151
150
|
return {
|
|
@@ -157,7 +156,7 @@ export function getCalculatedProps(props, childComponents) {
|
|
|
157
156
|
scale,
|
|
158
157
|
style,
|
|
159
158
|
colorScale,
|
|
160
|
-
role
|
|
159
|
+
role,
|
|
161
160
|
};
|
|
162
161
|
}
|
|
163
162
|
|
|
@@ -168,7 +167,7 @@ const withoutSharedEvents = (props) => {
|
|
|
168
167
|
const modifiedChildren = React.Children.toArray(children).map((child) => {
|
|
169
168
|
return {
|
|
170
169
|
...child,
|
|
171
|
-
props: Helpers.omit(child.props, ["sharedEvents"])
|
|
170
|
+
props: Helpers.omit(child.props, ["sharedEvents"]),
|
|
172
171
|
};
|
|
173
172
|
});
|
|
174
173
|
props.children = modifiedChildren;
|
|
@@ -211,7 +210,7 @@ export function getChildProps(props, calculatedProps) {
|
|
|
211
210
|
domain,
|
|
212
211
|
range,
|
|
213
212
|
scale,
|
|
214
|
-
horizontal
|
|
213
|
+
horizontal,
|
|
215
214
|
};
|
|
216
215
|
}
|
|
217
216
|
|
|
@@ -255,10 +254,10 @@ export function getChildren(props, childComponents, calculatedProps) {
|
|
|
255
254
|
style,
|
|
256
255
|
colorScale: getColorScale(props, child),
|
|
257
256
|
data,
|
|
258
|
-
polar: props.polar
|
|
257
|
+
polar: props.polar,
|
|
259
258
|
},
|
|
260
|
-
childProps
|
|
261
|
-
)
|
|
259
|
+
childProps,
|
|
260
|
+
),
|
|
262
261
|
);
|
|
263
262
|
});
|
|
264
263
|
}
|
package/src/index.d.ts
CHANGED
package/src/victory-stack.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
UserProps,
|
|
10
10
|
VictoryContainer,
|
|
11
11
|
VictoryTheme,
|
|
12
|
-
Wrapper
|
|
12
|
+
Wrapper,
|
|
13
13
|
} from "victory-core";
|
|
14
14
|
import { VictorySharedEvents } from "victory-shared-events";
|
|
15
15
|
import { getChildren, useMemoizedProps } from "./helper-methods";
|
|
@@ -18,7 +18,7 @@ import isEqual from "react-fast-compare";
|
|
|
18
18
|
const fallbackProps = {
|
|
19
19
|
width: 450,
|
|
20
20
|
height: 300,
|
|
21
|
-
padding: 50
|
|
21
|
+
padding: 50,
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
const VictoryStack = (initialProps) => {
|
|
@@ -41,7 +41,7 @@ const VictoryStack = (initialProps) => {
|
|
|
41
41
|
theme,
|
|
42
42
|
polar,
|
|
43
43
|
horizontal,
|
|
44
|
-
name
|
|
44
|
+
name,
|
|
45
45
|
} = modifiedProps;
|
|
46
46
|
|
|
47
47
|
const childComponents = React.Children.toArray(modifiedProps.children);
|
|
@@ -53,7 +53,7 @@ const VictoryStack = (initialProps) => {
|
|
|
53
53
|
const orderedChildren = children.map((child, index) => {
|
|
54
54
|
const childProps = assign(
|
|
55
55
|
{ animate: getAnimationProps(props, child, index, "victory-stack") },
|
|
56
|
-
child.props
|
|
56
|
+
child.props,
|
|
57
57
|
);
|
|
58
58
|
return React.cloneElement(child, childProps);
|
|
59
59
|
});
|
|
@@ -78,7 +78,7 @@ const VictoryStack = (initialProps) => {
|
|
|
78
78
|
horizontal,
|
|
79
79
|
polar,
|
|
80
80
|
origin,
|
|
81
|
-
name
|
|
81
|
+
name,
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
84
|
return {};
|
|
@@ -93,11 +93,11 @@ const VictoryStack = (initialProps) => {
|
|
|
93
93
|
horizontal,
|
|
94
94
|
polar,
|
|
95
95
|
origin,
|
|
96
|
-
name
|
|
96
|
+
name,
|
|
97
97
|
]);
|
|
98
98
|
const userProps = React.useMemo(
|
|
99
99
|
() => UserProps.getSafeUserProps(initialProps),
|
|
100
|
-
[initialProps]
|
|
100
|
+
[initialProps],
|
|
101
101
|
);
|
|
102
102
|
|
|
103
103
|
const container = React.useMemo(() => {
|
|
@@ -106,7 +106,7 @@ const VictoryStack = (initialProps) => {
|
|
|
106
106
|
{},
|
|
107
107
|
containerComponent.props,
|
|
108
108
|
containerProps,
|
|
109
|
-
userProps
|
|
109
|
+
userProps,
|
|
110
110
|
);
|
|
111
111
|
return React.cloneElement(containerComponent, defaultContainerProps);
|
|
112
112
|
}
|
|
@@ -116,7 +116,7 @@ const VictoryStack = (initialProps) => {
|
|
|
116
116
|
standalone,
|
|
117
117
|
containerComponent,
|
|
118
118
|
containerProps,
|
|
119
|
-
userProps
|
|
119
|
+
userProps,
|
|
120
120
|
]);
|
|
121
121
|
|
|
122
122
|
const events = React.useMemo(() => {
|
|
@@ -156,21 +156,21 @@ VictoryStack.propTypes = {
|
|
|
156
156
|
PropTypes.arrayOf(
|
|
157
157
|
PropTypes.oneOfType([
|
|
158
158
|
CustomPropTypes.nonNegative,
|
|
159
|
-
PropTypes.instanceOf(Date)
|
|
160
|
-
])
|
|
159
|
+
PropTypes.instanceOf(Date),
|
|
160
|
+
]),
|
|
161
161
|
),
|
|
162
|
-
CustomPropTypes.nonNegative
|
|
162
|
+
CustomPropTypes.nonNegative,
|
|
163
163
|
]),
|
|
164
164
|
categories: PropTypes.oneOfType([
|
|
165
165
|
PropTypes.arrayOf(PropTypes.string),
|
|
166
166
|
PropTypes.shape({
|
|
167
167
|
x: PropTypes.arrayOf(PropTypes.string),
|
|
168
|
-
y: PropTypes.arrayOf(PropTypes.string)
|
|
169
|
-
})
|
|
168
|
+
y: PropTypes.arrayOf(PropTypes.string),
|
|
169
|
+
}),
|
|
170
170
|
]),
|
|
171
171
|
children: PropTypes.oneOfType([
|
|
172
172
|
PropTypes.arrayOf(PropTypes.node),
|
|
173
|
-
PropTypes.node
|
|
173
|
+
PropTypes.node,
|
|
174
174
|
]),
|
|
175
175
|
colorScale: PropTypes.oneOfType([
|
|
176
176
|
PropTypes.arrayOf(PropTypes.string),
|
|
@@ -182,8 +182,8 @@ VictoryStack.propTypes = {
|
|
|
182
182
|
"cool",
|
|
183
183
|
"red",
|
|
184
184
|
"green",
|
|
185
|
-
"blue"
|
|
186
|
-
])
|
|
185
|
+
"blue",
|
|
186
|
+
]),
|
|
187
187
|
]),
|
|
188
188
|
fillInMissingData: PropTypes.bool,
|
|
189
189
|
horizontal: PropTypes.bool,
|
|
@@ -192,9 +192,9 @@ VictoryStack.propTypes = {
|
|
|
192
192
|
style: PropTypes.shape({
|
|
193
193
|
parent: PropTypes.object,
|
|
194
194
|
data: PropTypes.object,
|
|
195
|
-
labels: PropTypes.object
|
|
195
|
+
labels: PropTypes.object,
|
|
196
196
|
}),
|
|
197
|
-
xOffset: PropTypes.number
|
|
197
|
+
xOffset: PropTypes.number,
|
|
198
198
|
};
|
|
199
199
|
|
|
200
200
|
VictoryStack.defaultProps = {
|
|
@@ -202,7 +202,7 @@ VictoryStack.defaultProps = {
|
|
|
202
202
|
groupComponent: <g />,
|
|
203
203
|
standalone: true,
|
|
204
204
|
theme: VictoryTheme.grayscale,
|
|
205
|
-
fillInMissingData: true
|
|
205
|
+
fillInMissingData: true,
|
|
206
206
|
};
|
|
207
207
|
|
|
208
208
|
const VictoryStackMemo = React.memo(VictoryStack, isEqual);
|
|
@@ -213,7 +213,7 @@ VictoryStackMemo.role = "stack";
|
|
|
213
213
|
VictoryStackMemo.expectedComponents = [
|
|
214
214
|
"groupComponent",
|
|
215
215
|
"containerComponent",
|
|
216
|
-
"labelComponent"
|
|
216
|
+
"labelComponent",
|
|
217
217
|
];
|
|
218
218
|
|
|
219
219
|
VictoryStackMemo.getChildren = getChildren;
|