victory-group 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-group.js +282 -259
- package/dist/victory-group.min.js +1 -1
- package/es/helper-methods.d.ts +3 -12
- package/es/helper-methods.js +1 -4
- package/es/victory-group.d.ts +1 -1
- package/es/victory-group.js +5 -6
- package/lib/helper-methods.d.ts +3 -12
- package/lib/helper-methods.js +1 -5
- package/lib/victory-group.d.ts +1 -1
- package/lib/victory-group.js +5 -6
- package/package.json +7 -39
- package/src/helper-methods.tsx +1 -3
- package/src/victory-group.tsx +2 -6
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;
|
|
@@ -16,12 +17,7 @@ export declare function getCalculatedProps(initialProps: any, childComponents: a
|
|
|
16
17
|
color: any;
|
|
17
18
|
offset: any;
|
|
18
19
|
origin: any;
|
|
19
|
-
padding:
|
|
20
|
-
top: any;
|
|
21
|
-
bottom: any;
|
|
22
|
-
left: any;
|
|
23
|
-
right: any;
|
|
24
|
-
};
|
|
20
|
+
padding: Helpers.ElementPadding;
|
|
25
21
|
};
|
|
26
22
|
export declare function useMemoizedProps(initialProps: any): {
|
|
27
23
|
datasets: any;
|
|
@@ -41,12 +37,7 @@ export declare function useMemoizedProps(initialProps: any): {
|
|
|
41
37
|
color: any;
|
|
42
38
|
offset: any;
|
|
43
39
|
origin: any;
|
|
44
|
-
padding:
|
|
45
|
-
top: any;
|
|
46
|
-
bottom: any;
|
|
47
|
-
left: any;
|
|
48
|
-
right: any;
|
|
49
|
-
};
|
|
40
|
+
padding: Helpers.ElementPadding;
|
|
50
41
|
};
|
|
51
42
|
export declare function getChildren(initialProps: any, childComponents?: any, calculatedProps?: any): any;
|
|
52
43
|
//# sourceMappingURL=helper-methods.d.ts.map
|
package/es/helper-methods.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable no-use-before-define */
|
|
2
1
|
import React from "react";
|
|
3
2
|
import { Data, Helpers, Scale, Wrapper } from "victory-core";
|
|
4
3
|
import isEqual from "react-fast-compare";
|
|
@@ -8,8 +7,6 @@ const fallbackProps = {
|
|
|
8
7
|
padding: 50,
|
|
9
8
|
offset: 0
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
// eslint-disable-next-line max-statements
|
|
13
10
|
export function getCalculatedProps(initialProps, childComponents) {
|
|
14
11
|
const role = "group";
|
|
15
12
|
const props = Helpers.modifyProps(initialProps, fallbackProps, role);
|
|
@@ -44,7 +41,7 @@ export function getCalculatedProps(initialProps, childComponents) {
|
|
|
44
41
|
y: baseScale.y.domain(domain.y).range(props.horizontal ? range.x : range.y)
|
|
45
42
|
};
|
|
46
43
|
const origin = polar ? props.origin : Helpers.getPolarOrigin(props);
|
|
47
|
-
const padding = Helpers.getPadding(props);
|
|
44
|
+
const padding = Helpers.getPadding(props.padding);
|
|
48
45
|
return {
|
|
49
46
|
datasets,
|
|
50
47
|
categories,
|
package/es/victory-group.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { EventPropTypeInterface, StringOrNumberOrCallback, VictoryCommonProps, VictoryDatableProps, VictoryMultiLabelableProps, VictoryStyleInterface, VictoryComponentConfiguration } from "victory-core";
|
|
3
|
-
export
|
|
3
|
+
export type VictoryGroupTTargetType = "data" | "labels" | "parent";
|
|
4
4
|
export interface VictoryGroupProps extends VictoryCommonProps, VictoryDatableProps, VictoryMultiLabelableProps {
|
|
5
5
|
children?: React.ReactNode;
|
|
6
6
|
color?: string;
|
package/es/victory-group.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import defaults from "lodash/defaults";
|
|
2
|
+
import isEmpty from "lodash/isEmpty";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { Helpers, Hooks, UserProps, VictoryContainer, VictoryTheme, Wrapper } from "victory-core";
|
|
5
5
|
import { VictorySharedEvents } from "victory-shared-events";
|
|
@@ -19,14 +19,13 @@ const defaultProps = {
|
|
|
19
19
|
theme: VictoryTheme.grayscale
|
|
20
20
|
};
|
|
21
21
|
const VictoryGroupBase = initialProps => {
|
|
22
|
-
// eslint-disable-next-line no-use-before-define
|
|
23
22
|
const role = VictoryGroup?.role;
|
|
24
23
|
const {
|
|
25
24
|
getAnimationProps,
|
|
26
25
|
setAnimationState,
|
|
27
26
|
getProps
|
|
28
27
|
} = Hooks.useAnimationState();
|
|
29
|
-
const propsWithDefaults = React.useMemo(() =>
|
|
28
|
+
const propsWithDefaults = React.useMemo(() => defaults({}, initialProps, defaultProps), [initialProps]);
|
|
30
29
|
const props = getProps(propsWithDefaults);
|
|
31
30
|
const modifiedProps = Helpers.modifyProps(props, fallbackProps, role);
|
|
32
31
|
const {
|
|
@@ -80,7 +79,7 @@ const VictoryGroupBase = initialProps => {
|
|
|
80
79
|
const userProps = React.useMemo(() => UserProps.getSafeUserProps(propsWithDefaults), [propsWithDefaults]);
|
|
81
80
|
const container = React.useMemo(() => {
|
|
82
81
|
if (standalone) {
|
|
83
|
-
const defaultContainerProps =
|
|
82
|
+
const defaultContainerProps = defaults({}, containerComponent.props, containerProps, userProps);
|
|
84
83
|
return /*#__PURE__*/React.cloneElement(containerComponent, defaultContainerProps);
|
|
85
84
|
}
|
|
86
85
|
return /*#__PURE__*/React.cloneElement(groupComponent, userProps);
|
|
@@ -97,7 +96,7 @@ const VictoryGroupBase = initialProps => {
|
|
|
97
96
|
}
|
|
98
97
|
};
|
|
99
98
|
}, [setAnimationState, previousProps, propsWithDefaults, props]);
|
|
100
|
-
if (!
|
|
99
|
+
if (!isEmpty(events)) {
|
|
101
100
|
return /*#__PURE__*/React.createElement(VictorySharedEvents, {
|
|
102
101
|
container: container,
|
|
103
102
|
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;
|
|
@@ -16,12 +17,7 @@ export declare function getCalculatedProps(initialProps: any, childComponents: a
|
|
|
16
17
|
color: any;
|
|
17
18
|
offset: any;
|
|
18
19
|
origin: any;
|
|
19
|
-
padding:
|
|
20
|
-
top: any;
|
|
21
|
-
bottom: any;
|
|
22
|
-
left: any;
|
|
23
|
-
right: any;
|
|
24
|
-
};
|
|
20
|
+
padding: Helpers.ElementPadding;
|
|
25
21
|
};
|
|
26
22
|
export declare function useMemoizedProps(initialProps: any): {
|
|
27
23
|
datasets: any;
|
|
@@ -41,12 +37,7 @@ export declare function useMemoizedProps(initialProps: any): {
|
|
|
41
37
|
color: any;
|
|
42
38
|
offset: any;
|
|
43
39
|
origin: any;
|
|
44
|
-
padding:
|
|
45
|
-
top: any;
|
|
46
|
-
bottom: any;
|
|
47
|
-
left: any;
|
|
48
|
-
right: any;
|
|
49
|
-
};
|
|
40
|
+
padding: Helpers.ElementPadding;
|
|
50
41
|
};
|
|
51
42
|
export declare function getChildren(initialProps: any, childComponents?: any, calculatedProps?: any): any;
|
|
52
43
|
//# sourceMappingURL=helper-methods.d.ts.map
|
package/lib/helper-methods.js
CHANGED
|
@@ -10,16 +10,12 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
10
10
|
var _victoryCore = require("victory-core");
|
|
11
11
|
var _reactFastCompare = _interopRequireDefault(require("react-fast-compare"));
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
/* eslint-disable no-use-before-define */
|
|
14
|
-
|
|
15
13
|
const fallbackProps = {
|
|
16
14
|
width: 450,
|
|
17
15
|
height: 300,
|
|
18
16
|
padding: 50,
|
|
19
17
|
offset: 0
|
|
20
18
|
};
|
|
21
|
-
|
|
22
|
-
// eslint-disable-next-line max-statements
|
|
23
19
|
function getCalculatedProps(initialProps, childComponents) {
|
|
24
20
|
const role = "group";
|
|
25
21
|
const props = _victoryCore.Helpers.modifyProps(initialProps, fallbackProps, role);
|
|
@@ -54,7 +50,7 @@ function getCalculatedProps(initialProps, childComponents) {
|
|
|
54
50
|
y: baseScale.y.domain(domain.y).range(props.horizontal ? range.x : range.y)
|
|
55
51
|
};
|
|
56
52
|
const origin = polar ? props.origin : _victoryCore.Helpers.getPolarOrigin(props);
|
|
57
|
-
const padding = _victoryCore.Helpers.getPadding(props);
|
|
53
|
+
const padding = _victoryCore.Helpers.getPadding(props.padding);
|
|
58
54
|
return {
|
|
59
55
|
datasets,
|
|
60
56
|
categories,
|
package/lib/victory-group.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { EventPropTypeInterface, StringOrNumberOrCallback, VictoryCommonProps, VictoryDatableProps, VictoryMultiLabelableProps, VictoryStyleInterface, VictoryComponentConfiguration } from "victory-core";
|
|
3
|
-
export
|
|
3
|
+
export type VictoryGroupTTargetType = "data" | "labels" | "parent";
|
|
4
4
|
export interface VictoryGroupProps extends VictoryCommonProps, VictoryDatableProps, VictoryMultiLabelableProps {
|
|
5
5
|
children?: React.ReactNode;
|
|
6
6
|
color?: string;
|
package/lib/victory-group.js
CHANGED
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.VictoryGroup = void 0;
|
|
7
|
-
var
|
|
8
|
-
var
|
|
7
|
+
var _defaults = _interopRequireDefault(require("lodash/defaults"));
|
|
8
|
+
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _victoryCore = require("victory-core");
|
|
11
11
|
var _victorySharedEvents = require("victory-shared-events");
|
|
@@ -26,14 +26,13 @@ const defaultProps = {
|
|
|
26
26
|
theme: _victoryCore.VictoryTheme.grayscale
|
|
27
27
|
};
|
|
28
28
|
const VictoryGroupBase = initialProps => {
|
|
29
|
-
// eslint-disable-next-line no-use-before-define
|
|
30
29
|
const role = VictoryGroup?.role;
|
|
31
30
|
const {
|
|
32
31
|
getAnimationProps,
|
|
33
32
|
setAnimationState,
|
|
34
33
|
getProps
|
|
35
34
|
} = _victoryCore.Hooks.useAnimationState();
|
|
36
|
-
const propsWithDefaults = _react.default.useMemo(() => (0,
|
|
35
|
+
const propsWithDefaults = _react.default.useMemo(() => (0, _defaults.default)({}, initialProps, defaultProps), [initialProps]);
|
|
37
36
|
const props = getProps(propsWithDefaults);
|
|
38
37
|
const modifiedProps = _victoryCore.Helpers.modifyProps(props, fallbackProps, role);
|
|
39
38
|
const {
|
|
@@ -87,7 +86,7 @@ const VictoryGroupBase = initialProps => {
|
|
|
87
86
|
const userProps = _react.default.useMemo(() => _victoryCore.UserProps.getSafeUserProps(propsWithDefaults), [propsWithDefaults]);
|
|
88
87
|
const container = _react.default.useMemo(() => {
|
|
89
88
|
if (standalone) {
|
|
90
|
-
const defaultContainerProps = (0,
|
|
89
|
+
const defaultContainerProps = (0, _defaults.default)({}, containerComponent.props, containerProps, userProps);
|
|
91
90
|
return /*#__PURE__*/_react.default.cloneElement(containerComponent, defaultContainerProps);
|
|
92
91
|
}
|
|
93
92
|
return /*#__PURE__*/_react.default.cloneElement(groupComponent, userProps);
|
|
@@ -104,7 +103,7 @@ const VictoryGroupBase = initialProps => {
|
|
|
104
103
|
}
|
|
105
104
|
};
|
|
106
105
|
}, [setAnimationState, previousProps, propsWithDefaults, props]);
|
|
107
|
-
if (!(0,
|
|
106
|
+
if (!(0, _isEmpty.default)(events)) {
|
|
108
107
|
return /*#__PURE__*/_react.default.createElement(_victorySharedEvents.VictorySharedEvents, {
|
|
109
108
|
container: container,
|
|
110
109
|
eventKey: eventKey,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "victory-group",
|
|
3
|
-
"version": "37.3.
|
|
3
|
+
"version": "37.3.3",
|
|
4
4
|
"description": "Group 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
|
"devDependencies": {
|
|
29
29
|
"victory-bar": "*"
|
|
@@ -192,38 +192,10 @@
|
|
|
192
192
|
"pnpm-lock.yaml"
|
|
193
193
|
]
|
|
194
194
|
},
|
|
195
|
-
"format": {
|
|
196
|
-
"command": "nps format:pkg",
|
|
197
|
-
"files": [
|
|
198
|
-
"src/**",
|
|
199
|
-
"*.json",
|
|
200
|
-
"../../.prettierignore",
|
|
201
|
-
"../../.prettierrc.json"
|
|
202
|
-
],
|
|
203
|
-
"output": [],
|
|
204
|
-
"packageLocks": [
|
|
205
|
-
"pnpm-lock.yaml"
|
|
206
|
-
]
|
|
207
|
-
},
|
|
208
|
-
"format:fix": {
|
|
209
|
-
"command": "pnpm run format || nps format:pkg:fix",
|
|
210
|
-
"files": [
|
|
211
|
-
"src/**",
|
|
212
|
-
"*.json",
|
|
213
|
-
"../../.prettierignore",
|
|
214
|
-
"../../.prettierrc.json"
|
|
215
|
-
],
|
|
216
|
-
"output": [],
|
|
217
|
-
"packageLocks": [
|
|
218
|
-
"pnpm-lock.yaml"
|
|
219
|
-
]
|
|
220
|
-
},
|
|
221
195
|
"lint": {
|
|
222
|
-
"command": "
|
|
196
|
+
"command": "eslint src",
|
|
223
197
|
"files": [
|
|
224
|
-
"src/**"
|
|
225
|
-
"../../.eslintignore",
|
|
226
|
-
"../../.eslintrc.js"
|
|
198
|
+
"src/**"
|
|
227
199
|
],
|
|
228
200
|
"output": [],
|
|
229
201
|
"dependencies": [
|
|
@@ -238,11 +210,9 @@
|
|
|
238
210
|
]
|
|
239
211
|
},
|
|
240
212
|
"lint:fix": {
|
|
241
|
-
"command": "
|
|
213
|
+
"command": "eslint --fix src",
|
|
242
214
|
"files": [
|
|
243
|
-
"src/**"
|
|
244
|
-
"../../.eslintignore",
|
|
245
|
-
"../../.eslintrc.js"
|
|
215
|
+
"src/**"
|
|
246
216
|
],
|
|
247
217
|
"output": [],
|
|
248
218
|
"dependencies": [
|
|
@@ -290,8 +260,6 @@
|
|
|
290
260
|
"check": "wireit",
|
|
291
261
|
"types:check": "wireit",
|
|
292
262
|
"types:create": "wireit",
|
|
293
|
-
"format": "wireit",
|
|
294
|
-
"format:fix": "wireit",
|
|
295
263
|
"lint": "wireit",
|
|
296
264
|
"lint:fix": "wireit",
|
|
297
265
|
"jest": "wireit"
|
package/src/helper-methods.tsx
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable no-use-before-define */
|
|
2
1
|
import React from "react";
|
|
3
2
|
import { Data, Helpers, Scale, Wrapper } from "victory-core";
|
|
4
3
|
import isEqual from "react-fast-compare";
|
|
@@ -10,7 +9,6 @@ const fallbackProps = {
|
|
|
10
9
|
offset: 0,
|
|
11
10
|
};
|
|
12
11
|
|
|
13
|
-
// eslint-disable-next-line max-statements
|
|
14
12
|
export function getCalculatedProps(initialProps, childComponents) {
|
|
15
13
|
const role = "group";
|
|
16
14
|
const props = Helpers.modifyProps(initialProps, fallbackProps, role);
|
|
@@ -45,7 +43,7 @@ export function getCalculatedProps(initialProps, childComponents) {
|
|
|
45
43
|
};
|
|
46
44
|
|
|
47
45
|
const origin = polar ? props.origin : Helpers.getPolarOrigin(props);
|
|
48
|
-
const padding = Helpers.getPadding(props);
|
|
46
|
+
const padding = Helpers.getPadding(props.padding);
|
|
49
47
|
return {
|
|
50
48
|
datasets,
|
|
51
49
|
categories,
|
package/src/victory-group.tsx
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import defaults from "lodash/defaults";
|
|
2
|
+
import isEmpty from "lodash/isEmpty";
|
|
2
3
|
import React from "react";
|
|
3
4
|
import {
|
|
4
|
-
CategoryPropType,
|
|
5
|
-
ColorScalePropType,
|
|
6
|
-
DomainPaddingPropType,
|
|
7
|
-
DomainPropType,
|
|
8
5
|
EventPropTypeInterface,
|
|
9
6
|
Helpers,
|
|
10
7
|
Hooks,
|
|
@@ -56,7 +53,6 @@ const defaultProps = {
|
|
|
56
53
|
};
|
|
57
54
|
|
|
58
55
|
const VictoryGroupBase: React.FC<VictoryGroupProps> = (initialProps) => {
|
|
59
|
-
// eslint-disable-next-line no-use-before-define
|
|
60
56
|
const role = VictoryGroup?.role;
|
|
61
57
|
const { getAnimationProps, setAnimationState, getProps } =
|
|
62
58
|
Hooks.useAnimationState();
|