victory-core 37.2.0 → 37.3.0
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 +12 -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-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-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-util/wrapper.tsx +10 -23
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# victory-core
|
|
2
2
|
|
|
3
|
+
## 37.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Clean theme color updates and other minor adjustments ([#2920](https://github.com/FormidableLabs/victory/pull/2920))
|
|
8
|
+
|
|
9
|
+
* Fix VictoryPortal id changing for every render ([#2929](https://github.com/FormidableLabs/victory/pull/2929))
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- fix categories array of strings ([#2919](https://github.com/FormidableLabs/victory/pull/2919))
|
|
14
|
+
|
|
3
15
|
## 37.2.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/victory-core.js
CHANGED
|
@@ -1433,7 +1433,7 @@ const VictoryPortal = initialProps => {
|
|
|
1433
1433
|
...defaultProps,
|
|
1434
1434
|
...initialProps
|
|
1435
1435
|
};
|
|
1436
|
-
const id = lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default()();
|
|
1436
|
+
const [id] = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default()());
|
|
1437
1437
|
const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_3__.usePortalContext)();
|
|
1438
1438
|
if (!portalContext) {
|
|
1439
1439
|
const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
|
|
@@ -2314,20 +2314,16 @@ const orange = {
|
|
|
2314
2314
|
"100": "#FEE2D5",
|
|
2315
2315
|
"300": "#FFA981",
|
|
2316
2316
|
"500": "#FF6F2C",
|
|
2317
|
+
"700": "#FF4E1B",
|
|
2317
2318
|
"900": "#D74D26"
|
|
2318
2319
|
};
|
|
2319
2320
|
const red = {
|
|
2320
2321
|
"100": "#FFDCE5",
|
|
2321
2322
|
"300": "#FF9EB7",
|
|
2322
2323
|
"500": "#F82B60",
|
|
2324
|
+
"700": "#D31A3D",
|
|
2323
2325
|
"900": "#BA1E45"
|
|
2324
2326
|
};
|
|
2325
|
-
const pink = {
|
|
2326
|
-
"100": "#FFDAF6",
|
|
2327
|
-
"300": "#F99DE2",
|
|
2328
|
-
"500": "#FF08C2",
|
|
2329
|
-
"900": "#B2158B"
|
|
2330
|
-
};
|
|
2331
2327
|
const purple = {
|
|
2332
2328
|
"100": "#EDE3FE",
|
|
2333
2329
|
"300": "#CDB0FF",
|
|
@@ -2338,6 +2334,7 @@ const blue = {
|
|
|
2338
2334
|
"100": "#CFDFFF",
|
|
2339
2335
|
"300": "#9CC7FF",
|
|
2340
2336
|
"500": "#2D7FF9",
|
|
2337
|
+
"700": "#0056B3",
|
|
2341
2338
|
"900": "#2750AE"
|
|
2342
2339
|
};
|
|
2343
2340
|
const cyan = {
|
|
@@ -2356,27 +2353,28 @@ const green = {
|
|
|
2356
2353
|
"100": "#D1F7C4",
|
|
2357
2354
|
"300": "#93E088",
|
|
2358
2355
|
"500": "#20C933",
|
|
2356
|
+
"700": "#1B9B2A",
|
|
2359
2357
|
"900": "#338A17"
|
|
2360
2358
|
};
|
|
2361
2359
|
const colors = {
|
|
2362
2360
|
blue: blue["500"],
|
|
2363
|
-
|
|
2364
|
-
teal: teal["500"],
|
|
2365
|
-
purple: purple["500"],
|
|
2361
|
+
cyan: cyan["500"],
|
|
2366
2362
|
green: green["500"],
|
|
2363
|
+
yellow: yellow["500"],
|
|
2367
2364
|
orange: orange["500"],
|
|
2368
|
-
cyan: cyan["500"],
|
|
2369
2365
|
red: red["500"],
|
|
2370
|
-
|
|
2366
|
+
purple: purple["500"],
|
|
2367
|
+
teal: teal["500"]
|
|
2371
2368
|
};
|
|
2372
2369
|
const colorScale = Object.values(colors);
|
|
2373
|
-
const grayscale = [gray["
|
|
2374
|
-
const warm = [yellow["500"], orange["500"],
|
|
2375
|
-
const cool = [
|
|
2376
|
-
const heatmap = [green["500"], yellow["500"], red["500"]];
|
|
2377
|
-
const redPalette =
|
|
2378
|
-
const greenPalette =
|
|
2379
|
-
const bluePalette =
|
|
2370
|
+
const grayscale = [gray["100"], gray["300"], gray["500"], gray["700"], gray["900"]];
|
|
2371
|
+
const warm = [yellow["300"], yellow["500"], orange["500"], orange["900"], red["500"]];
|
|
2372
|
+
const cool = [purple["500"], blue["500"], cyan["500"], teal["500"], green["500"]];
|
|
2373
|
+
const heatmap = [green["900"], green["500"], yellow["500"], orange["500"], red["500"]];
|
|
2374
|
+
const redPalette = Object.values(red);
|
|
2375
|
+
const greenPalette = Object.values(green);
|
|
2376
|
+
const bluePalette = Object.values(blue);
|
|
2377
|
+
const defaultColor = blue["500"];
|
|
2380
2378
|
|
|
2381
2379
|
// *
|
|
2382
2380
|
// * Typography
|
|
@@ -2391,7 +2389,7 @@ const padding = 8;
|
|
|
2391
2389
|
const baseProps = {
|
|
2392
2390
|
width: 450,
|
|
2393
2391
|
height: 300,
|
|
2394
|
-
padding:
|
|
2392
|
+
padding: 60,
|
|
2395
2393
|
colorScale
|
|
2396
2394
|
};
|
|
2397
2395
|
// *
|
|
@@ -2435,7 +2433,7 @@ const clean = {
|
|
|
2435
2433
|
area: Object.assign({
|
|
2436
2434
|
style: {
|
|
2437
2435
|
data: {
|
|
2438
|
-
fill:
|
|
2436
|
+
fill: defaultColor,
|
|
2439
2437
|
strokeWidth: 2,
|
|
2440
2438
|
fillOpacity: 0.5
|
|
2441
2439
|
},
|
|
@@ -2452,7 +2450,7 @@ const clean = {
|
|
|
2452
2450
|
strokeLinejoin
|
|
2453
2451
|
},
|
|
2454
2452
|
axisLabel: Object.assign({}, centeredLabelStyles, {
|
|
2455
|
-
padding,
|
|
2453
|
+
padding: 35,
|
|
2456
2454
|
stroke: "transparent"
|
|
2457
2455
|
}),
|
|
2458
2456
|
grid: {
|
|
@@ -2517,7 +2515,7 @@ const clean = {
|
|
|
2517
2515
|
bar: Object.assign({
|
|
2518
2516
|
style: {
|
|
2519
2517
|
data: {
|
|
2520
|
-
fill:
|
|
2518
|
+
fill: defaultColor,
|
|
2521
2519
|
padding,
|
|
2522
2520
|
strokeWidth: 1,
|
|
2523
2521
|
fillOpacity: 0.5
|
|
@@ -2556,7 +2554,7 @@ const clean = {
|
|
|
2556
2554
|
}),
|
|
2557
2555
|
q1: {
|
|
2558
2556
|
padding,
|
|
2559
|
-
fill:
|
|
2557
|
+
fill: colorScale[0],
|
|
2560
2558
|
rx: borderRadius,
|
|
2561
2559
|
strokeWidth: 2
|
|
2562
2560
|
},
|
|
@@ -2565,7 +2563,7 @@ const clean = {
|
|
|
2565
2563
|
}),
|
|
2566
2564
|
q3: {
|
|
2567
2565
|
padding,
|
|
2568
|
-
fill:
|
|
2566
|
+
fill: colorScale[1],
|
|
2569
2567
|
rx: borderRadius
|
|
2570
2568
|
},
|
|
2571
2569
|
q3Labels: Object.assign({}, baseLabelStyles, {
|
|
@@ -2586,8 +2584,8 @@ const clean = {
|
|
|
2586
2584
|
})
|
|
2587
2585
|
},
|
|
2588
2586
|
candleColors: {
|
|
2589
|
-
positive:
|
|
2590
|
-
negative:
|
|
2587
|
+
positive: green["500"],
|
|
2588
|
+
negative: red["500"]
|
|
2591
2589
|
},
|
|
2592
2590
|
wickStrokeWidth: 2
|
|
2593
2591
|
}, baseProps),
|
|
@@ -2653,7 +2651,7 @@ const clean = {
|
|
|
2653
2651
|
data: {
|
|
2654
2652
|
fill: "transparent",
|
|
2655
2653
|
opacity: 1,
|
|
2656
|
-
stroke:
|
|
2654
|
+
stroke: defaultColor,
|
|
2657
2655
|
strokeWidth: 2,
|
|
2658
2656
|
strokeLinecap,
|
|
2659
2657
|
strokeLinejoin
|
|
@@ -2684,7 +2682,7 @@ const clean = {
|
|
|
2684
2682
|
scatter: Object.assign({
|
|
2685
2683
|
style: {
|
|
2686
2684
|
data: {
|
|
2687
|
-
fill:
|
|
2685
|
+
fill: defaultColor,
|
|
2688
2686
|
opacity: 1,
|
|
2689
2687
|
stroke: "transparent",
|
|
2690
2688
|
strokeWidth: 0
|
|
@@ -2722,9 +2720,8 @@ const clean = {
|
|
|
2722
2720
|
style: {
|
|
2723
2721
|
data: {
|
|
2724
2722
|
fill: blue["100"],
|
|
2725
|
-
stroke:
|
|
2726
|
-
strokeWidth: 2
|
|
2727
|
-
opacity: 0.4
|
|
2723
|
+
stroke: defaultColor,
|
|
2724
|
+
strokeWidth: 2
|
|
2728
2725
|
},
|
|
2729
2726
|
labels: Object.assign({}, baseLabelStyles, {
|
|
2730
2727
|
padding: 5,
|
|
@@ -8310,34 +8307,31 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
8310
8307
|
/* harmony export */ "getDomain": function() { return /* binding */ getDomain; },
|
|
8311
8308
|
/* harmony export */ "getDomainFromChildren": function() { return /* binding */ getDomainFromChildren; },
|
|
8312
8309
|
/* harmony export */ "getScale": function() { return /* binding */ getScale; },
|
|
8313
|
-
/* harmony export */ "getStringsFromCategories": function() { return /* binding */ getStringsFromCategories; },
|
|
8314
8310
|
/* harmony export */ "getStringsFromChildren": function() { return /* binding */ getStringsFromChildren; },
|
|
8311
|
+
/* harmony export */ "getStringsFromChildrenCategories": function() { return /* binding */ getStringsFromChildrenCategories; },
|
|
8315
8312
|
/* harmony export */ "getStringsFromData": function() { return /* binding */ getStringsFromData; },
|
|
8316
8313
|
/* harmony export */ "getStyle": function() { return /* binding */ getStyle; },
|
|
8317
8314
|
/* harmony export */ "getWidth": function() { return /* binding */ getWidth; }
|
|
8318
8315
|
/* harmony export */ });
|
|
8319
|
-
/* harmony import */ var
|
|
8320
|
-
/* harmony import */ var
|
|
8321
|
-
/* harmony import */ var
|
|
8322
|
-
/* harmony import */ var
|
|
8323
|
-
/* harmony import */ var
|
|
8324
|
-
/* harmony import */ var
|
|
8325
|
-
/* harmony import */ var
|
|
8326
|
-
/* harmony import */ var
|
|
8327
|
-
/* harmony import */ var
|
|
8328
|
-
/* harmony import */ var
|
|
8329
|
-
/* harmony import */ var
|
|
8330
|
-
/* harmony import */ var
|
|
8331
|
-
/* harmony import */ var
|
|
8332
|
-
/* harmony import */ var
|
|
8333
|
-
/* harmony import */ var
|
|
8334
|
-
/* harmony import */ var
|
|
8335
|
-
/* harmony import */ var
|
|
8336
|
-
/* harmony import */ var
|
|
8337
|
-
/* harmony import */ var
|
|
8338
|
-
/* harmony import */ var _scale__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./scale */ "./victory-util/scale.ts");
|
|
8339
|
-
/* harmony import */ var _log__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./log */ "./victory-util/log.ts");
|
|
8340
|
-
|
|
8316
|
+
/* 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");
|
|
8317
|
+
/* harmony import */ var lodash_uniqBy__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqBy__WEBPACK_IMPORTED_MODULE_0__);
|
|
8318
|
+
/* 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");
|
|
8319
|
+
/* harmony import */ var lodash_groupBy__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_groupBy__WEBPACK_IMPORTED_MODULE_1__);
|
|
8320
|
+
/* 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");
|
|
8321
|
+
/* harmony import */ var lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_uniq__WEBPACK_IMPORTED_MODULE_2__);
|
|
8322
|
+
/* 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");
|
|
8323
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_3__);
|
|
8324
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ "react");
|
|
8325
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__);
|
|
8326
|
+
/* harmony import */ var _axis__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./axis */ "./victory-util/axis.tsx");
|
|
8327
|
+
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./style */ "./victory-util/style.ts");
|
|
8328
|
+
/* harmony import */ var _data__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./data */ "./victory-util/data.ts");
|
|
8329
|
+
/* harmony import */ var _domain__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./domain */ "./victory-util/domain.ts");
|
|
8330
|
+
/* harmony import */ var _events__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./events */ "./victory-util/events.ts");
|
|
8331
|
+
/* harmony import */ var _collection__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./collection */ "./victory-util/collection.tsx");
|
|
8332
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./helpers */ "./victory-util/helpers.ts");
|
|
8333
|
+
/* harmony import */ var _scale__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./scale */ "./victory-util/scale.ts");
|
|
8334
|
+
/* harmony import */ var _log__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./log */ "./victory-util/log.ts");
|
|
8341
8335
|
|
|
8342
8336
|
|
|
8343
8337
|
|
|
@@ -8366,7 +8360,7 @@ function addBinsToParentPropsIfHistogram(_ref) {
|
|
|
8366
8360
|
return child.type && child.type.role === "histogram";
|
|
8367
8361
|
});
|
|
8368
8362
|
if (someChildrenAreHistograms && !allChildrenAreHistograms) {
|
|
8369
|
-
|
|
8363
|
+
_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");
|
|
8370
8364
|
}
|
|
8371
8365
|
|
|
8372
8366
|
// if we are stacking histograms, we need to generate explicit bins
|
|
@@ -8379,7 +8373,7 @@ function addBinsToParentPropsIfHistogram(_ref) {
|
|
|
8379
8373
|
// if we have explicit bins then we don't need to calculate them
|
|
8380
8374
|
if (!Array.isArray(childBins)) {
|
|
8381
8375
|
const combinedData = children.reduce((memo, child) => {
|
|
8382
|
-
const xAccessor =
|
|
8376
|
+
const xAccessor = _helpers__WEBPACK_IMPORTED_MODULE_6__.createAccessor(child.props.x || "x");
|
|
8383
8377
|
return memo.concat(child.props.data.map(datum => ({
|
|
8384
8378
|
x: xAccessor(datum)
|
|
8385
8379
|
})));
|
|
@@ -8422,7 +8416,7 @@ function getDataFromChildren(props, childComponents) {
|
|
|
8422
8416
|
maxDomain
|
|
8423
8417
|
};
|
|
8424
8418
|
let stack = 0;
|
|
8425
|
-
const children = childComponents ? childComponents.slice(0) :
|
|
8419
|
+
const children = childComponents ? childComponents.slice(0) : react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children);
|
|
8426
8420
|
parentProps = addBinsToParentPropsIfHistogram({
|
|
8427
8421
|
children,
|
|
8428
8422
|
props,
|
|
@@ -8433,13 +8427,13 @@ function getDataFromChildren(props, childComponents) {
|
|
|
8433
8427
|
const childProps = Object.assign({}, child.props, parentProps);
|
|
8434
8428
|
let childData;
|
|
8435
8429
|
let childElement = child;
|
|
8436
|
-
if (!
|
|
8430
|
+
if (!_data__WEBPACK_IMPORTED_MODULE_7__.isDataComponent(child)) {
|
|
8437
8431
|
return null;
|
|
8438
|
-
} else if (child.type &&
|
|
8439
|
-
childElement = parent ? /*#__PURE__*/
|
|
8432
|
+
} else if (child.type && _helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction(child.type.getData)) {
|
|
8433
|
+
childElement = parent ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default().cloneElement(child, parent.props) : child;
|
|
8440
8434
|
childData = childElement.type.getData(childProps);
|
|
8441
8435
|
} else {
|
|
8442
|
-
childData =
|
|
8436
|
+
childData = _data__WEBPACK_IMPORTED_MODULE_7__.getData(childProps);
|
|
8443
8437
|
}
|
|
8444
8438
|
stack += 1;
|
|
8445
8439
|
return childData.map((datum, index) => Object.assign({
|
|
@@ -8448,23 +8442,23 @@ function getDataFromChildren(props, childComponents) {
|
|
|
8448
8442
|
}, datum));
|
|
8449
8443
|
};
|
|
8450
8444
|
const stacked = children.filter(c => c.type && c.type.role === "stack").length;
|
|
8451
|
-
const combine = (memo, val) => memo.concat(
|
|
8452
|
-
const datasets =
|
|
8445
|
+
const combine = (memo, val) => memo.concat(lodash_uniqBy__WEBPACK_IMPORTED_MODULE_0___default()(val, "_group"));
|
|
8446
|
+
const datasets = _helpers__WEBPACK_IMPORTED_MODULE_6__.reduceChildren(children, iteratee, props, [], combine);
|
|
8453
8447
|
const group = stacked ? "_group" : "_stack";
|
|
8454
|
-
return Object.values(
|
|
8448
|
+
return Object.values(lodash_groupBy__WEBPACK_IMPORTED_MODULE_1___default()(datasets, group));
|
|
8455
8449
|
}
|
|
8456
8450
|
function getData(props, childComponents) {
|
|
8457
8451
|
if (props.data) {
|
|
8458
|
-
return
|
|
8452
|
+
return _data__WEBPACK_IMPORTED_MODULE_7__.getData(props);
|
|
8459
8453
|
}
|
|
8460
|
-
return getDataFromChildren(props, childComponents ||
|
|
8454
|
+
return getDataFromChildren(props, childComponents || react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children));
|
|
8461
8455
|
}
|
|
8462
8456
|
function getWidth(props, groupLength, seriesLength) {
|
|
8463
8457
|
const {
|
|
8464
8458
|
datasets,
|
|
8465
8459
|
horizontal
|
|
8466
8460
|
} = props;
|
|
8467
|
-
const range = horizontal ?
|
|
8461
|
+
const range = horizontal ? _helpers__WEBPACK_IMPORTED_MODULE_6__.getRange(props, "y") : _helpers__WEBPACK_IMPORTED_MODULE_6__.getRange(props, "x");
|
|
8468
8462
|
const extent = Math.abs(range[1] - range[0]);
|
|
8469
8463
|
const seriesLengthValue = seriesLength !== undefined ? seriesLength : Array.isArray(datasets[0]) && datasets[0].length || 1;
|
|
8470
8464
|
const groupLengthValue = groupLength || datasets.length;
|
|
@@ -8510,8 +8504,8 @@ function getDefaultDomainPadding(props, axis, childComponents) {
|
|
|
8510
8504
|
}
|
|
8511
8505
|
function getDomainFromChildren(props, axis, childComponents) {
|
|
8512
8506
|
// eslint-disable-line max-statements, complexity, max-len
|
|
8513
|
-
const children = childComponents ? childComponents.slice(0) :
|
|
8514
|
-
const parentData = props.data ?
|
|
8507
|
+
const children = childComponents ? childComponents.slice(0) : react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children);
|
|
8508
|
+
const parentData = props.data ? _data__WEBPACK_IMPORTED_MODULE_7__.getData(props) : undefined;
|
|
8515
8509
|
const {
|
|
8516
8510
|
polar,
|
|
8517
8511
|
startAngle,
|
|
@@ -8535,58 +8529,58 @@ function getDomainFromChildren(props, axis, childComponents) {
|
|
|
8535
8529
|
}) : baseParentProps;
|
|
8536
8530
|
const iteratee = child => {
|
|
8537
8531
|
const sharedProps = Object.assign({}, child.props, parentProps);
|
|
8538
|
-
if (!
|
|
8532
|
+
if (!_domain__WEBPACK_IMPORTED_MODULE_8__.isDomainComponent(child)) {
|
|
8539
8533
|
return null;
|
|
8540
|
-
} else if (child.type &&
|
|
8534
|
+
} else if (child.type && _helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction(child.type.getDomain)) {
|
|
8541
8535
|
return child.props && child.type.getDomain(sharedProps, axis);
|
|
8542
8536
|
}
|
|
8543
|
-
return
|
|
8537
|
+
return _domain__WEBPACK_IMPORTED_MODULE_8__.getDomain(sharedProps, axis);
|
|
8544
8538
|
};
|
|
8545
|
-
const childDomains =
|
|
8546
|
-
const min = childDomains.length === 0 ? 0 :
|
|
8547
|
-
const max = childDomains.length === 0 ? 1 :
|
|
8539
|
+
const childDomains = _helpers__WEBPACK_IMPORTED_MODULE_6__.reduceChildren(children, iteratee, props);
|
|
8540
|
+
const min = childDomains.length === 0 ? 0 : _collection__WEBPACK_IMPORTED_MODULE_9__.getMinValue(childDomains);
|
|
8541
|
+
const max = childDomains.length === 0 ? 1 : _collection__WEBPACK_IMPORTED_MODULE_9__.getMaxValue(childDomains);
|
|
8548
8542
|
return [min, max];
|
|
8549
8543
|
}
|
|
8550
8544
|
function getDomain(props, axis, childComponents) {
|
|
8551
|
-
const children = childComponents ||
|
|
8552
|
-
const propsDomain =
|
|
8545
|
+
const children = childComponents || react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children);
|
|
8546
|
+
const propsDomain = _domain__WEBPACK_IMPORTED_MODULE_8__.getDomainFromProps(props, axis);
|
|
8553
8547
|
const domainPadding = getDefaultDomainPadding(props, axis, children);
|
|
8554
8548
|
let domain;
|
|
8555
8549
|
if (propsDomain) {
|
|
8556
8550
|
domain = propsDomain;
|
|
8557
8551
|
} else {
|
|
8558
|
-
const minDomain =
|
|
8559
|
-
const maxDomain =
|
|
8560
|
-
const dataset = (props.data || props.y) &&
|
|
8561
|
-
const dataDomain = dataset ?
|
|
8552
|
+
const minDomain = _domain__WEBPACK_IMPORTED_MODULE_8__.getMinFromProps(props, axis);
|
|
8553
|
+
const maxDomain = _domain__WEBPACK_IMPORTED_MODULE_8__.getMaxFromProps(props, axis);
|
|
8554
|
+
const dataset = (props.data || props.y) && _data__WEBPACK_IMPORTED_MODULE_7__.getData(props);
|
|
8555
|
+
const dataDomain = dataset ? _domain__WEBPACK_IMPORTED_MODULE_8__.getDomainFromData(props, axis, dataset) : [];
|
|
8562
8556
|
const childDomain = getDomainFromChildren(props, axis, children);
|
|
8563
|
-
const min = minDomain ||
|
|
8564
|
-
const max = maxDomain ||
|
|
8565
|
-
domain =
|
|
8557
|
+
const min = minDomain || _collection__WEBPACK_IMPORTED_MODULE_9__.getMinValue([...dataDomain, ...childDomain]);
|
|
8558
|
+
const max = maxDomain || _collection__WEBPACK_IMPORTED_MODULE_9__.getMaxValue([...dataDomain, ...childDomain]);
|
|
8559
|
+
domain = _domain__WEBPACK_IMPORTED_MODULE_8__.getDomainFromMinMax(min, max);
|
|
8566
8560
|
}
|
|
8567
|
-
return
|
|
8561
|
+
return _domain__WEBPACK_IMPORTED_MODULE_8__.formatDomain(domain, Object.assign({
|
|
8568
8562
|
domainPadding
|
|
8569
8563
|
}, props), axis);
|
|
8570
8564
|
}
|
|
8571
8565
|
function getScale(props, axis, childComponents) {
|
|
8572
8566
|
if (props.data) {
|
|
8573
|
-
return
|
|
8567
|
+
return _scale__WEBPACK_IMPORTED_MODULE_10__.getBaseScale(props, axis);
|
|
8574
8568
|
}
|
|
8575
|
-
const children = childComponents ? childComponents.slice(0) :
|
|
8569
|
+
const children = childComponents ? childComponents.slice(0) : react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children);
|
|
8576
8570
|
const iteratee = child => {
|
|
8577
8571
|
const sharedProps = Object.assign({}, child.props, {
|
|
8578
8572
|
horizontal: props.horizontal
|
|
8579
8573
|
});
|
|
8580
|
-
return
|
|
8574
|
+
return _scale__WEBPACK_IMPORTED_MODULE_10__.getScaleType(sharedProps, axis);
|
|
8581
8575
|
};
|
|
8582
|
-
const childScale =
|
|
8576
|
+
const childScale = lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default()(_helpers__WEBPACK_IMPORTED_MODULE_6__.reduceChildren(children, iteratee, props));
|
|
8583
8577
|
|
|
8584
8578
|
// default to linear scale if more than one uniq scale type is given by children
|
|
8585
|
-
return childScale.length > 1 ?
|
|
8579
|
+
return childScale.length > 1 ? _scale__WEBPACK_IMPORTED_MODULE_10__.getScaleFromName("linear") : _scale__WEBPACK_IMPORTED_MODULE_10__.getScaleFromName(childScale[0]);
|
|
8586
8580
|
}
|
|
8587
8581
|
function getAllEvents(props) {
|
|
8588
8582
|
const components = ["groupComponent", "containerComponent", "labelComponent"];
|
|
8589
|
-
const componentEvents =
|
|
8583
|
+
const componentEvents = _events__WEBPACK_IMPORTED_MODULE_11__.getComponentEvents(props, components);
|
|
8590
8584
|
let events = props.events;
|
|
8591
8585
|
if (Array.isArray(componentEvents)) {
|
|
8592
8586
|
events = Array.isArray(props.events) ? componentEvents.concat(...props.events) : componentEvents;
|
|
@@ -8612,12 +8606,12 @@ function getColor(calculatedProps, child, index, theme) {
|
|
|
8612
8606
|
if (!colorScale && !color) {
|
|
8613
8607
|
return undefined;
|
|
8614
8608
|
}
|
|
8615
|
-
const colors = Array.isArray(colorScale) ? colorScale :
|
|
8609
|
+
const colors = Array.isArray(colorScale) ? colorScale : _style__WEBPACK_IMPORTED_MODULE_12__.getColorScale(colorScale, theme);
|
|
8616
8610
|
return color || colors[index % colors.length];
|
|
8617
8611
|
}
|
|
8618
8612
|
function getStyle(theme, style, role) {
|
|
8619
8613
|
const defaultStyle = theme && theme[role] && theme[role].style ? theme[role].style : {};
|
|
8620
|
-
return
|
|
8614
|
+
return _helpers__WEBPACK_IMPORTED_MODULE_6__.getStyles(style, defaultStyle);
|
|
8621
8615
|
}
|
|
8622
8616
|
|
|
8623
8617
|
// eslint-disable-next-line max-params
|
|
@@ -8641,8 +8635,8 @@ function getChildStyle(child, index, calculatedProps, theme) {
|
|
|
8641
8635
|
const dataWidth = role === "stack" ? {} : {
|
|
8642
8636
|
width: getWidth(calculatedProps)
|
|
8643
8637
|
};
|
|
8644
|
-
const dataStyle =
|
|
8645
|
-
const labelsStyle =
|
|
8638
|
+
const dataStyle = lodash_defaults__WEBPACK_IMPORTED_MODULE_3___default()({}, childStyle.data, Object.assign({}, dataWidth, style.data, defaultColor));
|
|
8639
|
+
const labelsStyle = lodash_defaults__WEBPACK_IMPORTED_MODULE_3___default()({}, childStyle.labels, style.labels);
|
|
8646
8640
|
return {
|
|
8647
8641
|
...childStyle,
|
|
8648
8642
|
parent: style.parent,
|
|
@@ -8650,28 +8644,26 @@ function getChildStyle(child, index, calculatedProps, theme) {
|
|
|
8650
8644
|
labels: labelsStyle
|
|
8651
8645
|
};
|
|
8652
8646
|
}
|
|
8653
|
-
function
|
|
8647
|
+
function getStringsFromChildrenCategories(childComponents, axis) {
|
|
8654
8648
|
const iteratee = child => {
|
|
8655
|
-
|
|
8656
|
-
if (!_domain__WEBPACK_IMPORTED_MODULE_9__.isDomainComponent(child) || !childProps.categories) {
|
|
8649
|
+
if (!_domain__WEBPACK_IMPORTED_MODULE_8__.isDomainComponent(child)) {
|
|
8657
8650
|
return null;
|
|
8658
8651
|
}
|
|
8659
|
-
const
|
|
8660
|
-
|
|
8661
|
-
return categoryStrings ? _collection__WEBPACK_IMPORTED_MODULE_10__.removeUndefined(categoryStrings) : [];
|
|
8652
|
+
const childProps = child.props || {};
|
|
8653
|
+
return _data__WEBPACK_IMPORTED_MODULE_7__.getStringsFromCategories(childProps, axis);
|
|
8662
8654
|
};
|
|
8663
|
-
return
|
|
8655
|
+
return _helpers__WEBPACK_IMPORTED_MODULE_6__.reduceChildren(childComponents.slice(0), iteratee);
|
|
8664
8656
|
}
|
|
8665
8657
|
function getStringsFromData(childComponents) {
|
|
8666
8658
|
const iteratee = child => {
|
|
8667
8659
|
const childProps = child.props || {};
|
|
8668
8660
|
let data;
|
|
8669
|
-
if (!
|
|
8661
|
+
if (!_data__WEBPACK_IMPORTED_MODULE_7__.isDataComponent(child)) {
|
|
8670
8662
|
return null;
|
|
8671
|
-
} else if (child.type &&
|
|
8663
|
+
} else if (child.type && _helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction(child.type.getData)) {
|
|
8672
8664
|
data = child.type.getData(childProps);
|
|
8673
8665
|
} else {
|
|
8674
|
-
data =
|
|
8666
|
+
data = _data__WEBPACK_IMPORTED_MODULE_7__.getData(childProps);
|
|
8675
8667
|
}
|
|
8676
8668
|
return data.map(d => ({
|
|
8677
8669
|
x: d.xName,
|
|
@@ -8690,28 +8682,28 @@ function getStringsFromData(childComponents) {
|
|
|
8690
8682
|
y: y !== undefined ? memo.y.concat(y) : memo.y
|
|
8691
8683
|
};
|
|
8692
8684
|
};
|
|
8693
|
-
return
|
|
8685
|
+
return _helpers__WEBPACK_IMPORTED_MODULE_6__.reduceChildren(childComponents.slice(0), iteratee, {}, initialMemo, combine);
|
|
8694
8686
|
}
|
|
8695
8687
|
function getCategoryAndAxisStringsFromChildren(props, axis, childComponents) {
|
|
8696
|
-
const categories =
|
|
8697
|
-
const axisComponent =
|
|
8698
|
-
const axisStrings = axisComponent ?
|
|
8699
|
-
const categoryStrings = categories
|
|
8700
|
-
return
|
|
8688
|
+
const categories = _data__WEBPACK_IMPORTED_MODULE_7__.getStringsFromCategories(props, axis);
|
|
8689
|
+
const axisComponent = _axis__WEBPACK_IMPORTED_MODULE_13__.getAxisComponent(childComponents, axis);
|
|
8690
|
+
const axisStrings = axisComponent ? _data__WEBPACK_IMPORTED_MODULE_7__.getStringsFromAxes(axisComponent.props, axis) : [];
|
|
8691
|
+
const categoryStrings = categories.length ? categories : getStringsFromChildrenCategories(childComponents, axis);
|
|
8692
|
+
return lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default()([...categoryStrings, ...axisStrings].flat());
|
|
8701
8693
|
}
|
|
8702
8694
|
function getStringsFromChildren(props, childComponents) {
|
|
8703
|
-
const children = childComponents ||
|
|
8695
|
+
const children = childComponents || react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children);
|
|
8704
8696
|
const xStrings = getCategoryAndAxisStringsFromChildren(props, "x", children);
|
|
8705
8697
|
const yStrings = getCategoryAndAxisStringsFromChildren(props, "y", children);
|
|
8706
8698
|
const dataStrings = getStringsFromData(children);
|
|
8707
8699
|
return {
|
|
8708
|
-
x:
|
|
8709
|
-
y:
|
|
8700
|
+
x: lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default()([...xStrings, ...dataStrings.x].flat()),
|
|
8701
|
+
y: lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default()([...yStrings, ...dataStrings.y].flat())
|
|
8710
8702
|
};
|
|
8711
8703
|
}
|
|
8712
8704
|
function getCategories(props, childComponents, allStrings) {
|
|
8713
|
-
const xPropCategories = props.categories &&
|
|
8714
|
-
const yPropCategories = props.categories &&
|
|
8705
|
+
const xPropCategories = props.categories && _data__WEBPACK_IMPORTED_MODULE_7__.getStringsFromCategories(props, "x");
|
|
8706
|
+
const yPropCategories = props.categories && _data__WEBPACK_IMPORTED_MODULE_7__.getStringsFromCategories(props, "y");
|
|
8715
8707
|
const fallbackRequired = !xPropCategories || !yPropCategories;
|
|
8716
8708
|
const fallbackProps = fallbackRequired ? allStrings || getStringsFromChildren(props, childComponents) : {};
|
|
8717
8709
|
const xCategories = xPropCategories || fallbackProps.x;
|