victory-stack 37.3.1 → 37.3.3
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 +10 -0
- package/dist/victory-stack.js +296 -270
- package/dist/victory-stack.min.js +1 -1
- package/es/helper-methods.d.ts +2 -6
- package/es/helper-methods.js +3 -4
- package/es/victory-stack.d.ts +1 -1
- package/es/victory-stack.js +5 -5
- package/lib/helper-methods.d.ts +2 -6
- package/lib/helper-methods.js +3 -5
- package/lib/victory-stack.d.ts +1 -1
- package/lib/victory-stack.js +5 -5
- package/package.json +7 -39
- package/src/helper-methods.tsx +8 -9
- package/src/victory-stack.tsx +3 -3
package/es/helper-methods.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Helpers } from "victory-core";
|
|
1
2
|
export declare function getCalculatedProps(initialProps: any, childComponents: any): {
|
|
2
3
|
datasets: any;
|
|
3
4
|
categories: any;
|
|
@@ -35,12 +36,7 @@ export declare function useMemoizedProps(initialProps: any): {
|
|
|
35
36
|
export declare function getChildProps(props: any, calculatedProps: any): {
|
|
36
37
|
height: any;
|
|
37
38
|
width: any;
|
|
38
|
-
padding:
|
|
39
|
-
top: any;
|
|
40
|
-
bottom: any;
|
|
41
|
-
left: any;
|
|
42
|
-
right: any;
|
|
43
|
-
};
|
|
39
|
+
padding: Helpers.ElementPadding;
|
|
44
40
|
standalone: boolean;
|
|
45
41
|
theme: any;
|
|
46
42
|
categories: any;
|
package/es/helper-methods.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
/* eslint-disable no-use-before-define */
|
|
1
|
+
import orderBy from "lodash/orderBy";
|
|
3
2
|
import React from "react";
|
|
4
3
|
import { Helpers, Scale, Wrapper } from "victory-core";
|
|
5
4
|
import isEqual from "react-fast-compare";
|
|
@@ -21,7 +20,7 @@ function fillData(props, datasets) {
|
|
|
21
20
|
return prev;
|
|
22
21
|
}, {});
|
|
23
22
|
const xKeys = Object.keys(xMap).map(k => Number(k));
|
|
24
|
-
const xArr =
|
|
23
|
+
const xArr = orderBy(xKeys);
|
|
25
24
|
return datasets.map(dataset => {
|
|
26
25
|
let indexOffset = 0;
|
|
27
26
|
const isDate = dataset[0] && dataset[0]._x instanceof Date;
|
|
@@ -190,7 +189,7 @@ export function getChildProps(props, calculatedProps) {
|
|
|
190
189
|
return {
|
|
191
190
|
height: props.height,
|
|
192
191
|
width: props.width,
|
|
193
|
-
padding: Helpers.getPadding(props),
|
|
192
|
+
padding: Helpers.getPadding(props.padding),
|
|
194
193
|
standalone: false,
|
|
195
194
|
theme: props.theme,
|
|
196
195
|
categories,
|
package/es/victory-stack.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { CategoryPropType, DomainPropType, EventPropTypeInterface, StringOrNumberOrCallback, VictoryCommonProps, VictoryMultiLabelableProps, VictoryStyleInterface, VictoryComponentConfiguration } from "victory-core";
|
|
3
|
-
export
|
|
3
|
+
export type VictoryStackTTargetType = "data" | "labels" | "parent";
|
|
4
4
|
export interface VictoryStackProps extends VictoryCommonProps, VictoryMultiLabelableProps {
|
|
5
5
|
bins?: number | number[] | Date[];
|
|
6
6
|
categories?: CategoryPropType;
|
package/es/victory-stack.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import _isEmpty from "lodash/isEmpty";
|
|
2
|
-
import _defaults from "lodash/defaults";
|
|
3
1
|
import React from "react";
|
|
2
|
+
import defaults from "lodash/defaults";
|
|
3
|
+
import isEmpty from "lodash/isEmpty";
|
|
4
4
|
import { Helpers, Hooks, UserProps, VictoryContainer, VictoryTheme, Wrapper } from "victory-core";
|
|
5
5
|
import { VictorySharedEvents } from "victory-shared-events";
|
|
6
6
|
import { getChildren, useMemoizedProps } from "./helper-methods";
|
|
@@ -21,7 +21,7 @@ const VictoryStackBase = initialProps => {
|
|
|
21
21
|
const {
|
|
22
22
|
role
|
|
23
23
|
} = VictoryStack;
|
|
24
|
-
const propsWithDefaults = React.useMemo(() =>
|
|
24
|
+
const propsWithDefaults = React.useMemo(() => defaults({}, initialProps, defaultProps), [initialProps]);
|
|
25
25
|
const {
|
|
26
26
|
setAnimationState,
|
|
27
27
|
getAnimationProps,
|
|
@@ -84,7 +84,7 @@ const VictoryStackBase = initialProps => {
|
|
|
84
84
|
const userProps = React.useMemo(() => UserProps.getSafeUserProps(propsWithDefaults), [propsWithDefaults]);
|
|
85
85
|
const container = React.useMemo(() => {
|
|
86
86
|
if (standalone) {
|
|
87
|
-
const defaultContainerProps =
|
|
87
|
+
const defaultContainerProps = defaults({}, containerComponent.props, containerProps, userProps);
|
|
88
88
|
return /*#__PURE__*/React.cloneElement(containerComponent, defaultContainerProps);
|
|
89
89
|
}
|
|
90
90
|
return /*#__PURE__*/React.cloneElement(groupComponent, userProps);
|
|
@@ -101,7 +101,7 @@ const VictoryStackBase = initialProps => {
|
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
103
|
}, [setAnimationState, previousProps, propsWithDefaults]);
|
|
104
|
-
if (!
|
|
104
|
+
if (!isEmpty(events)) {
|
|
105
105
|
return /*#__PURE__*/React.createElement(VictorySharedEvents, {
|
|
106
106
|
container: container,
|
|
107
107
|
eventKey: eventKey,
|
package/lib/helper-methods.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Helpers } from "victory-core";
|
|
1
2
|
export declare function getCalculatedProps(initialProps: any, childComponents: any): {
|
|
2
3
|
datasets: any;
|
|
3
4
|
categories: any;
|
|
@@ -35,12 +36,7 @@ export declare function useMemoizedProps(initialProps: any): {
|
|
|
35
36
|
export declare function getChildProps(props: any, calculatedProps: any): {
|
|
36
37
|
height: any;
|
|
37
38
|
width: any;
|
|
38
|
-
padding:
|
|
39
|
-
top: any;
|
|
40
|
-
bottom: any;
|
|
41
|
-
left: any;
|
|
42
|
-
right: any;
|
|
43
|
-
};
|
|
39
|
+
padding: Helpers.ElementPadding;
|
|
44
40
|
standalone: boolean;
|
|
45
41
|
theme: any;
|
|
46
42
|
categories: any;
|
package/lib/helper-methods.js
CHANGED
|
@@ -7,13 +7,11 @@ exports.getCalculatedProps = getCalculatedProps;
|
|
|
7
7
|
exports.getChildProps = getChildProps;
|
|
8
8
|
exports.getChildren = getChildren;
|
|
9
9
|
exports.useMemoizedProps = useMemoizedProps;
|
|
10
|
-
var
|
|
10
|
+
var _orderBy = _interopRequireDefault(require("lodash/orderBy"));
|
|
11
11
|
var _react = _interopRequireDefault(require("react"));
|
|
12
12
|
var _victoryCore = require("victory-core");
|
|
13
13
|
var _reactFastCompare = _interopRequireDefault(require("react-fast-compare"));
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
/* eslint-disable no-use-before-define */
|
|
16
|
-
|
|
17
15
|
const fallbackProps = {
|
|
18
16
|
width: 450,
|
|
19
17
|
height: 300,
|
|
@@ -32,7 +30,7 @@ function fillData(props, datasets) {
|
|
|
32
30
|
return prev;
|
|
33
31
|
}, {});
|
|
34
32
|
const xKeys = Object.keys(xMap).map(k => Number(k));
|
|
35
|
-
const xArr = (0,
|
|
33
|
+
const xArr = (0, _orderBy.default)(xKeys);
|
|
36
34
|
return datasets.map(dataset => {
|
|
37
35
|
let indexOffset = 0;
|
|
38
36
|
const isDate = dataset[0] && dataset[0]._x instanceof Date;
|
|
@@ -201,7 +199,7 @@ function getChildProps(props, calculatedProps) {
|
|
|
201
199
|
return {
|
|
202
200
|
height: props.height,
|
|
203
201
|
width: props.width,
|
|
204
|
-
padding: _victoryCore.Helpers.getPadding(props),
|
|
202
|
+
padding: _victoryCore.Helpers.getPadding(props.padding),
|
|
205
203
|
standalone: false,
|
|
206
204
|
theme: props.theme,
|
|
207
205
|
categories,
|
package/lib/victory-stack.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { CategoryPropType, DomainPropType, EventPropTypeInterface, StringOrNumberOrCallback, VictoryCommonProps, VictoryMultiLabelableProps, VictoryStyleInterface, VictoryComponentConfiguration } from "victory-core";
|
|
3
|
-
export
|
|
3
|
+
export type VictoryStackTTargetType = "data" | "labels" | "parent";
|
|
4
4
|
export interface VictoryStackProps extends VictoryCommonProps, VictoryMultiLabelableProps {
|
|
5
5
|
bins?: number | number[] | Date[];
|
|
6
6
|
categories?: CategoryPropType;
|
package/lib/victory-stack.js
CHANGED
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.VictoryStack = void 0;
|
|
7
|
-
var _isEmpty2 = _interopRequireDefault(require("lodash/isEmpty"));
|
|
8
|
-
var _defaults2 = _interopRequireDefault(require("lodash/defaults"));
|
|
9
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _defaults = _interopRequireDefault(require("lodash/defaults"));
|
|
9
|
+
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
10
10
|
var _victoryCore = require("victory-core");
|
|
11
11
|
var _victorySharedEvents = require("victory-shared-events");
|
|
12
12
|
var _helperMethods = require("./helper-methods");
|
|
@@ -28,7 +28,7 @@ const VictoryStackBase = initialProps => {
|
|
|
28
28
|
const {
|
|
29
29
|
role
|
|
30
30
|
} = VictoryStack;
|
|
31
|
-
const propsWithDefaults = _react.default.useMemo(() => (0,
|
|
31
|
+
const propsWithDefaults = _react.default.useMemo(() => (0, _defaults.default)({}, initialProps, defaultProps), [initialProps]);
|
|
32
32
|
const {
|
|
33
33
|
setAnimationState,
|
|
34
34
|
getAnimationProps,
|
|
@@ -91,7 +91,7 @@ const VictoryStackBase = initialProps => {
|
|
|
91
91
|
const userProps = _react.default.useMemo(() => _victoryCore.UserProps.getSafeUserProps(propsWithDefaults), [propsWithDefaults]);
|
|
92
92
|
const container = _react.default.useMemo(() => {
|
|
93
93
|
if (standalone) {
|
|
94
|
-
const defaultContainerProps = (0,
|
|
94
|
+
const defaultContainerProps = (0, _defaults.default)({}, containerComponent.props, containerProps, userProps);
|
|
95
95
|
return /*#__PURE__*/_react.default.cloneElement(containerComponent, defaultContainerProps);
|
|
96
96
|
}
|
|
97
97
|
return /*#__PURE__*/_react.default.cloneElement(groupComponent, userProps);
|
|
@@ -108,7 +108,7 @@ const VictoryStackBase = initialProps => {
|
|
|
108
108
|
}
|
|
109
109
|
};
|
|
110
110
|
}, [setAnimationState, previousProps, propsWithDefaults]);
|
|
111
|
-
if (!(0,
|
|
111
|
+
if (!(0, _isEmpty.default)(events)) {
|
|
112
112
|
return /*#__PURE__*/_react.default.createElement(_victorySharedEvents.VictorySharedEvents, {
|
|
113
113
|
container: container,
|
|
114
114
|
eventKey: eventKey,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "victory-stack",
|
|
3
|
-
"version": "37.3.
|
|
3
|
+
"version": "37.3.3",
|
|
4
4
|
"description": "Stack Layout Component for Victory",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data visualization",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"lodash": "^4.17.19",
|
|
24
24
|
"react-fast-compare": "^3.2.0",
|
|
25
|
-
"victory-core": "37.3.
|
|
26
|
-
"victory-shared-events": "37.3.
|
|
25
|
+
"victory-core": "37.3.3",
|
|
26
|
+
"victory-shared-events": "37.3.3"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"react": ">=16.6.0"
|
|
@@ -196,38 +196,10 @@
|
|
|
196
196
|
"pnpm-lock.yaml"
|
|
197
197
|
]
|
|
198
198
|
},
|
|
199
|
-
"format": {
|
|
200
|
-
"command": "nps format:pkg",
|
|
201
|
-
"files": [
|
|
202
|
-
"src/**",
|
|
203
|
-
"*.json",
|
|
204
|
-
"../../.prettierignore",
|
|
205
|
-
"../../.prettierrc.json"
|
|
206
|
-
],
|
|
207
|
-
"output": [],
|
|
208
|
-
"packageLocks": [
|
|
209
|
-
"pnpm-lock.yaml"
|
|
210
|
-
]
|
|
211
|
-
},
|
|
212
|
-
"format:fix": {
|
|
213
|
-
"command": "pnpm run format || nps format:pkg:fix",
|
|
214
|
-
"files": [
|
|
215
|
-
"src/**",
|
|
216
|
-
"*.json",
|
|
217
|
-
"../../.prettierignore",
|
|
218
|
-
"../../.prettierrc.json"
|
|
219
|
-
],
|
|
220
|
-
"output": [],
|
|
221
|
-
"packageLocks": [
|
|
222
|
-
"pnpm-lock.yaml"
|
|
223
|
-
]
|
|
224
|
-
},
|
|
225
199
|
"lint": {
|
|
226
|
-
"command": "
|
|
200
|
+
"command": "eslint src",
|
|
227
201
|
"files": [
|
|
228
|
-
"src/**"
|
|
229
|
-
"../../.eslintignore",
|
|
230
|
-
"../../.eslintrc.js"
|
|
202
|
+
"src/**"
|
|
231
203
|
],
|
|
232
204
|
"output": [],
|
|
233
205
|
"dependencies": [
|
|
@@ -244,11 +216,9 @@
|
|
|
244
216
|
]
|
|
245
217
|
},
|
|
246
218
|
"lint:fix": {
|
|
247
|
-
"command": "
|
|
219
|
+
"command": "eslint --fix src",
|
|
248
220
|
"files": [
|
|
249
|
-
"src/**"
|
|
250
|
-
"../../.eslintignore",
|
|
251
|
-
"../../.eslintrc.js"
|
|
221
|
+
"src/**"
|
|
252
222
|
],
|
|
253
223
|
"output": [],
|
|
254
224
|
"dependencies": [
|
|
@@ -300,8 +270,6 @@
|
|
|
300
270
|
"check": "wireit",
|
|
301
271
|
"types:check": "wireit",
|
|
302
272
|
"types:create": "wireit",
|
|
303
|
-
"format": "wireit",
|
|
304
|
-
"format:fix": "wireit",
|
|
305
273
|
"lint": "wireit",
|
|
306
274
|
"lint:fix": "wireit",
|
|
307
275
|
"jest": "wireit"
|
package/src/helper-methods.tsx
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { orderBy } from "lodash";
|
|
1
|
+
import orderBy from "lodash/orderBy";
|
|
3
2
|
import React from "react";
|
|
4
3
|
import { Helpers, Scale, Wrapper } from "victory-core";
|
|
5
4
|
import isEqual from "react-fast-compare";
|
|
@@ -89,20 +88,20 @@ function addLayoutData(props, datasets, index) {
|
|
|
89
88
|
_y0: !(datum._y instanceof Date)
|
|
90
89
|
? yOffset
|
|
91
90
|
: yOffset
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
? new Date(yOffset)
|
|
92
|
+
: datum._y,
|
|
94
93
|
_y1:
|
|
95
94
|
datum._y === null
|
|
96
95
|
? null
|
|
97
96
|
: datum._y instanceof Date
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
? new Date(Number(datum._y) + Number(yOffset))
|
|
98
|
+
: datum._y + yOffset,
|
|
100
99
|
_x1:
|
|
101
100
|
datum._x === null
|
|
102
101
|
? null
|
|
103
102
|
: datum._x instanceof Date
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
? new Date(Number(datum._x) + Number(xOffset))
|
|
104
|
+
: datum._x + xOffset,
|
|
106
105
|
});
|
|
107
106
|
});
|
|
108
107
|
}
|
|
@@ -212,7 +211,7 @@ export function getChildProps(props, calculatedProps) {
|
|
|
212
211
|
return {
|
|
213
212
|
height: props.height,
|
|
214
213
|
width: props.width,
|
|
215
|
-
padding: Helpers.getPadding(props),
|
|
214
|
+
padding: Helpers.getPadding(props.padding),
|
|
216
215
|
standalone: false,
|
|
217
216
|
theme: props.theme,
|
|
218
217
|
categories,
|
package/src/victory-stack.tsx
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { defaults, isEmpty } from "lodash";
|
|
2
1
|
import React from "react";
|
|
2
|
+
import defaults from "lodash/defaults";
|
|
3
|
+
import isEmpty from "lodash/isEmpty";
|
|
4
|
+
|
|
3
5
|
import {
|
|
4
6
|
CategoryPropType,
|
|
5
|
-
ColorScalePropType,
|
|
6
7
|
DomainPropType,
|
|
7
8
|
EventPropTypeInterface,
|
|
8
9
|
StringOrNumberOrCallback,
|
|
9
10
|
VictoryCommonProps,
|
|
10
|
-
VictoryLabelableProps,
|
|
11
11
|
VictoryMultiLabelableProps,
|
|
12
12
|
VictoryStyleInterface,
|
|
13
13
|
Helpers,
|