victory 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 +4 -0
- package/dist/victory.js +137 -119
- package/dist/victory.min.js +1 -1
- package/package.json +28 -28
package/CHANGELOG.md
CHANGED
package/dist/victory.js
CHANGED
|
@@ -13162,7 +13162,7 @@ class VictoryCandlestickBase extends (react__WEBPACK_IMPORTED_MODULE_0___default
|
|
|
13162
13162
|
if (labelComponent) {
|
|
13163
13163
|
const labelsComponents = this.dataKeys.map((_dataKey, index) => {
|
|
13164
13164
|
const labelProps = this.getComponentProps(labelComponent, "labels", index);
|
|
13165
|
-
if (labelProps.text !== undefined && labelProps.text !== null) {
|
|
13165
|
+
if (labelProps.text !== undefined && labelProps.text !== null && typeof labelProps.text !== "boolean") {
|
|
13166
13166
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(labelComponent, labelProps);
|
|
13167
13167
|
}
|
|
13168
13168
|
return undefined;
|
|
@@ -15466,7 +15466,7 @@ const VictoryPortal = initialProps => {
|
|
|
15466
15466
|
...defaultProps,
|
|
15467
15467
|
...initialProps
|
|
15468
15468
|
};
|
|
15469
|
-
const id = lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default()();
|
|
15469
|
+
const [id] = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default()());
|
|
15470
15470
|
const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_3__.usePortalContext)();
|
|
15471
15471
|
if (!portalContext) {
|
|
15472
15472
|
const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
|
|
@@ -16347,20 +16347,16 @@ const orange = {
|
|
|
16347
16347
|
"100": "#FEE2D5",
|
|
16348
16348
|
"300": "#FFA981",
|
|
16349
16349
|
"500": "#FF6F2C",
|
|
16350
|
+
"700": "#FF4E1B",
|
|
16350
16351
|
"900": "#D74D26"
|
|
16351
16352
|
};
|
|
16352
16353
|
const red = {
|
|
16353
16354
|
"100": "#FFDCE5",
|
|
16354
16355
|
"300": "#FF9EB7",
|
|
16355
16356
|
"500": "#F82B60",
|
|
16357
|
+
"700": "#D31A3D",
|
|
16356
16358
|
"900": "#BA1E45"
|
|
16357
16359
|
};
|
|
16358
|
-
const pink = {
|
|
16359
|
-
"100": "#FFDAF6",
|
|
16360
|
-
"300": "#F99DE2",
|
|
16361
|
-
"500": "#FF08C2",
|
|
16362
|
-
"900": "#B2158B"
|
|
16363
|
-
};
|
|
16364
16360
|
const purple = {
|
|
16365
16361
|
"100": "#EDE3FE",
|
|
16366
16362
|
"300": "#CDB0FF",
|
|
@@ -16371,6 +16367,7 @@ const blue = {
|
|
|
16371
16367
|
"100": "#CFDFFF",
|
|
16372
16368
|
"300": "#9CC7FF",
|
|
16373
16369
|
"500": "#2D7FF9",
|
|
16370
|
+
"700": "#0056B3",
|
|
16374
16371
|
"900": "#2750AE"
|
|
16375
16372
|
};
|
|
16376
16373
|
const cyan = {
|
|
@@ -16389,27 +16386,28 @@ const green = {
|
|
|
16389
16386
|
"100": "#D1F7C4",
|
|
16390
16387
|
"300": "#93E088",
|
|
16391
16388
|
"500": "#20C933",
|
|
16389
|
+
"700": "#1B9B2A",
|
|
16392
16390
|
"900": "#338A17"
|
|
16393
16391
|
};
|
|
16394
16392
|
const colors = {
|
|
16395
16393
|
blue: blue["500"],
|
|
16396
|
-
|
|
16397
|
-
teal: teal["500"],
|
|
16398
|
-
purple: purple["500"],
|
|
16394
|
+
cyan: cyan["500"],
|
|
16399
16395
|
green: green["500"],
|
|
16396
|
+
yellow: yellow["500"],
|
|
16400
16397
|
orange: orange["500"],
|
|
16401
|
-
cyan: cyan["500"],
|
|
16402
16398
|
red: red["500"],
|
|
16403
|
-
|
|
16399
|
+
purple: purple["500"],
|
|
16400
|
+
teal: teal["500"]
|
|
16404
16401
|
};
|
|
16405
16402
|
const colorScale = Object.values(colors);
|
|
16406
|
-
const grayscale = [gray["
|
|
16407
|
-
const warm = [yellow["500"], orange["500"],
|
|
16408
|
-
const cool = [
|
|
16409
|
-
const heatmap = [green["500"], yellow["500"], red["500"]];
|
|
16410
|
-
const redPalette =
|
|
16411
|
-
const greenPalette =
|
|
16412
|
-
const bluePalette =
|
|
16403
|
+
const grayscale = [gray["100"], gray["300"], gray["500"], gray["700"], gray["900"]];
|
|
16404
|
+
const warm = [yellow["300"], yellow["500"], orange["500"], orange["900"], red["500"]];
|
|
16405
|
+
const cool = [purple["500"], blue["500"], cyan["500"], teal["500"], green["500"]];
|
|
16406
|
+
const heatmap = [green["900"], green["500"], yellow["500"], orange["500"], red["500"]];
|
|
16407
|
+
const redPalette = Object.values(red);
|
|
16408
|
+
const greenPalette = Object.values(green);
|
|
16409
|
+
const bluePalette = Object.values(blue);
|
|
16410
|
+
const defaultColor = blue["500"];
|
|
16413
16411
|
|
|
16414
16412
|
// *
|
|
16415
16413
|
// * Typography
|
|
@@ -16424,7 +16422,7 @@ const padding = 8;
|
|
|
16424
16422
|
const baseProps = {
|
|
16425
16423
|
width: 450,
|
|
16426
16424
|
height: 300,
|
|
16427
|
-
padding:
|
|
16425
|
+
padding: 60,
|
|
16428
16426
|
colorScale
|
|
16429
16427
|
};
|
|
16430
16428
|
// *
|
|
@@ -16468,7 +16466,7 @@ const clean = {
|
|
|
16468
16466
|
area: Object.assign({
|
|
16469
16467
|
style: {
|
|
16470
16468
|
data: {
|
|
16471
|
-
fill:
|
|
16469
|
+
fill: defaultColor,
|
|
16472
16470
|
strokeWidth: 2,
|
|
16473
16471
|
fillOpacity: 0.5
|
|
16474
16472
|
},
|
|
@@ -16485,7 +16483,7 @@ const clean = {
|
|
|
16485
16483
|
strokeLinejoin
|
|
16486
16484
|
},
|
|
16487
16485
|
axisLabel: Object.assign({}, centeredLabelStyles, {
|
|
16488
|
-
padding,
|
|
16486
|
+
padding: 35,
|
|
16489
16487
|
stroke: "transparent"
|
|
16490
16488
|
}),
|
|
16491
16489
|
grid: {
|
|
@@ -16550,7 +16548,7 @@ const clean = {
|
|
|
16550
16548
|
bar: Object.assign({
|
|
16551
16549
|
style: {
|
|
16552
16550
|
data: {
|
|
16553
|
-
fill:
|
|
16551
|
+
fill: defaultColor,
|
|
16554
16552
|
padding,
|
|
16555
16553
|
strokeWidth: 1,
|
|
16556
16554
|
fillOpacity: 0.5
|
|
@@ -16589,7 +16587,7 @@ const clean = {
|
|
|
16589
16587
|
}),
|
|
16590
16588
|
q1: {
|
|
16591
16589
|
padding,
|
|
16592
|
-
fill:
|
|
16590
|
+
fill: colorScale[0],
|
|
16593
16591
|
rx: borderRadius,
|
|
16594
16592
|
strokeWidth: 2
|
|
16595
16593
|
},
|
|
@@ -16598,7 +16596,7 @@ const clean = {
|
|
|
16598
16596
|
}),
|
|
16599
16597
|
q3: {
|
|
16600
16598
|
padding,
|
|
16601
|
-
fill:
|
|
16599
|
+
fill: colorScale[1],
|
|
16602
16600
|
rx: borderRadius
|
|
16603
16601
|
},
|
|
16604
16602
|
q3Labels: Object.assign({}, baseLabelStyles, {
|
|
@@ -16619,8 +16617,8 @@ const clean = {
|
|
|
16619
16617
|
})
|
|
16620
16618
|
},
|
|
16621
16619
|
candleColors: {
|
|
16622
|
-
positive:
|
|
16623
|
-
negative:
|
|
16620
|
+
positive: green["500"],
|
|
16621
|
+
negative: red["500"]
|
|
16624
16622
|
},
|
|
16625
16623
|
wickStrokeWidth: 2
|
|
16626
16624
|
}, baseProps),
|
|
@@ -16686,7 +16684,7 @@ const clean = {
|
|
|
16686
16684
|
data: {
|
|
16687
16685
|
fill: "transparent",
|
|
16688
16686
|
opacity: 1,
|
|
16689
|
-
stroke:
|
|
16687
|
+
stroke: defaultColor,
|
|
16690
16688
|
strokeWidth: 2,
|
|
16691
16689
|
strokeLinecap,
|
|
16692
16690
|
strokeLinejoin
|
|
@@ -16717,7 +16715,7 @@ const clean = {
|
|
|
16717
16715
|
scatter: Object.assign({
|
|
16718
16716
|
style: {
|
|
16719
16717
|
data: {
|
|
16720
|
-
fill:
|
|
16718
|
+
fill: defaultColor,
|
|
16721
16719
|
opacity: 1,
|
|
16722
16720
|
stroke: "transparent",
|
|
16723
16721
|
strokeWidth: 0
|
|
@@ -16755,9 +16753,8 @@ const clean = {
|
|
|
16755
16753
|
style: {
|
|
16756
16754
|
data: {
|
|
16757
16755
|
fill: blue["100"],
|
|
16758
|
-
stroke:
|
|
16759
|
-
strokeWidth: 2
|
|
16760
|
-
opacity: 0.4
|
|
16756
|
+
stroke: defaultColor,
|
|
16757
|
+
strokeWidth: 2
|
|
16761
16758
|
},
|
|
16762
16759
|
labels: Object.assign({}, baseLabelStyles, {
|
|
16763
16760
|
padding: 5,
|
|
@@ -22343,34 +22340,31 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
22343
22340
|
/* harmony export */ "getDomain": function() { return /* binding */ getDomain; },
|
|
22344
22341
|
/* harmony export */ "getDomainFromChildren": function() { return /* binding */ getDomainFromChildren; },
|
|
22345
22342
|
/* harmony export */ "getScale": function() { return /* binding */ getScale; },
|
|
22346
|
-
/* harmony export */ "getStringsFromCategories": function() { return /* binding */ getStringsFromCategories; },
|
|
22347
22343
|
/* harmony export */ "getStringsFromChildren": function() { return /* binding */ getStringsFromChildren; },
|
|
22344
|
+
/* harmony export */ "getStringsFromChildrenCategories": function() { return /* binding */ getStringsFromChildrenCategories; },
|
|
22348
22345
|
/* harmony export */ "getStringsFromData": function() { return /* binding */ getStringsFromData; },
|
|
22349
22346
|
/* harmony export */ "getStyle": function() { return /* binding */ getStyle; },
|
|
22350
22347
|
/* harmony export */ "getWidth": function() { return /* binding */ getWidth; }
|
|
22351
22348
|
/* harmony export */ });
|
|
22352
|
-
/* harmony import */ var
|
|
22353
|
-
/* harmony import */ var
|
|
22354
|
-
/* harmony import */ var
|
|
22355
|
-
/* harmony import */ var
|
|
22356
|
-
/* harmony import */ var
|
|
22357
|
-
/* harmony import */ var
|
|
22358
|
-
/* harmony import */ var
|
|
22359
|
-
/* harmony import */ var
|
|
22360
|
-
/* harmony import */ var
|
|
22361
|
-
/* harmony import */ var
|
|
22362
|
-
/* harmony import */ var
|
|
22363
|
-
/* harmony import */ var
|
|
22364
|
-
/* harmony import */ var
|
|
22365
|
-
/* harmony import */ var
|
|
22366
|
-
/* harmony import */ var
|
|
22367
|
-
/* harmony import */ var
|
|
22368
|
-
/* harmony import */ var
|
|
22369
|
-
/* harmony import */ var
|
|
22370
|
-
/* harmony import */ var
|
|
22371
|
-
/* harmony import */ var _scale__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./scale */ "../../victory-core/es/victory-util/scale.js");
|
|
22372
|
-
/* harmony import */ var _log__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./log */ "../../victory-core/es/victory-util/log.js");
|
|
22373
|
-
|
|
22349
|
+
/* harmony import */ var lodash_uniqBy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/uniqBy */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/uniqBy.js");
|
|
22350
|
+
/* harmony import */ var lodash_uniqBy__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqBy__WEBPACK_IMPORTED_MODULE_0__);
|
|
22351
|
+
/* harmony import */ var lodash_groupBy__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/groupBy */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/groupBy.js");
|
|
22352
|
+
/* harmony import */ var lodash_groupBy__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_groupBy__WEBPACK_IMPORTED_MODULE_1__);
|
|
22353
|
+
/* harmony import */ var lodash_uniq__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/uniq */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/uniq.js");
|
|
22354
|
+
/* harmony import */ var lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_uniq__WEBPACK_IMPORTED_MODULE_2__);
|
|
22355
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/defaults.js");
|
|
22356
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_3__);
|
|
22357
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ "react");
|
|
22358
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__);
|
|
22359
|
+
/* harmony import */ var _axis__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./axis */ "../../victory-core/es/victory-util/axis.js");
|
|
22360
|
+
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./style */ "../../victory-core/es/victory-util/style.js");
|
|
22361
|
+
/* harmony import */ var _data__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./data */ "../../victory-core/es/victory-util/data.js");
|
|
22362
|
+
/* harmony import */ var _domain__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./domain */ "../../victory-core/es/victory-util/domain.js");
|
|
22363
|
+
/* harmony import */ var _events__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./events */ "../../victory-core/es/victory-util/events.js");
|
|
22364
|
+
/* harmony import */ var _collection__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./collection */ "../../victory-core/es/victory-util/collection.js");
|
|
22365
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
22366
|
+
/* harmony import */ var _scale__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./scale */ "../../victory-core/es/victory-util/scale.js");
|
|
22367
|
+
/* harmony import */ var _log__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./log */ "../../victory-core/es/victory-util/log.js");
|
|
22374
22368
|
|
|
22375
22369
|
|
|
22376
22370
|
|
|
@@ -22399,7 +22393,7 @@ function addBinsToParentPropsIfHistogram(_ref) {
|
|
|
22399
22393
|
return child.type && child.type.role === "histogram";
|
|
22400
22394
|
});
|
|
22401
22395
|
if (someChildrenAreHistograms && !allChildrenAreHistograms) {
|
|
22402
|
-
|
|
22396
|
+
_log__WEBPACK_IMPORTED_MODULE_5__.warn("VictoryHistogram only supports being stacked with other VictoryHistogram components. Check to make sure that you are only passing VictoryHistogram components to VictoryStack");
|
|
22403
22397
|
}
|
|
22404
22398
|
|
|
22405
22399
|
// if we are stacking histograms, we need to generate explicit bins
|
|
@@ -22412,7 +22406,7 @@ function addBinsToParentPropsIfHistogram(_ref) {
|
|
|
22412
22406
|
// if we have explicit bins then we don't need to calculate them
|
|
22413
22407
|
if (!Array.isArray(childBins)) {
|
|
22414
22408
|
const combinedData = children.reduce((memo, child) => {
|
|
22415
|
-
const xAccessor =
|
|
22409
|
+
const xAccessor = _helpers__WEBPACK_IMPORTED_MODULE_6__.createAccessor(child.props.x || "x");
|
|
22416
22410
|
return memo.concat(child.props.data.map(datum => ({
|
|
22417
22411
|
x: xAccessor(datum)
|
|
22418
22412
|
})));
|
|
@@ -22455,7 +22449,7 @@ function getDataFromChildren(props, childComponents) {
|
|
|
22455
22449
|
maxDomain
|
|
22456
22450
|
};
|
|
22457
22451
|
let stack = 0;
|
|
22458
|
-
const children = childComponents ? childComponents.slice(0) :
|
|
22452
|
+
const children = childComponents ? childComponents.slice(0) : react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children);
|
|
22459
22453
|
parentProps = addBinsToParentPropsIfHistogram({
|
|
22460
22454
|
children,
|
|
22461
22455
|
props,
|
|
@@ -22466,13 +22460,13 @@ function getDataFromChildren(props, childComponents) {
|
|
|
22466
22460
|
const childProps = Object.assign({}, child.props, parentProps);
|
|
22467
22461
|
let childData;
|
|
22468
22462
|
let childElement = child;
|
|
22469
|
-
if (!
|
|
22463
|
+
if (!_data__WEBPACK_IMPORTED_MODULE_7__.isDataComponent(child)) {
|
|
22470
22464
|
return null;
|
|
22471
|
-
} else if (child.type &&
|
|
22472
|
-
childElement = parent ? /*#__PURE__*/
|
|
22465
|
+
} else if (child.type && _helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction(child.type.getData)) {
|
|
22466
|
+
childElement = parent ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default().cloneElement(child, parent.props) : child;
|
|
22473
22467
|
childData = childElement.type.getData(childProps);
|
|
22474
22468
|
} else {
|
|
22475
|
-
childData =
|
|
22469
|
+
childData = _data__WEBPACK_IMPORTED_MODULE_7__.getData(childProps);
|
|
22476
22470
|
}
|
|
22477
22471
|
stack += 1;
|
|
22478
22472
|
return childData.map((datum, index) => Object.assign({
|
|
@@ -22481,23 +22475,23 @@ function getDataFromChildren(props, childComponents) {
|
|
|
22481
22475
|
}, datum));
|
|
22482
22476
|
};
|
|
22483
22477
|
const stacked = children.filter(c => c.type && c.type.role === "stack").length;
|
|
22484
|
-
const combine = (memo, val) => memo.concat(
|
|
22485
|
-
const datasets =
|
|
22478
|
+
const combine = (memo, val) => memo.concat(lodash_uniqBy__WEBPACK_IMPORTED_MODULE_0___default()(val, "_group"));
|
|
22479
|
+
const datasets = _helpers__WEBPACK_IMPORTED_MODULE_6__.reduceChildren(children, iteratee, props, [], combine);
|
|
22486
22480
|
const group = stacked ? "_group" : "_stack";
|
|
22487
|
-
return Object.values(
|
|
22481
|
+
return Object.values(lodash_groupBy__WEBPACK_IMPORTED_MODULE_1___default()(datasets, group));
|
|
22488
22482
|
}
|
|
22489
22483
|
function getData(props, childComponents) {
|
|
22490
22484
|
if (props.data) {
|
|
22491
|
-
return
|
|
22485
|
+
return _data__WEBPACK_IMPORTED_MODULE_7__.getData(props);
|
|
22492
22486
|
}
|
|
22493
|
-
return getDataFromChildren(props, childComponents ||
|
|
22487
|
+
return getDataFromChildren(props, childComponents || react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children));
|
|
22494
22488
|
}
|
|
22495
22489
|
function getWidth(props, groupLength, seriesLength) {
|
|
22496
22490
|
const {
|
|
22497
22491
|
datasets,
|
|
22498
22492
|
horizontal
|
|
22499
22493
|
} = props;
|
|
22500
|
-
const range = horizontal ?
|
|
22494
|
+
const range = horizontal ? _helpers__WEBPACK_IMPORTED_MODULE_6__.getRange(props, "y") : _helpers__WEBPACK_IMPORTED_MODULE_6__.getRange(props, "x");
|
|
22501
22495
|
const extent = Math.abs(range[1] - range[0]);
|
|
22502
22496
|
const seriesLengthValue = seriesLength !== undefined ? seriesLength : Array.isArray(datasets[0]) && datasets[0].length || 1;
|
|
22503
22497
|
const groupLengthValue = groupLength || datasets.length;
|
|
@@ -22543,8 +22537,8 @@ function getDefaultDomainPadding(props, axis, childComponents) {
|
|
|
22543
22537
|
}
|
|
22544
22538
|
function getDomainFromChildren(props, axis, childComponents) {
|
|
22545
22539
|
// eslint-disable-line max-statements, complexity, max-len
|
|
22546
|
-
const children = childComponents ? childComponents.slice(0) :
|
|
22547
|
-
const parentData = props.data ?
|
|
22540
|
+
const children = childComponents ? childComponents.slice(0) : react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children);
|
|
22541
|
+
const parentData = props.data ? _data__WEBPACK_IMPORTED_MODULE_7__.getData(props) : undefined;
|
|
22548
22542
|
const {
|
|
22549
22543
|
polar,
|
|
22550
22544
|
startAngle,
|
|
@@ -22568,58 +22562,58 @@ function getDomainFromChildren(props, axis, childComponents) {
|
|
|
22568
22562
|
}) : baseParentProps;
|
|
22569
22563
|
const iteratee = child => {
|
|
22570
22564
|
const sharedProps = Object.assign({}, child.props, parentProps);
|
|
22571
|
-
if (!
|
|
22565
|
+
if (!_domain__WEBPACK_IMPORTED_MODULE_8__.isDomainComponent(child)) {
|
|
22572
22566
|
return null;
|
|
22573
|
-
} else if (child.type &&
|
|
22567
|
+
} else if (child.type && _helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction(child.type.getDomain)) {
|
|
22574
22568
|
return child.props && child.type.getDomain(sharedProps, axis);
|
|
22575
22569
|
}
|
|
22576
|
-
return
|
|
22570
|
+
return _domain__WEBPACK_IMPORTED_MODULE_8__.getDomain(sharedProps, axis);
|
|
22577
22571
|
};
|
|
22578
|
-
const childDomains =
|
|
22579
|
-
const min = childDomains.length === 0 ? 0 :
|
|
22580
|
-
const max = childDomains.length === 0 ? 1 :
|
|
22572
|
+
const childDomains = _helpers__WEBPACK_IMPORTED_MODULE_6__.reduceChildren(children, iteratee, props);
|
|
22573
|
+
const min = childDomains.length === 0 ? 0 : _collection__WEBPACK_IMPORTED_MODULE_9__.getMinValue(childDomains);
|
|
22574
|
+
const max = childDomains.length === 0 ? 1 : _collection__WEBPACK_IMPORTED_MODULE_9__.getMaxValue(childDomains);
|
|
22581
22575
|
return [min, max];
|
|
22582
22576
|
}
|
|
22583
22577
|
function getDomain(props, axis, childComponents) {
|
|
22584
|
-
const children = childComponents ||
|
|
22585
|
-
const propsDomain =
|
|
22578
|
+
const children = childComponents || react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children);
|
|
22579
|
+
const propsDomain = _domain__WEBPACK_IMPORTED_MODULE_8__.getDomainFromProps(props, axis);
|
|
22586
22580
|
const domainPadding = getDefaultDomainPadding(props, axis, children);
|
|
22587
22581
|
let domain;
|
|
22588
22582
|
if (propsDomain) {
|
|
22589
22583
|
domain = propsDomain;
|
|
22590
22584
|
} else {
|
|
22591
|
-
const minDomain =
|
|
22592
|
-
const maxDomain =
|
|
22593
|
-
const dataset = (props.data || props.y) &&
|
|
22594
|
-
const dataDomain = dataset ?
|
|
22585
|
+
const minDomain = _domain__WEBPACK_IMPORTED_MODULE_8__.getMinFromProps(props, axis);
|
|
22586
|
+
const maxDomain = _domain__WEBPACK_IMPORTED_MODULE_8__.getMaxFromProps(props, axis);
|
|
22587
|
+
const dataset = (props.data || props.y) && _data__WEBPACK_IMPORTED_MODULE_7__.getData(props);
|
|
22588
|
+
const dataDomain = dataset ? _domain__WEBPACK_IMPORTED_MODULE_8__.getDomainFromData(props, axis, dataset) : [];
|
|
22595
22589
|
const childDomain = getDomainFromChildren(props, axis, children);
|
|
22596
|
-
const min = minDomain ||
|
|
22597
|
-
const max = maxDomain ||
|
|
22598
|
-
domain =
|
|
22590
|
+
const min = minDomain || _collection__WEBPACK_IMPORTED_MODULE_9__.getMinValue([...dataDomain, ...childDomain]);
|
|
22591
|
+
const max = maxDomain || _collection__WEBPACK_IMPORTED_MODULE_9__.getMaxValue([...dataDomain, ...childDomain]);
|
|
22592
|
+
domain = _domain__WEBPACK_IMPORTED_MODULE_8__.getDomainFromMinMax(min, max);
|
|
22599
22593
|
}
|
|
22600
|
-
return
|
|
22594
|
+
return _domain__WEBPACK_IMPORTED_MODULE_8__.formatDomain(domain, Object.assign({
|
|
22601
22595
|
domainPadding
|
|
22602
22596
|
}, props), axis);
|
|
22603
22597
|
}
|
|
22604
22598
|
function getScale(props, axis, childComponents) {
|
|
22605
22599
|
if (props.data) {
|
|
22606
|
-
return
|
|
22600
|
+
return _scale__WEBPACK_IMPORTED_MODULE_10__.getBaseScale(props, axis);
|
|
22607
22601
|
}
|
|
22608
|
-
const children = childComponents ? childComponents.slice(0) :
|
|
22602
|
+
const children = childComponents ? childComponents.slice(0) : react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children);
|
|
22609
22603
|
const iteratee = child => {
|
|
22610
22604
|
const sharedProps = Object.assign({}, child.props, {
|
|
22611
22605
|
horizontal: props.horizontal
|
|
22612
22606
|
});
|
|
22613
|
-
return
|
|
22607
|
+
return _scale__WEBPACK_IMPORTED_MODULE_10__.getScaleType(sharedProps, axis);
|
|
22614
22608
|
};
|
|
22615
|
-
const childScale =
|
|
22609
|
+
const childScale = lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default()(_helpers__WEBPACK_IMPORTED_MODULE_6__.reduceChildren(children, iteratee, props));
|
|
22616
22610
|
|
|
22617
22611
|
// default to linear scale if more than one uniq scale type is given by children
|
|
22618
|
-
return childScale.length > 1 ?
|
|
22612
|
+
return childScale.length > 1 ? _scale__WEBPACK_IMPORTED_MODULE_10__.getScaleFromName("linear") : _scale__WEBPACK_IMPORTED_MODULE_10__.getScaleFromName(childScale[0]);
|
|
22619
22613
|
}
|
|
22620
22614
|
function getAllEvents(props) {
|
|
22621
22615
|
const components = ["groupComponent", "containerComponent", "labelComponent"];
|
|
22622
|
-
const componentEvents =
|
|
22616
|
+
const componentEvents = _events__WEBPACK_IMPORTED_MODULE_11__.getComponentEvents(props, components);
|
|
22623
22617
|
let events = props.events;
|
|
22624
22618
|
if (Array.isArray(componentEvents)) {
|
|
22625
22619
|
events = Array.isArray(props.events) ? componentEvents.concat(...props.events) : componentEvents;
|
|
@@ -22645,12 +22639,12 @@ function getColor(calculatedProps, child, index, theme) {
|
|
|
22645
22639
|
if (!colorScale && !color) {
|
|
22646
22640
|
return undefined;
|
|
22647
22641
|
}
|
|
22648
|
-
const colors = Array.isArray(colorScale) ? colorScale :
|
|
22642
|
+
const colors = Array.isArray(colorScale) ? colorScale : _style__WEBPACK_IMPORTED_MODULE_12__.getColorScale(colorScale, theme);
|
|
22649
22643
|
return color || colors[index % colors.length];
|
|
22650
22644
|
}
|
|
22651
22645
|
function getStyle(theme, style, role) {
|
|
22652
22646
|
const defaultStyle = theme && theme[role] && theme[role].style ? theme[role].style : {};
|
|
22653
|
-
return
|
|
22647
|
+
return _helpers__WEBPACK_IMPORTED_MODULE_6__.getStyles(style, defaultStyle);
|
|
22654
22648
|
}
|
|
22655
22649
|
|
|
22656
22650
|
// eslint-disable-next-line max-params
|
|
@@ -22674,8 +22668,8 @@ function getChildStyle(child, index, calculatedProps, theme) {
|
|
|
22674
22668
|
const dataWidth = role === "stack" ? {} : {
|
|
22675
22669
|
width: getWidth(calculatedProps)
|
|
22676
22670
|
};
|
|
22677
|
-
const dataStyle =
|
|
22678
|
-
const labelsStyle =
|
|
22671
|
+
const dataStyle = lodash_defaults__WEBPACK_IMPORTED_MODULE_3___default()({}, childStyle.data, Object.assign({}, dataWidth, style.data, defaultColor));
|
|
22672
|
+
const labelsStyle = lodash_defaults__WEBPACK_IMPORTED_MODULE_3___default()({}, childStyle.labels, style.labels);
|
|
22679
22673
|
return {
|
|
22680
22674
|
...childStyle,
|
|
22681
22675
|
parent: style.parent,
|
|
@@ -22683,28 +22677,26 @@ function getChildStyle(child, index, calculatedProps, theme) {
|
|
|
22683
22677
|
labels: labelsStyle
|
|
22684
22678
|
};
|
|
22685
22679
|
}
|
|
22686
|
-
function
|
|
22680
|
+
function getStringsFromChildrenCategories(childComponents, axis) {
|
|
22687
22681
|
const iteratee = child => {
|
|
22688
|
-
|
|
22689
|
-
if (!_domain__WEBPACK_IMPORTED_MODULE_9__.isDomainComponent(child) || !childProps.categories) {
|
|
22682
|
+
if (!_domain__WEBPACK_IMPORTED_MODULE_8__.isDomainComponent(child)) {
|
|
22690
22683
|
return null;
|
|
22691
22684
|
}
|
|
22692
|
-
const
|
|
22693
|
-
|
|
22694
|
-
return categoryStrings ? _collection__WEBPACK_IMPORTED_MODULE_10__.removeUndefined(categoryStrings) : [];
|
|
22685
|
+
const childProps = child.props || {};
|
|
22686
|
+
return _data__WEBPACK_IMPORTED_MODULE_7__.getStringsFromCategories(childProps, axis);
|
|
22695
22687
|
};
|
|
22696
|
-
return
|
|
22688
|
+
return _helpers__WEBPACK_IMPORTED_MODULE_6__.reduceChildren(childComponents.slice(0), iteratee);
|
|
22697
22689
|
}
|
|
22698
22690
|
function getStringsFromData(childComponents) {
|
|
22699
22691
|
const iteratee = child => {
|
|
22700
22692
|
const childProps = child.props || {};
|
|
22701
22693
|
let data;
|
|
22702
|
-
if (!
|
|
22694
|
+
if (!_data__WEBPACK_IMPORTED_MODULE_7__.isDataComponent(child)) {
|
|
22703
22695
|
return null;
|
|
22704
|
-
} else if (child.type &&
|
|
22696
|
+
} else if (child.type && _helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction(child.type.getData)) {
|
|
22705
22697
|
data = child.type.getData(childProps);
|
|
22706
22698
|
} else {
|
|
22707
|
-
data =
|
|
22699
|
+
data = _data__WEBPACK_IMPORTED_MODULE_7__.getData(childProps);
|
|
22708
22700
|
}
|
|
22709
22701
|
return data.map(d => ({
|
|
22710
22702
|
x: d.xName,
|
|
@@ -22723,28 +22715,28 @@ function getStringsFromData(childComponents) {
|
|
|
22723
22715
|
y: y !== undefined ? memo.y.concat(y) : memo.y
|
|
22724
22716
|
};
|
|
22725
22717
|
};
|
|
22726
|
-
return
|
|
22718
|
+
return _helpers__WEBPACK_IMPORTED_MODULE_6__.reduceChildren(childComponents.slice(0), iteratee, {}, initialMemo, combine);
|
|
22727
22719
|
}
|
|
22728
22720
|
function getCategoryAndAxisStringsFromChildren(props, axis, childComponents) {
|
|
22729
|
-
const categories =
|
|
22730
|
-
const axisComponent =
|
|
22731
|
-
const axisStrings = axisComponent ?
|
|
22732
|
-
const categoryStrings = categories
|
|
22733
|
-
return
|
|
22721
|
+
const categories = _data__WEBPACK_IMPORTED_MODULE_7__.getStringsFromCategories(props, axis);
|
|
22722
|
+
const axisComponent = _axis__WEBPACK_IMPORTED_MODULE_13__.getAxisComponent(childComponents, axis);
|
|
22723
|
+
const axisStrings = axisComponent ? _data__WEBPACK_IMPORTED_MODULE_7__.getStringsFromAxes(axisComponent.props, axis) : [];
|
|
22724
|
+
const categoryStrings = categories.length ? categories : getStringsFromChildrenCategories(childComponents, axis);
|
|
22725
|
+
return lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default()([...categoryStrings, ...axisStrings].flat());
|
|
22734
22726
|
}
|
|
22735
22727
|
function getStringsFromChildren(props, childComponents) {
|
|
22736
|
-
const children = childComponents ||
|
|
22728
|
+
const children = childComponents || react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children);
|
|
22737
22729
|
const xStrings = getCategoryAndAxisStringsFromChildren(props, "x", children);
|
|
22738
22730
|
const yStrings = getCategoryAndAxisStringsFromChildren(props, "y", children);
|
|
22739
22731
|
const dataStrings = getStringsFromData(children);
|
|
22740
22732
|
return {
|
|
22741
|
-
x:
|
|
22742
|
-
y:
|
|
22733
|
+
x: lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default()([...xStrings, ...dataStrings.x].flat()),
|
|
22734
|
+
y: lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default()([...yStrings, ...dataStrings.y].flat())
|
|
22743
22735
|
};
|
|
22744
22736
|
}
|
|
22745
22737
|
function getCategories(props, childComponents, allStrings) {
|
|
22746
|
-
const xPropCategories = props.categories &&
|
|
22747
|
-
const yPropCategories = props.categories &&
|
|
22738
|
+
const xPropCategories = props.categories && _data__WEBPACK_IMPORTED_MODULE_7__.getStringsFromCategories(props, "x");
|
|
22739
|
+
const yPropCategories = props.categories && _data__WEBPACK_IMPORTED_MODULE_7__.getStringsFromCategories(props, "y");
|
|
22748
22740
|
const fallbackRequired = !xPropCategories || !yPropCategories;
|
|
22749
22741
|
const fallbackProps = fallbackRequired ? allStrings || getStringsFromChildren(props, childComponents) : {};
|
|
22750
22742
|
const xCategories = xPropCategories || fallbackProps.x;
|
|
@@ -22867,6 +22859,8 @@ const CONTAINER_COMPONENTS_WEB = {
|
|
|
22867
22859
|
voronoi: victory_voronoi_container__WEBPACK_IMPORTED_MODULE_9__.VictoryVoronoiContainer
|
|
22868
22860
|
};
|
|
22869
22861
|
function makeCreateContainerFunction(containerComponents, VictoryContainerBase) {
|
|
22862
|
+
// Helper type to support backwards compatibility with old types
|
|
22863
|
+
|
|
22870
22864
|
return function combineContainers(containerA, containerB) {
|
|
22871
22865
|
const ContainerA = containerComponents[containerA];
|
|
22872
22866
|
const ContainerB = containerComponents[containerB];
|
|
@@ -25495,6 +25489,30 @@ const getSlices = (props, data) => {
|
|
|
25495
25489
|
});
|
|
25496
25490
|
return layoutFunction(data);
|
|
25497
25491
|
};
|
|
25492
|
+
const getCategoriesFromProps = props => Array.isArray(props.categories) ? props.categories : props?.categories?.x ?? [];
|
|
25493
|
+
|
|
25494
|
+
/**
|
|
25495
|
+
* Sorts data by props.categories or props.categories.x. If all of the data keys aren't
|
|
25496
|
+
* included in categories, any remaining data will be appended to the data array.
|
|
25497
|
+
* If extraneous categories are included in the categories prop, the will be ignored and
|
|
25498
|
+
* have no effect on the rendered component.
|
|
25499
|
+
*/
|
|
25500
|
+
const getDataSortedByCategories = (props, data) => {
|
|
25501
|
+
const sorted = [];
|
|
25502
|
+
getCategoriesFromProps(props).forEach(category => {
|
|
25503
|
+
const idx = data.findIndex(_ref => {
|
|
25504
|
+
let {
|
|
25505
|
+
x
|
|
25506
|
+
} = _ref;
|
|
25507
|
+
return x === category;
|
|
25508
|
+
});
|
|
25509
|
+
if (idx >= 0) {
|
|
25510
|
+
const datum = data.splice(idx, 1)[0];
|
|
25511
|
+
sorted.push(datum);
|
|
25512
|
+
}
|
|
25513
|
+
});
|
|
25514
|
+
return [...sorted, ...data];
|
|
25515
|
+
};
|
|
25498
25516
|
const getCalculatedValues = props => {
|
|
25499
25517
|
const {
|
|
25500
25518
|
colorScale,
|
|
@@ -25506,7 +25524,7 @@ const getCalculatedValues = props => {
|
|
|
25506
25524
|
const padding = victory_core__WEBPACK_IMPORTED_MODULE_3__.getPadding(props);
|
|
25507
25525
|
const defaultRadius = getRadius(props, padding);
|
|
25508
25526
|
const origin = getOrigin(props, padding);
|
|
25509
|
-
const data = victory_core__WEBPACK_IMPORTED_MODULE_5__.getData(props);
|
|
25527
|
+
const data = getDataSortedByCategories(props, victory_core__WEBPACK_IMPORTED_MODULE_5__.getData(props));
|
|
25510
25528
|
const slices = getSlices(props, data);
|
|
25511
25529
|
return Object.assign({}, props, {
|
|
25512
25530
|
style,
|