victory-core 37.2.0 → 37.3.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/CHANGELOG.md +18 -0
- package/dist/victory-core.js +109 -117
- package/dist/victory-core.min.js +1 -1
- package/es/victory-portal/victory-portal.js +2 -2
- package/es/victory-theme/clean.js +28 -31
- package/es/victory-theme/types.d.ts +2 -1
- package/es/victory-util/wrapper.d.ts +1 -1
- package/es/victory-util/wrapper.js +8 -11
- package/lib/victory-portal/victory-portal.js +2 -2
- package/lib/victory-theme/clean.js +28 -31
- package/lib/victory-theme/types.d.ts +2 -1
- package/lib/victory-util/wrapper.d.ts +1 -1
- package/lib/victory-util/wrapper.js +9 -12
- package/package.json +2 -2
- package/src/victory-portal/victory-portal.tsx +2 -2
- package/src/victory-theme/clean.tsx +52 -30
- package/src/victory-theme/types.ts +2 -1
- package/src/victory-util/wrapper.tsx +10 -23
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _uniqueId from "lodash/uniqueId";
|
|
2
2
|
import _defaults from "lodash/defaults";
|
|
3
|
-
import React from "react";
|
|
3
|
+
import React, { useState } from "react";
|
|
4
4
|
import * as Log from "../victory-util/log";
|
|
5
5
|
import * as Helpers from "../victory-util/helpers";
|
|
6
6
|
import { usePortalContext } from "./portal-context";
|
|
@@ -12,7 +12,7 @@ export const VictoryPortal = initialProps => {
|
|
|
12
12
|
...defaultProps,
|
|
13
13
|
...initialProps
|
|
14
14
|
};
|
|
15
|
-
const id = _uniqueId();
|
|
15
|
+
const [id] = useState(_uniqueId());
|
|
16
16
|
const portalContext = usePortalContext();
|
|
17
17
|
if (!portalContext) {
|
|
18
18
|
const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
|
|
@@ -26,20 +26,16 @@ const orange = {
|
|
|
26
26
|
"100": "#FEE2D5",
|
|
27
27
|
"300": "#FFA981",
|
|
28
28
|
"500": "#FF6F2C",
|
|
29
|
+
"700": "#FF4E1B",
|
|
29
30
|
"900": "#D74D26"
|
|
30
31
|
};
|
|
31
32
|
const red = {
|
|
32
33
|
"100": "#FFDCE5",
|
|
33
34
|
"300": "#FF9EB7",
|
|
34
35
|
"500": "#F82B60",
|
|
36
|
+
"700": "#D31A3D",
|
|
35
37
|
"900": "#BA1E45"
|
|
36
38
|
};
|
|
37
|
-
const pink = {
|
|
38
|
-
"100": "#FFDAF6",
|
|
39
|
-
"300": "#F99DE2",
|
|
40
|
-
"500": "#FF08C2",
|
|
41
|
-
"900": "#B2158B"
|
|
42
|
-
};
|
|
43
39
|
const purple = {
|
|
44
40
|
"100": "#EDE3FE",
|
|
45
41
|
"300": "#CDB0FF",
|
|
@@ -50,6 +46,7 @@ const blue = {
|
|
|
50
46
|
"100": "#CFDFFF",
|
|
51
47
|
"300": "#9CC7FF",
|
|
52
48
|
"500": "#2D7FF9",
|
|
49
|
+
"700": "#0056B3",
|
|
53
50
|
"900": "#2750AE"
|
|
54
51
|
};
|
|
55
52
|
const cyan = {
|
|
@@ -68,27 +65,28 @@ const green = {
|
|
|
68
65
|
"100": "#D1F7C4",
|
|
69
66
|
"300": "#93E088",
|
|
70
67
|
"500": "#20C933",
|
|
68
|
+
"700": "#1B9B2A",
|
|
71
69
|
"900": "#338A17"
|
|
72
70
|
};
|
|
73
71
|
const colors = {
|
|
74
72
|
blue: blue["500"],
|
|
75
|
-
|
|
76
|
-
teal: teal["500"],
|
|
77
|
-
purple: purple["500"],
|
|
73
|
+
cyan: cyan["500"],
|
|
78
74
|
green: green["500"],
|
|
75
|
+
yellow: yellow["500"],
|
|
79
76
|
orange: orange["500"],
|
|
80
|
-
cyan: cyan["500"],
|
|
81
77
|
red: red["500"],
|
|
82
|
-
|
|
78
|
+
purple: purple["500"],
|
|
79
|
+
teal: teal["500"]
|
|
83
80
|
};
|
|
84
81
|
const colorScale = Object.values(colors);
|
|
85
|
-
const grayscale = [gray["
|
|
86
|
-
const warm = [yellow["500"], orange["500"],
|
|
87
|
-
const cool = [
|
|
88
|
-
const heatmap = [green["500"], yellow["500"], red["500"]];
|
|
89
|
-
const redPalette =
|
|
90
|
-
const greenPalette =
|
|
91
|
-
const bluePalette =
|
|
82
|
+
const grayscale = [gray["100"], gray["300"], gray["500"], gray["700"], gray["900"]];
|
|
83
|
+
const warm = [yellow["300"], yellow["500"], orange["500"], orange["900"], red["500"]];
|
|
84
|
+
const cool = [purple["500"], blue["500"], cyan["500"], teal["500"], green["500"]];
|
|
85
|
+
const heatmap = [green["900"], green["500"], yellow["500"], orange["500"], red["500"]];
|
|
86
|
+
const redPalette = Object.values(red);
|
|
87
|
+
const greenPalette = Object.values(green);
|
|
88
|
+
const bluePalette = Object.values(blue);
|
|
89
|
+
const defaultColor = blue["500"];
|
|
92
90
|
|
|
93
91
|
// *
|
|
94
92
|
// * Typography
|
|
@@ -103,7 +101,7 @@ const padding = 8;
|
|
|
103
101
|
const baseProps = {
|
|
104
102
|
width: 450,
|
|
105
103
|
height: 300,
|
|
106
|
-
padding:
|
|
104
|
+
padding: 60,
|
|
107
105
|
colorScale
|
|
108
106
|
};
|
|
109
107
|
// *
|
|
@@ -147,7 +145,7 @@ export const clean = {
|
|
|
147
145
|
area: Object.assign({
|
|
148
146
|
style: {
|
|
149
147
|
data: {
|
|
150
|
-
fill:
|
|
148
|
+
fill: defaultColor,
|
|
151
149
|
strokeWidth: 2,
|
|
152
150
|
fillOpacity: 0.5
|
|
153
151
|
},
|
|
@@ -164,7 +162,7 @@ export const clean = {
|
|
|
164
162
|
strokeLinejoin
|
|
165
163
|
},
|
|
166
164
|
axisLabel: Object.assign({}, centeredLabelStyles, {
|
|
167
|
-
padding,
|
|
165
|
+
padding: 35,
|
|
168
166
|
stroke: "transparent"
|
|
169
167
|
}),
|
|
170
168
|
grid: {
|
|
@@ -229,7 +227,7 @@ export const clean = {
|
|
|
229
227
|
bar: Object.assign({
|
|
230
228
|
style: {
|
|
231
229
|
data: {
|
|
232
|
-
fill:
|
|
230
|
+
fill: defaultColor,
|
|
233
231
|
padding,
|
|
234
232
|
strokeWidth: 1,
|
|
235
233
|
fillOpacity: 0.5
|
|
@@ -268,7 +266,7 @@ export const clean = {
|
|
|
268
266
|
}),
|
|
269
267
|
q1: {
|
|
270
268
|
padding,
|
|
271
|
-
fill:
|
|
269
|
+
fill: colorScale[0],
|
|
272
270
|
rx: borderRadius,
|
|
273
271
|
strokeWidth: 2
|
|
274
272
|
},
|
|
@@ -277,7 +275,7 @@ export const clean = {
|
|
|
277
275
|
}),
|
|
278
276
|
q3: {
|
|
279
277
|
padding,
|
|
280
|
-
fill:
|
|
278
|
+
fill: colorScale[1],
|
|
281
279
|
rx: borderRadius
|
|
282
280
|
},
|
|
283
281
|
q3Labels: Object.assign({}, baseLabelStyles, {
|
|
@@ -298,8 +296,8 @@ export const clean = {
|
|
|
298
296
|
})
|
|
299
297
|
},
|
|
300
298
|
candleColors: {
|
|
301
|
-
positive:
|
|
302
|
-
negative:
|
|
299
|
+
positive: green["500"],
|
|
300
|
+
negative: red["500"]
|
|
303
301
|
},
|
|
304
302
|
wickStrokeWidth: 2
|
|
305
303
|
}, baseProps),
|
|
@@ -365,7 +363,7 @@ export const clean = {
|
|
|
365
363
|
data: {
|
|
366
364
|
fill: "transparent",
|
|
367
365
|
opacity: 1,
|
|
368
|
-
stroke:
|
|
366
|
+
stroke: defaultColor,
|
|
369
367
|
strokeWidth: 2,
|
|
370
368
|
strokeLinecap,
|
|
371
369
|
strokeLinejoin
|
|
@@ -396,7 +394,7 @@ export const clean = {
|
|
|
396
394
|
scatter: Object.assign({
|
|
397
395
|
style: {
|
|
398
396
|
data: {
|
|
399
|
-
fill:
|
|
397
|
+
fill: defaultColor,
|
|
400
398
|
opacity: 1,
|
|
401
399
|
stroke: "transparent",
|
|
402
400
|
strokeWidth: 0
|
|
@@ -434,9 +432,8 @@ export const clean = {
|
|
|
434
432
|
style: {
|
|
435
433
|
data: {
|
|
436
434
|
fill: blue["100"],
|
|
437
|
-
stroke:
|
|
438
|
-
strokeWidth: 2
|
|
439
|
-
opacity: 0.4
|
|
435
|
+
stroke: defaultColor,
|
|
436
|
+
strokeWidth: 2
|
|
440
437
|
},
|
|
441
438
|
labels: Object.assign({}, baseLabelStyles, {
|
|
442
439
|
padding: 5,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { VictoryCommonThemeProps, VictoryDatableProps } from "../victory-util/common-props";
|
|
3
3
|
import { NumberOrCallback, OrientationOrCallback, PaddingOrCallback, StringOrNumberOrCallback } from "../types/callbacks";
|
|
4
|
+
import { DomainPropType } from "../types/prop-types";
|
|
4
5
|
export declare type BlockProps = {
|
|
5
6
|
top?: number;
|
|
6
7
|
bottom?: number;
|
|
@@ -39,7 +40,7 @@ export interface VictoryAxisCommonProps {
|
|
|
39
40
|
axisLabelComponent?: React.ReactElement;
|
|
40
41
|
axisValue?: number | string | object | Date;
|
|
41
42
|
dependentAxis?: boolean;
|
|
42
|
-
|
|
43
|
+
domain?: DomainPropType;
|
|
43
44
|
gridComponent?: React.ReactElement;
|
|
44
45
|
invertAxis?: boolean;
|
|
45
46
|
style?: {
|
|
@@ -17,7 +17,7 @@ export declare function getAllEvents(props: any): any;
|
|
|
17
17
|
export declare function getColor(calculatedProps: any, child: any, index: any, theme: any): any;
|
|
18
18
|
export declare function getStyle(theme: any, style: any, role: any): any;
|
|
19
19
|
export declare function getChildStyle(child: any, index: any, calculatedProps: any, theme: any): any;
|
|
20
|
-
export declare function
|
|
20
|
+
export declare function getStringsFromChildrenCategories(childComponents: any, axis: any): any[];
|
|
21
21
|
export declare function getStringsFromData(childComponents: any): {
|
|
22
22
|
x: number[];
|
|
23
23
|
y: number[];
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _isPlainObject from "lodash/isPlainObject";
|
|
2
1
|
import _uniqBy from "lodash/uniqBy";
|
|
3
2
|
import _groupBy from "lodash/groupBy";
|
|
4
3
|
import _uniq from "lodash/uniq";
|
|
@@ -311,15 +310,13 @@ export function getChildStyle(child, index, calculatedProps, theme) {
|
|
|
311
310
|
labels: labelsStyle
|
|
312
311
|
};
|
|
313
312
|
}
|
|
314
|
-
export function
|
|
313
|
+
export function getStringsFromChildrenCategories(childComponents, axis) {
|
|
315
314
|
const iteratee = child => {
|
|
316
|
-
|
|
317
|
-
if (!Domain.isDomainComponent(child) || !childProps.categories) {
|
|
315
|
+
if (!Domain.isDomainComponent(child)) {
|
|
318
316
|
return null;
|
|
319
317
|
}
|
|
320
|
-
const
|
|
321
|
-
|
|
322
|
-
return categoryStrings ? Collection.removeUndefined(categoryStrings) : [];
|
|
318
|
+
const childProps = child.props || {};
|
|
319
|
+
return Data.getStringsFromCategories(childProps, axis);
|
|
323
320
|
};
|
|
324
321
|
return Helpers.reduceChildren(childComponents.slice(0), iteratee);
|
|
325
322
|
}
|
|
@@ -354,10 +351,10 @@ export function getStringsFromData(childComponents) {
|
|
|
354
351
|
return Helpers.reduceChildren(childComponents.slice(0), iteratee, {}, initialMemo, combine);
|
|
355
352
|
}
|
|
356
353
|
export function getCategoryAndAxisStringsFromChildren(props, axis, childComponents) {
|
|
357
|
-
const categories =
|
|
354
|
+
const categories = Data.getStringsFromCategories(props, axis);
|
|
358
355
|
const axisComponent = Axis.getAxisComponent(childComponents, axis);
|
|
359
356
|
const axisStrings = axisComponent ? Data.getStringsFromAxes(axisComponent.props, axis) : [];
|
|
360
|
-
const categoryStrings = categories
|
|
357
|
+
const categoryStrings = categories.length ? categories : getStringsFromChildrenCategories(childComponents, axis);
|
|
361
358
|
return _uniq([...categoryStrings, ...axisStrings].flat());
|
|
362
359
|
}
|
|
363
360
|
export function getStringsFromChildren(props, childComponents) {
|
|
@@ -371,8 +368,8 @@ export function getStringsFromChildren(props, childComponents) {
|
|
|
371
368
|
};
|
|
372
369
|
}
|
|
373
370
|
export function getCategories(props, childComponents, allStrings) {
|
|
374
|
-
const xPropCategories = props.categories &&
|
|
375
|
-
const yPropCategories = props.categories &&
|
|
371
|
+
const xPropCategories = props.categories && Data.getStringsFromCategories(props, "x");
|
|
372
|
+
const yPropCategories = props.categories && Data.getStringsFromCategories(props, "y");
|
|
376
373
|
const fallbackRequired = !xPropCategories || !yPropCategories;
|
|
377
374
|
const fallbackProps = fallbackRequired ? allStrings || getStringsFromChildren(props, childComponents) : {};
|
|
378
375
|
const xCategories = xPropCategories || fallbackProps.x;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.VictoryPortal = void 0;
|
|
7
7
|
var _uniqueId2 = _interopRequireDefault(require("lodash/uniqueId"));
|
|
8
8
|
var _defaults2 = _interopRequireDefault(require("lodash/defaults"));
|
|
9
|
-
var _react =
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var Log = _interopRequireWildcard(require("../victory-util/log"));
|
|
11
11
|
var Helpers = _interopRequireWildcard(require("../victory-util/helpers"));
|
|
12
12
|
var _portalContext = require("./portal-context");
|
|
@@ -21,7 +21,7 @@ const VictoryPortal = initialProps => {
|
|
|
21
21
|
...defaultProps,
|
|
22
22
|
...initialProps
|
|
23
23
|
};
|
|
24
|
-
const id = (0, _uniqueId2.default)();
|
|
24
|
+
const [id] = (0, _react.useState)((0, _uniqueId2.default)());
|
|
25
25
|
const portalContext = (0, _portalContext.usePortalContext)();
|
|
26
26
|
if (!portalContext) {
|
|
27
27
|
const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
|
|
@@ -32,20 +32,16 @@ const orange = {
|
|
|
32
32
|
"100": "#FEE2D5",
|
|
33
33
|
"300": "#FFA981",
|
|
34
34
|
"500": "#FF6F2C",
|
|
35
|
+
"700": "#FF4E1B",
|
|
35
36
|
"900": "#D74D26"
|
|
36
37
|
};
|
|
37
38
|
const red = {
|
|
38
39
|
"100": "#FFDCE5",
|
|
39
40
|
"300": "#FF9EB7",
|
|
40
41
|
"500": "#F82B60",
|
|
42
|
+
"700": "#D31A3D",
|
|
41
43
|
"900": "#BA1E45"
|
|
42
44
|
};
|
|
43
|
-
const pink = {
|
|
44
|
-
"100": "#FFDAF6",
|
|
45
|
-
"300": "#F99DE2",
|
|
46
|
-
"500": "#FF08C2",
|
|
47
|
-
"900": "#B2158B"
|
|
48
|
-
};
|
|
49
45
|
const purple = {
|
|
50
46
|
"100": "#EDE3FE",
|
|
51
47
|
"300": "#CDB0FF",
|
|
@@ -56,6 +52,7 @@ const blue = {
|
|
|
56
52
|
"100": "#CFDFFF",
|
|
57
53
|
"300": "#9CC7FF",
|
|
58
54
|
"500": "#2D7FF9",
|
|
55
|
+
"700": "#0056B3",
|
|
59
56
|
"900": "#2750AE"
|
|
60
57
|
};
|
|
61
58
|
const cyan = {
|
|
@@ -74,27 +71,28 @@ const green = {
|
|
|
74
71
|
"100": "#D1F7C4",
|
|
75
72
|
"300": "#93E088",
|
|
76
73
|
"500": "#20C933",
|
|
74
|
+
"700": "#1B9B2A",
|
|
77
75
|
"900": "#338A17"
|
|
78
76
|
};
|
|
79
77
|
const colors = {
|
|
80
78
|
blue: blue["500"],
|
|
81
|
-
|
|
82
|
-
teal: teal["500"],
|
|
83
|
-
purple: purple["500"],
|
|
79
|
+
cyan: cyan["500"],
|
|
84
80
|
green: green["500"],
|
|
81
|
+
yellow: yellow["500"],
|
|
85
82
|
orange: orange["500"],
|
|
86
|
-
cyan: cyan["500"],
|
|
87
83
|
red: red["500"],
|
|
88
|
-
|
|
84
|
+
purple: purple["500"],
|
|
85
|
+
teal: teal["500"]
|
|
89
86
|
};
|
|
90
87
|
const colorScale = Object.values(colors);
|
|
91
|
-
const grayscale = [gray["
|
|
92
|
-
const warm = [yellow["500"], orange["500"],
|
|
93
|
-
const cool = [
|
|
94
|
-
const heatmap = [green["500"], yellow["500"], red["500"]];
|
|
95
|
-
const redPalette =
|
|
96
|
-
const greenPalette =
|
|
97
|
-
const bluePalette =
|
|
88
|
+
const grayscale = [gray["100"], gray["300"], gray["500"], gray["700"], gray["900"]];
|
|
89
|
+
const warm = [yellow["300"], yellow["500"], orange["500"], orange["900"], red["500"]];
|
|
90
|
+
const cool = [purple["500"], blue["500"], cyan["500"], teal["500"], green["500"]];
|
|
91
|
+
const heatmap = [green["900"], green["500"], yellow["500"], orange["500"], red["500"]];
|
|
92
|
+
const redPalette = Object.values(red);
|
|
93
|
+
const greenPalette = Object.values(green);
|
|
94
|
+
const bluePalette = Object.values(blue);
|
|
95
|
+
const defaultColor = blue["500"];
|
|
98
96
|
|
|
99
97
|
// *
|
|
100
98
|
// * Typography
|
|
@@ -109,7 +107,7 @@ const padding = 8;
|
|
|
109
107
|
const baseProps = {
|
|
110
108
|
width: 450,
|
|
111
109
|
height: 300,
|
|
112
|
-
padding:
|
|
110
|
+
padding: 60,
|
|
113
111
|
colorScale
|
|
114
112
|
};
|
|
115
113
|
// *
|
|
@@ -153,7 +151,7 @@ const clean = exports.clean = {
|
|
|
153
151
|
area: Object.assign({
|
|
154
152
|
style: {
|
|
155
153
|
data: {
|
|
156
|
-
fill:
|
|
154
|
+
fill: defaultColor,
|
|
157
155
|
strokeWidth: 2,
|
|
158
156
|
fillOpacity: 0.5
|
|
159
157
|
},
|
|
@@ -170,7 +168,7 @@ const clean = exports.clean = {
|
|
|
170
168
|
strokeLinejoin
|
|
171
169
|
},
|
|
172
170
|
axisLabel: Object.assign({}, centeredLabelStyles, {
|
|
173
|
-
padding,
|
|
171
|
+
padding: 35,
|
|
174
172
|
stroke: "transparent"
|
|
175
173
|
}),
|
|
176
174
|
grid: {
|
|
@@ -235,7 +233,7 @@ const clean = exports.clean = {
|
|
|
235
233
|
bar: Object.assign({
|
|
236
234
|
style: {
|
|
237
235
|
data: {
|
|
238
|
-
fill:
|
|
236
|
+
fill: defaultColor,
|
|
239
237
|
padding,
|
|
240
238
|
strokeWidth: 1,
|
|
241
239
|
fillOpacity: 0.5
|
|
@@ -274,7 +272,7 @@ const clean = exports.clean = {
|
|
|
274
272
|
}),
|
|
275
273
|
q1: {
|
|
276
274
|
padding,
|
|
277
|
-
fill:
|
|
275
|
+
fill: colorScale[0],
|
|
278
276
|
rx: borderRadius,
|
|
279
277
|
strokeWidth: 2
|
|
280
278
|
},
|
|
@@ -283,7 +281,7 @@ const clean = exports.clean = {
|
|
|
283
281
|
}),
|
|
284
282
|
q3: {
|
|
285
283
|
padding,
|
|
286
|
-
fill:
|
|
284
|
+
fill: colorScale[1],
|
|
287
285
|
rx: borderRadius
|
|
288
286
|
},
|
|
289
287
|
q3Labels: Object.assign({}, baseLabelStyles, {
|
|
@@ -304,8 +302,8 @@ const clean = exports.clean = {
|
|
|
304
302
|
})
|
|
305
303
|
},
|
|
306
304
|
candleColors: {
|
|
307
|
-
positive:
|
|
308
|
-
negative:
|
|
305
|
+
positive: green["500"],
|
|
306
|
+
negative: red["500"]
|
|
309
307
|
},
|
|
310
308
|
wickStrokeWidth: 2
|
|
311
309
|
}, baseProps),
|
|
@@ -371,7 +369,7 @@ const clean = exports.clean = {
|
|
|
371
369
|
data: {
|
|
372
370
|
fill: "transparent",
|
|
373
371
|
opacity: 1,
|
|
374
|
-
stroke:
|
|
372
|
+
stroke: defaultColor,
|
|
375
373
|
strokeWidth: 2,
|
|
376
374
|
strokeLinecap,
|
|
377
375
|
strokeLinejoin
|
|
@@ -402,7 +400,7 @@ const clean = exports.clean = {
|
|
|
402
400
|
scatter: Object.assign({
|
|
403
401
|
style: {
|
|
404
402
|
data: {
|
|
405
|
-
fill:
|
|
403
|
+
fill: defaultColor,
|
|
406
404
|
opacity: 1,
|
|
407
405
|
stroke: "transparent",
|
|
408
406
|
strokeWidth: 0
|
|
@@ -440,9 +438,8 @@ const clean = exports.clean = {
|
|
|
440
438
|
style: {
|
|
441
439
|
data: {
|
|
442
440
|
fill: blue["100"],
|
|
443
|
-
stroke:
|
|
444
|
-
strokeWidth: 2
|
|
445
|
-
opacity: 0.4
|
|
441
|
+
stroke: defaultColor,
|
|
442
|
+
strokeWidth: 2
|
|
446
443
|
},
|
|
447
444
|
labels: Object.assign({}, baseLabelStyles, {
|
|
448
445
|
padding: 5,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { VictoryCommonThemeProps, VictoryDatableProps } from "../victory-util/common-props";
|
|
3
3
|
import { NumberOrCallback, OrientationOrCallback, PaddingOrCallback, StringOrNumberOrCallback } from "../types/callbacks";
|
|
4
|
+
import { DomainPropType } from "../types/prop-types";
|
|
4
5
|
export declare type BlockProps = {
|
|
5
6
|
top?: number;
|
|
6
7
|
bottom?: number;
|
|
@@ -39,7 +40,7 @@ export interface VictoryAxisCommonProps {
|
|
|
39
40
|
axisLabelComponent?: React.ReactElement;
|
|
40
41
|
axisValue?: number | string | object | Date;
|
|
41
42
|
dependentAxis?: boolean;
|
|
42
|
-
|
|
43
|
+
domain?: DomainPropType;
|
|
43
44
|
gridComponent?: React.ReactElement;
|
|
44
45
|
invertAxis?: boolean;
|
|
45
46
|
style?: {
|
|
@@ -17,7 +17,7 @@ export declare function getAllEvents(props: any): any;
|
|
|
17
17
|
export declare function getColor(calculatedProps: any, child: any, index: any, theme: any): any;
|
|
18
18
|
export declare function getStyle(theme: any, style: any, role: any): any;
|
|
19
19
|
export declare function getChildStyle(child: any, index: any, calculatedProps: any, theme: any): any;
|
|
20
|
-
export declare function
|
|
20
|
+
export declare function getStringsFromChildrenCategories(childComponents: any, axis: any): any[];
|
|
21
21
|
export declare function getStringsFromData(childComponents: any): {
|
|
22
22
|
x: number[];
|
|
23
23
|
y: number[];
|
|
@@ -15,12 +15,11 @@ exports.getDefaultDomainPadding = getDefaultDomainPadding;
|
|
|
15
15
|
exports.getDomain = getDomain;
|
|
16
16
|
exports.getDomainFromChildren = getDomainFromChildren;
|
|
17
17
|
exports.getScale = getScale;
|
|
18
|
-
exports.getStringsFromCategories = getStringsFromCategories;
|
|
19
18
|
exports.getStringsFromChildren = getStringsFromChildren;
|
|
19
|
+
exports.getStringsFromChildrenCategories = getStringsFromChildrenCategories;
|
|
20
20
|
exports.getStringsFromData = getStringsFromData;
|
|
21
21
|
exports.getStyle = getStyle;
|
|
22
22
|
exports.getWidth = getWidth;
|
|
23
|
-
var _isPlainObject2 = _interopRequireDefault(require("lodash/isPlainObject"));
|
|
24
23
|
var _uniqBy2 = _interopRequireDefault(require("lodash/uniqBy"));
|
|
25
24
|
var _groupBy2 = _interopRequireDefault(require("lodash/groupBy"));
|
|
26
25
|
var _uniq2 = _interopRequireDefault(require("lodash/uniq"));
|
|
@@ -336,15 +335,13 @@ function getChildStyle(child, index, calculatedProps, theme) {
|
|
|
336
335
|
labels: labelsStyle
|
|
337
336
|
};
|
|
338
337
|
}
|
|
339
|
-
function
|
|
338
|
+
function getStringsFromChildrenCategories(childComponents, axis) {
|
|
340
339
|
const iteratee = child => {
|
|
341
|
-
|
|
342
|
-
if (!Domain.isDomainComponent(child) || !childProps.categories) {
|
|
340
|
+
if (!Domain.isDomainComponent(child)) {
|
|
343
341
|
return null;
|
|
344
342
|
}
|
|
345
|
-
const
|
|
346
|
-
|
|
347
|
-
return categoryStrings ? Collection.removeUndefined(categoryStrings) : [];
|
|
343
|
+
const childProps = child.props || {};
|
|
344
|
+
return Data.getStringsFromCategories(childProps, axis);
|
|
348
345
|
};
|
|
349
346
|
return Helpers.reduceChildren(childComponents.slice(0), iteratee);
|
|
350
347
|
}
|
|
@@ -379,10 +376,10 @@ function getStringsFromData(childComponents) {
|
|
|
379
376
|
return Helpers.reduceChildren(childComponents.slice(0), iteratee, {}, initialMemo, combine);
|
|
380
377
|
}
|
|
381
378
|
function getCategoryAndAxisStringsFromChildren(props, axis, childComponents) {
|
|
382
|
-
const categories =
|
|
379
|
+
const categories = Data.getStringsFromCategories(props, axis);
|
|
383
380
|
const axisComponent = Axis.getAxisComponent(childComponents, axis);
|
|
384
381
|
const axisStrings = axisComponent ? Data.getStringsFromAxes(axisComponent.props, axis) : [];
|
|
385
|
-
const categoryStrings = categories
|
|
382
|
+
const categoryStrings = categories.length ? categories : getStringsFromChildrenCategories(childComponents, axis);
|
|
386
383
|
return (0, _uniq2.default)([...categoryStrings, ...axisStrings].flat());
|
|
387
384
|
}
|
|
388
385
|
function getStringsFromChildren(props, childComponents) {
|
|
@@ -396,8 +393,8 @@ function getStringsFromChildren(props, childComponents) {
|
|
|
396
393
|
};
|
|
397
394
|
}
|
|
398
395
|
function getCategories(props, childComponents, allStrings) {
|
|
399
|
-
const xPropCategories = props.categories &&
|
|
400
|
-
const yPropCategories = props.categories &&
|
|
396
|
+
const xPropCategories = props.categories && Data.getStringsFromCategories(props, "x");
|
|
397
|
+
const yPropCategories = props.categories && Data.getStringsFromCategories(props, "y");
|
|
401
398
|
const fallbackRequired = !xPropCategories || !yPropCategories;
|
|
402
399
|
const fallbackProps = fallbackRequired ? allStrings || getStringsFromChildren(props, childComponents) : {};
|
|
403
400
|
const xCategories = xPropCategories || fallbackProps.x;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "victory-core",
|
|
3
|
-
"version": "37.
|
|
3
|
+
"version": "37.3.1",
|
|
4
4
|
"description": "Victory Core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data visualization",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"lodash": "^4.17.21",
|
|
24
24
|
"react-fast-compare": "^3.2.0",
|
|
25
|
-
"victory-vendor": "37.
|
|
25
|
+
"victory-vendor": "37.3.1"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"react": ">=16.6.0"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
import { defaults, uniqueId } from "lodash";
|
|
3
3
|
import * as Log from "../victory-util/log";
|
|
4
4
|
import * as Helpers from "../victory-util/helpers";
|
|
@@ -15,7 +15,7 @@ const defaultProps: Partial<VictoryPortalProps> = {
|
|
|
15
15
|
|
|
16
16
|
export const VictoryPortal = (initialProps: VictoryPortalProps) => {
|
|
17
17
|
const props = { ...defaultProps, ...initialProps };
|
|
18
|
-
const id = uniqueId();
|
|
18
|
+
const [id] = useState(uniqueId());
|
|
19
19
|
const portalContext = usePortalContext();
|
|
20
20
|
|
|
21
21
|
if (!portalContext) {
|