victory-create-container 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 +8 -0
- package/dist/victory-create-container.js +111 -117
- package/dist/victory-create-container.min.js +1 -1
- package/es/create-container.d.ts +9 -9
- package/es/create-container.js +2 -0
- package/lib/create-container.d.ts +9 -9
- package/lib/create-container.js +2 -0
- package/package.json +7 -7
- package/src/create-container.tsx +20 -10
package/CHANGELOG.md
CHANGED
|
@@ -121,6 +121,8 @@ const CONTAINER_COMPONENTS_WEB = {
|
|
|
121
121
|
voronoi: victory_voronoi_container__WEBPACK_IMPORTED_MODULE_9__.VictoryVoronoiContainer
|
|
122
122
|
};
|
|
123
123
|
function makeCreateContainerFunction(containerComponents, VictoryContainerBase) {
|
|
124
|
+
// Helper type to support backwards compatibility with old types
|
|
125
|
+
|
|
124
126
|
return function combineContainers(containerA, containerB) {
|
|
125
127
|
const ContainerA = containerComponents[containerA];
|
|
126
128
|
const ContainerB = containerComponents[containerB];
|
|
@@ -8200,7 +8202,7 @@ const VictoryPortal = initialProps => {
|
|
|
8200
8202
|
...defaultProps,
|
|
8201
8203
|
...initialProps
|
|
8202
8204
|
};
|
|
8203
|
-
const id = lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default()();
|
|
8205
|
+
const [id] = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default()());
|
|
8204
8206
|
const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_3__.usePortalContext)();
|
|
8205
8207
|
if (!portalContext) {
|
|
8206
8208
|
const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
|
|
@@ -8611,20 +8613,16 @@ const orange = {
|
|
|
8611
8613
|
"100": "#FEE2D5",
|
|
8612
8614
|
"300": "#FFA981",
|
|
8613
8615
|
"500": "#FF6F2C",
|
|
8616
|
+
"700": "#FF4E1B",
|
|
8614
8617
|
"900": "#D74D26"
|
|
8615
8618
|
};
|
|
8616
8619
|
const red = {
|
|
8617
8620
|
"100": "#FFDCE5",
|
|
8618
8621
|
"300": "#FF9EB7",
|
|
8619
8622
|
"500": "#F82B60",
|
|
8623
|
+
"700": "#D31A3D",
|
|
8620
8624
|
"900": "#BA1E45"
|
|
8621
8625
|
};
|
|
8622
|
-
const pink = {
|
|
8623
|
-
"100": "#FFDAF6",
|
|
8624
|
-
"300": "#F99DE2",
|
|
8625
|
-
"500": "#FF08C2",
|
|
8626
|
-
"900": "#B2158B"
|
|
8627
|
-
};
|
|
8628
8626
|
const purple = {
|
|
8629
8627
|
"100": "#EDE3FE",
|
|
8630
8628
|
"300": "#CDB0FF",
|
|
@@ -8635,6 +8633,7 @@ const blue = {
|
|
|
8635
8633
|
"100": "#CFDFFF",
|
|
8636
8634
|
"300": "#9CC7FF",
|
|
8637
8635
|
"500": "#2D7FF9",
|
|
8636
|
+
"700": "#0056B3",
|
|
8638
8637
|
"900": "#2750AE"
|
|
8639
8638
|
};
|
|
8640
8639
|
const cyan = {
|
|
@@ -8653,27 +8652,28 @@ const green = {
|
|
|
8653
8652
|
"100": "#D1F7C4",
|
|
8654
8653
|
"300": "#93E088",
|
|
8655
8654
|
"500": "#20C933",
|
|
8655
|
+
"700": "#1B9B2A",
|
|
8656
8656
|
"900": "#338A17"
|
|
8657
8657
|
};
|
|
8658
8658
|
const colors = {
|
|
8659
8659
|
blue: blue["500"],
|
|
8660
|
-
|
|
8661
|
-
teal: teal["500"],
|
|
8662
|
-
purple: purple["500"],
|
|
8660
|
+
cyan: cyan["500"],
|
|
8663
8661
|
green: green["500"],
|
|
8662
|
+
yellow: yellow["500"],
|
|
8664
8663
|
orange: orange["500"],
|
|
8665
|
-
cyan: cyan["500"],
|
|
8666
8664
|
red: red["500"],
|
|
8667
|
-
|
|
8665
|
+
purple: purple["500"],
|
|
8666
|
+
teal: teal["500"]
|
|
8668
8667
|
};
|
|
8669
8668
|
const colorScale = Object.values(colors);
|
|
8670
|
-
const grayscale = [gray["
|
|
8671
|
-
const warm = [yellow["500"], orange["500"],
|
|
8672
|
-
const cool = [
|
|
8673
|
-
const heatmap = [green["500"], yellow["500"], red["500"]];
|
|
8674
|
-
const redPalette =
|
|
8675
|
-
const greenPalette =
|
|
8676
|
-
const bluePalette =
|
|
8669
|
+
const grayscale = [gray["100"], gray["300"], gray["500"], gray["700"], gray["900"]];
|
|
8670
|
+
const warm = [yellow["300"], yellow["500"], orange["500"], orange["900"], red["500"]];
|
|
8671
|
+
const cool = [purple["500"], blue["500"], cyan["500"], teal["500"], green["500"]];
|
|
8672
|
+
const heatmap = [green["900"], green["500"], yellow["500"], orange["500"], red["500"]];
|
|
8673
|
+
const redPalette = Object.values(red);
|
|
8674
|
+
const greenPalette = Object.values(green);
|
|
8675
|
+
const bluePalette = Object.values(blue);
|
|
8676
|
+
const defaultColor = blue["500"];
|
|
8677
8677
|
|
|
8678
8678
|
// *
|
|
8679
8679
|
// * Typography
|
|
@@ -8688,7 +8688,7 @@ const padding = 8;
|
|
|
8688
8688
|
const baseProps = {
|
|
8689
8689
|
width: 450,
|
|
8690
8690
|
height: 300,
|
|
8691
|
-
padding:
|
|
8691
|
+
padding: 60,
|
|
8692
8692
|
colorScale
|
|
8693
8693
|
};
|
|
8694
8694
|
// *
|
|
@@ -8732,7 +8732,7 @@ const clean = {
|
|
|
8732
8732
|
area: Object.assign({
|
|
8733
8733
|
style: {
|
|
8734
8734
|
data: {
|
|
8735
|
-
fill:
|
|
8735
|
+
fill: defaultColor,
|
|
8736
8736
|
strokeWidth: 2,
|
|
8737
8737
|
fillOpacity: 0.5
|
|
8738
8738
|
},
|
|
@@ -8749,7 +8749,7 @@ const clean = {
|
|
|
8749
8749
|
strokeLinejoin
|
|
8750
8750
|
},
|
|
8751
8751
|
axisLabel: Object.assign({}, centeredLabelStyles, {
|
|
8752
|
-
padding,
|
|
8752
|
+
padding: 35,
|
|
8753
8753
|
stroke: "transparent"
|
|
8754
8754
|
}),
|
|
8755
8755
|
grid: {
|
|
@@ -8814,7 +8814,7 @@ const clean = {
|
|
|
8814
8814
|
bar: Object.assign({
|
|
8815
8815
|
style: {
|
|
8816
8816
|
data: {
|
|
8817
|
-
fill:
|
|
8817
|
+
fill: defaultColor,
|
|
8818
8818
|
padding,
|
|
8819
8819
|
strokeWidth: 1,
|
|
8820
8820
|
fillOpacity: 0.5
|
|
@@ -8853,7 +8853,7 @@ const clean = {
|
|
|
8853
8853
|
}),
|
|
8854
8854
|
q1: {
|
|
8855
8855
|
padding,
|
|
8856
|
-
fill:
|
|
8856
|
+
fill: colorScale[0],
|
|
8857
8857
|
rx: borderRadius,
|
|
8858
8858
|
strokeWidth: 2
|
|
8859
8859
|
},
|
|
@@ -8862,7 +8862,7 @@ const clean = {
|
|
|
8862
8862
|
}),
|
|
8863
8863
|
q3: {
|
|
8864
8864
|
padding,
|
|
8865
|
-
fill:
|
|
8865
|
+
fill: colorScale[1],
|
|
8866
8866
|
rx: borderRadius
|
|
8867
8867
|
},
|
|
8868
8868
|
q3Labels: Object.assign({}, baseLabelStyles, {
|
|
@@ -8883,8 +8883,8 @@ const clean = {
|
|
|
8883
8883
|
})
|
|
8884
8884
|
},
|
|
8885
8885
|
candleColors: {
|
|
8886
|
-
positive:
|
|
8887
|
-
negative:
|
|
8886
|
+
positive: green["500"],
|
|
8887
|
+
negative: red["500"]
|
|
8888
8888
|
},
|
|
8889
8889
|
wickStrokeWidth: 2
|
|
8890
8890
|
}, baseProps),
|
|
@@ -8950,7 +8950,7 @@ const clean = {
|
|
|
8950
8950
|
data: {
|
|
8951
8951
|
fill: "transparent",
|
|
8952
8952
|
opacity: 1,
|
|
8953
|
-
stroke:
|
|
8953
|
+
stroke: defaultColor,
|
|
8954
8954
|
strokeWidth: 2,
|
|
8955
8955
|
strokeLinecap,
|
|
8956
8956
|
strokeLinejoin
|
|
@@ -8981,7 +8981,7 @@ const clean = {
|
|
|
8981
8981
|
scatter: Object.assign({
|
|
8982
8982
|
style: {
|
|
8983
8983
|
data: {
|
|
8984
|
-
fill:
|
|
8984
|
+
fill: defaultColor,
|
|
8985
8985
|
opacity: 1,
|
|
8986
8986
|
stroke: "transparent",
|
|
8987
8987
|
strokeWidth: 0
|
|
@@ -9019,9 +9019,8 @@ const clean = {
|
|
|
9019
9019
|
style: {
|
|
9020
9020
|
data: {
|
|
9021
9021
|
fill: blue["100"],
|
|
9022
|
-
stroke:
|
|
9023
|
-
strokeWidth: 2
|
|
9024
|
-
opacity: 0.4
|
|
9022
|
+
stroke: defaultColor,
|
|
9023
|
+
strokeWidth: 2
|
|
9025
9024
|
},
|
|
9026
9025
|
labels: Object.assign({}, baseLabelStyles, {
|
|
9027
9026
|
padding: 5,
|
|
@@ -13040,34 +13039,31 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
13040
13039
|
/* harmony export */ "getDomain": function() { return /* binding */ getDomain; },
|
|
13041
13040
|
/* harmony export */ "getDomainFromChildren": function() { return /* binding */ getDomainFromChildren; },
|
|
13042
13041
|
/* harmony export */ "getScale": function() { return /* binding */ getScale; },
|
|
13043
|
-
/* harmony export */ "getStringsFromCategories": function() { return /* binding */ getStringsFromCategories; },
|
|
13044
13042
|
/* harmony export */ "getStringsFromChildren": function() { return /* binding */ getStringsFromChildren; },
|
|
13043
|
+
/* harmony export */ "getStringsFromChildrenCategories": function() { return /* binding */ getStringsFromChildrenCategories; },
|
|
13045
13044
|
/* harmony export */ "getStringsFromData": function() { return /* binding */ getStringsFromData; },
|
|
13046
13045
|
/* harmony export */ "getStyle": function() { return /* binding */ getStyle; },
|
|
13047
13046
|
/* harmony export */ "getWidth": function() { return /* binding */ getWidth; }
|
|
13048
13047
|
/* harmony export */ });
|
|
13049
|
-
/* harmony import */ var
|
|
13050
|
-
/* harmony import */ var
|
|
13051
|
-
/* harmony import */ var
|
|
13052
|
-
/* harmony import */ var
|
|
13053
|
-
/* harmony import */ var
|
|
13054
|
-
/* harmony import */ var
|
|
13055
|
-
/* harmony import */ var
|
|
13056
|
-
/* harmony import */ var
|
|
13057
|
-
/* harmony import */ var
|
|
13058
|
-
/* harmony import */ var
|
|
13059
|
-
/* harmony import */ var
|
|
13060
|
-
/* harmony import */ var
|
|
13061
|
-
/* harmony import */ var
|
|
13062
|
-
/* harmony import */ var
|
|
13063
|
-
/* harmony import */ var
|
|
13064
|
-
/* harmony import */ var
|
|
13065
|
-
/* harmony import */ var
|
|
13066
|
-
/* harmony import */ var
|
|
13067
|
-
/* harmony import */ var
|
|
13068
|
-
/* harmony import */ var _scale__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./scale */ "../../victory-core/es/victory-util/scale.js");
|
|
13069
|
-
/* harmony import */ var _log__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./log */ "../../victory-core/es/victory-util/log.js");
|
|
13070
|
-
|
|
13048
|
+
/* 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");
|
|
13049
|
+
/* harmony import */ var lodash_uniqBy__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqBy__WEBPACK_IMPORTED_MODULE_0__);
|
|
13050
|
+
/* 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");
|
|
13051
|
+
/* harmony import */ var lodash_groupBy__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_groupBy__WEBPACK_IMPORTED_MODULE_1__);
|
|
13052
|
+
/* 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");
|
|
13053
|
+
/* harmony import */ var lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_uniq__WEBPACK_IMPORTED_MODULE_2__);
|
|
13054
|
+
/* 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");
|
|
13055
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_3__);
|
|
13056
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ "react");
|
|
13057
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__);
|
|
13058
|
+
/* harmony import */ var _axis__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./axis */ "../../victory-core/es/victory-util/axis.js");
|
|
13059
|
+
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./style */ "../../victory-core/es/victory-util/style.js");
|
|
13060
|
+
/* harmony import */ var _data__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./data */ "../../victory-core/es/victory-util/data.js");
|
|
13061
|
+
/* harmony import */ var _domain__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./domain */ "../../victory-core/es/victory-util/domain.js");
|
|
13062
|
+
/* harmony import */ var _events__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./events */ "../../victory-core/es/victory-util/events.js");
|
|
13063
|
+
/* harmony import */ var _collection__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./collection */ "../../victory-core/es/victory-util/collection.js");
|
|
13064
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
13065
|
+
/* harmony import */ var _scale__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./scale */ "../../victory-core/es/victory-util/scale.js");
|
|
13066
|
+
/* harmony import */ var _log__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./log */ "../../victory-core/es/victory-util/log.js");
|
|
13071
13067
|
|
|
13072
13068
|
|
|
13073
13069
|
|
|
@@ -13096,7 +13092,7 @@ function addBinsToParentPropsIfHistogram(_ref) {
|
|
|
13096
13092
|
return child.type && child.type.role === "histogram";
|
|
13097
13093
|
});
|
|
13098
13094
|
if (someChildrenAreHistograms && !allChildrenAreHistograms) {
|
|
13099
|
-
|
|
13095
|
+
_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");
|
|
13100
13096
|
}
|
|
13101
13097
|
|
|
13102
13098
|
// if we are stacking histograms, we need to generate explicit bins
|
|
@@ -13109,7 +13105,7 @@ function addBinsToParentPropsIfHistogram(_ref) {
|
|
|
13109
13105
|
// if we have explicit bins then we don't need to calculate them
|
|
13110
13106
|
if (!Array.isArray(childBins)) {
|
|
13111
13107
|
const combinedData = children.reduce((memo, child) => {
|
|
13112
|
-
const xAccessor =
|
|
13108
|
+
const xAccessor = _helpers__WEBPACK_IMPORTED_MODULE_6__.createAccessor(child.props.x || "x");
|
|
13113
13109
|
return memo.concat(child.props.data.map(datum => ({
|
|
13114
13110
|
x: xAccessor(datum)
|
|
13115
13111
|
})));
|
|
@@ -13152,7 +13148,7 @@ function getDataFromChildren(props, childComponents) {
|
|
|
13152
13148
|
maxDomain
|
|
13153
13149
|
};
|
|
13154
13150
|
let stack = 0;
|
|
13155
|
-
const children = childComponents ? childComponents.slice(0) :
|
|
13151
|
+
const children = childComponents ? childComponents.slice(0) : react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children);
|
|
13156
13152
|
parentProps = addBinsToParentPropsIfHistogram({
|
|
13157
13153
|
children,
|
|
13158
13154
|
props,
|
|
@@ -13163,13 +13159,13 @@ function getDataFromChildren(props, childComponents) {
|
|
|
13163
13159
|
const childProps = Object.assign({}, child.props, parentProps);
|
|
13164
13160
|
let childData;
|
|
13165
13161
|
let childElement = child;
|
|
13166
|
-
if (!
|
|
13162
|
+
if (!_data__WEBPACK_IMPORTED_MODULE_7__.isDataComponent(child)) {
|
|
13167
13163
|
return null;
|
|
13168
|
-
} else if (child.type &&
|
|
13169
|
-
childElement = parent ? /*#__PURE__*/
|
|
13164
|
+
} else if (child.type && _helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction(child.type.getData)) {
|
|
13165
|
+
childElement = parent ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default().cloneElement(child, parent.props) : child;
|
|
13170
13166
|
childData = childElement.type.getData(childProps);
|
|
13171
13167
|
} else {
|
|
13172
|
-
childData =
|
|
13168
|
+
childData = _data__WEBPACK_IMPORTED_MODULE_7__.getData(childProps);
|
|
13173
13169
|
}
|
|
13174
13170
|
stack += 1;
|
|
13175
13171
|
return childData.map((datum, index) => Object.assign({
|
|
@@ -13178,23 +13174,23 @@ function getDataFromChildren(props, childComponents) {
|
|
|
13178
13174
|
}, datum));
|
|
13179
13175
|
};
|
|
13180
13176
|
const stacked = children.filter(c => c.type && c.type.role === "stack").length;
|
|
13181
|
-
const combine = (memo, val) => memo.concat(
|
|
13182
|
-
const datasets =
|
|
13177
|
+
const combine = (memo, val) => memo.concat(lodash_uniqBy__WEBPACK_IMPORTED_MODULE_0___default()(val, "_group"));
|
|
13178
|
+
const datasets = _helpers__WEBPACK_IMPORTED_MODULE_6__.reduceChildren(children, iteratee, props, [], combine);
|
|
13183
13179
|
const group = stacked ? "_group" : "_stack";
|
|
13184
|
-
return Object.values(
|
|
13180
|
+
return Object.values(lodash_groupBy__WEBPACK_IMPORTED_MODULE_1___default()(datasets, group));
|
|
13185
13181
|
}
|
|
13186
13182
|
function getData(props, childComponents) {
|
|
13187
13183
|
if (props.data) {
|
|
13188
|
-
return
|
|
13184
|
+
return _data__WEBPACK_IMPORTED_MODULE_7__.getData(props);
|
|
13189
13185
|
}
|
|
13190
|
-
return getDataFromChildren(props, childComponents ||
|
|
13186
|
+
return getDataFromChildren(props, childComponents || react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children));
|
|
13191
13187
|
}
|
|
13192
13188
|
function getWidth(props, groupLength, seriesLength) {
|
|
13193
13189
|
const {
|
|
13194
13190
|
datasets,
|
|
13195
13191
|
horizontal
|
|
13196
13192
|
} = props;
|
|
13197
|
-
const range = horizontal ?
|
|
13193
|
+
const range = horizontal ? _helpers__WEBPACK_IMPORTED_MODULE_6__.getRange(props, "y") : _helpers__WEBPACK_IMPORTED_MODULE_6__.getRange(props, "x");
|
|
13198
13194
|
const extent = Math.abs(range[1] - range[0]);
|
|
13199
13195
|
const seriesLengthValue = seriesLength !== undefined ? seriesLength : Array.isArray(datasets[0]) && datasets[0].length || 1;
|
|
13200
13196
|
const groupLengthValue = groupLength || datasets.length;
|
|
@@ -13240,8 +13236,8 @@ function getDefaultDomainPadding(props, axis, childComponents) {
|
|
|
13240
13236
|
}
|
|
13241
13237
|
function getDomainFromChildren(props, axis, childComponents) {
|
|
13242
13238
|
// eslint-disable-line max-statements, complexity, max-len
|
|
13243
|
-
const children = childComponents ? childComponents.slice(0) :
|
|
13244
|
-
const parentData = props.data ?
|
|
13239
|
+
const children = childComponents ? childComponents.slice(0) : react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children);
|
|
13240
|
+
const parentData = props.data ? _data__WEBPACK_IMPORTED_MODULE_7__.getData(props) : undefined;
|
|
13245
13241
|
const {
|
|
13246
13242
|
polar,
|
|
13247
13243
|
startAngle,
|
|
@@ -13265,58 +13261,58 @@ function getDomainFromChildren(props, axis, childComponents) {
|
|
|
13265
13261
|
}) : baseParentProps;
|
|
13266
13262
|
const iteratee = child => {
|
|
13267
13263
|
const sharedProps = Object.assign({}, child.props, parentProps);
|
|
13268
|
-
if (!
|
|
13264
|
+
if (!_domain__WEBPACK_IMPORTED_MODULE_8__.isDomainComponent(child)) {
|
|
13269
13265
|
return null;
|
|
13270
|
-
} else if (child.type &&
|
|
13266
|
+
} else if (child.type && _helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction(child.type.getDomain)) {
|
|
13271
13267
|
return child.props && child.type.getDomain(sharedProps, axis);
|
|
13272
13268
|
}
|
|
13273
|
-
return
|
|
13269
|
+
return _domain__WEBPACK_IMPORTED_MODULE_8__.getDomain(sharedProps, axis);
|
|
13274
13270
|
};
|
|
13275
|
-
const childDomains =
|
|
13276
|
-
const min = childDomains.length === 0 ? 0 :
|
|
13277
|
-
const max = childDomains.length === 0 ? 1 :
|
|
13271
|
+
const childDomains = _helpers__WEBPACK_IMPORTED_MODULE_6__.reduceChildren(children, iteratee, props);
|
|
13272
|
+
const min = childDomains.length === 0 ? 0 : _collection__WEBPACK_IMPORTED_MODULE_9__.getMinValue(childDomains);
|
|
13273
|
+
const max = childDomains.length === 0 ? 1 : _collection__WEBPACK_IMPORTED_MODULE_9__.getMaxValue(childDomains);
|
|
13278
13274
|
return [min, max];
|
|
13279
13275
|
}
|
|
13280
13276
|
function getDomain(props, axis, childComponents) {
|
|
13281
|
-
const children = childComponents ||
|
|
13282
|
-
const propsDomain =
|
|
13277
|
+
const children = childComponents || react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children);
|
|
13278
|
+
const propsDomain = _domain__WEBPACK_IMPORTED_MODULE_8__.getDomainFromProps(props, axis);
|
|
13283
13279
|
const domainPadding = getDefaultDomainPadding(props, axis, children);
|
|
13284
13280
|
let domain;
|
|
13285
13281
|
if (propsDomain) {
|
|
13286
13282
|
domain = propsDomain;
|
|
13287
13283
|
} else {
|
|
13288
|
-
const minDomain =
|
|
13289
|
-
const maxDomain =
|
|
13290
|
-
const dataset = (props.data || props.y) &&
|
|
13291
|
-
const dataDomain = dataset ?
|
|
13284
|
+
const minDomain = _domain__WEBPACK_IMPORTED_MODULE_8__.getMinFromProps(props, axis);
|
|
13285
|
+
const maxDomain = _domain__WEBPACK_IMPORTED_MODULE_8__.getMaxFromProps(props, axis);
|
|
13286
|
+
const dataset = (props.data || props.y) && _data__WEBPACK_IMPORTED_MODULE_7__.getData(props);
|
|
13287
|
+
const dataDomain = dataset ? _domain__WEBPACK_IMPORTED_MODULE_8__.getDomainFromData(props, axis, dataset) : [];
|
|
13292
13288
|
const childDomain = getDomainFromChildren(props, axis, children);
|
|
13293
|
-
const min = minDomain ||
|
|
13294
|
-
const max = maxDomain ||
|
|
13295
|
-
domain =
|
|
13289
|
+
const min = minDomain || _collection__WEBPACK_IMPORTED_MODULE_9__.getMinValue([...dataDomain, ...childDomain]);
|
|
13290
|
+
const max = maxDomain || _collection__WEBPACK_IMPORTED_MODULE_9__.getMaxValue([...dataDomain, ...childDomain]);
|
|
13291
|
+
domain = _domain__WEBPACK_IMPORTED_MODULE_8__.getDomainFromMinMax(min, max);
|
|
13296
13292
|
}
|
|
13297
|
-
return
|
|
13293
|
+
return _domain__WEBPACK_IMPORTED_MODULE_8__.formatDomain(domain, Object.assign({
|
|
13298
13294
|
domainPadding
|
|
13299
13295
|
}, props), axis);
|
|
13300
13296
|
}
|
|
13301
13297
|
function getScale(props, axis, childComponents) {
|
|
13302
13298
|
if (props.data) {
|
|
13303
|
-
return
|
|
13299
|
+
return _scale__WEBPACK_IMPORTED_MODULE_10__.getBaseScale(props, axis);
|
|
13304
13300
|
}
|
|
13305
|
-
const children = childComponents ? childComponents.slice(0) :
|
|
13301
|
+
const children = childComponents ? childComponents.slice(0) : react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children);
|
|
13306
13302
|
const iteratee = child => {
|
|
13307
13303
|
const sharedProps = Object.assign({}, child.props, {
|
|
13308
13304
|
horizontal: props.horizontal
|
|
13309
13305
|
});
|
|
13310
|
-
return
|
|
13306
|
+
return _scale__WEBPACK_IMPORTED_MODULE_10__.getScaleType(sharedProps, axis);
|
|
13311
13307
|
};
|
|
13312
|
-
const childScale =
|
|
13308
|
+
const childScale = lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default()(_helpers__WEBPACK_IMPORTED_MODULE_6__.reduceChildren(children, iteratee, props));
|
|
13313
13309
|
|
|
13314
13310
|
// default to linear scale if more than one uniq scale type is given by children
|
|
13315
|
-
return childScale.length > 1 ?
|
|
13311
|
+
return childScale.length > 1 ? _scale__WEBPACK_IMPORTED_MODULE_10__.getScaleFromName("linear") : _scale__WEBPACK_IMPORTED_MODULE_10__.getScaleFromName(childScale[0]);
|
|
13316
13312
|
}
|
|
13317
13313
|
function getAllEvents(props) {
|
|
13318
13314
|
const components = ["groupComponent", "containerComponent", "labelComponent"];
|
|
13319
|
-
const componentEvents =
|
|
13315
|
+
const componentEvents = _events__WEBPACK_IMPORTED_MODULE_11__.getComponentEvents(props, components);
|
|
13320
13316
|
let events = props.events;
|
|
13321
13317
|
if (Array.isArray(componentEvents)) {
|
|
13322
13318
|
events = Array.isArray(props.events) ? componentEvents.concat(...props.events) : componentEvents;
|
|
@@ -13342,12 +13338,12 @@ function getColor(calculatedProps, child, index, theme) {
|
|
|
13342
13338
|
if (!colorScale && !color) {
|
|
13343
13339
|
return undefined;
|
|
13344
13340
|
}
|
|
13345
|
-
const colors = Array.isArray(colorScale) ? colorScale :
|
|
13341
|
+
const colors = Array.isArray(colorScale) ? colorScale : _style__WEBPACK_IMPORTED_MODULE_12__.getColorScale(colorScale, theme);
|
|
13346
13342
|
return color || colors[index % colors.length];
|
|
13347
13343
|
}
|
|
13348
13344
|
function getStyle(theme, style, role) {
|
|
13349
13345
|
const defaultStyle = theme && theme[role] && theme[role].style ? theme[role].style : {};
|
|
13350
|
-
return
|
|
13346
|
+
return _helpers__WEBPACK_IMPORTED_MODULE_6__.getStyles(style, defaultStyle);
|
|
13351
13347
|
}
|
|
13352
13348
|
|
|
13353
13349
|
// eslint-disable-next-line max-params
|
|
@@ -13371,8 +13367,8 @@ function getChildStyle(child, index, calculatedProps, theme) {
|
|
|
13371
13367
|
const dataWidth = role === "stack" ? {} : {
|
|
13372
13368
|
width: getWidth(calculatedProps)
|
|
13373
13369
|
};
|
|
13374
|
-
const dataStyle =
|
|
13375
|
-
const labelsStyle =
|
|
13370
|
+
const dataStyle = lodash_defaults__WEBPACK_IMPORTED_MODULE_3___default()({}, childStyle.data, Object.assign({}, dataWidth, style.data, defaultColor));
|
|
13371
|
+
const labelsStyle = lodash_defaults__WEBPACK_IMPORTED_MODULE_3___default()({}, childStyle.labels, style.labels);
|
|
13376
13372
|
return {
|
|
13377
13373
|
...childStyle,
|
|
13378
13374
|
parent: style.parent,
|
|
@@ -13380,28 +13376,26 @@ function getChildStyle(child, index, calculatedProps, theme) {
|
|
|
13380
13376
|
labels: labelsStyle
|
|
13381
13377
|
};
|
|
13382
13378
|
}
|
|
13383
|
-
function
|
|
13379
|
+
function getStringsFromChildrenCategories(childComponents, axis) {
|
|
13384
13380
|
const iteratee = child => {
|
|
13385
|
-
|
|
13386
|
-
if (!_domain__WEBPACK_IMPORTED_MODULE_9__.isDomainComponent(child) || !childProps.categories) {
|
|
13381
|
+
if (!_domain__WEBPACK_IMPORTED_MODULE_8__.isDomainComponent(child)) {
|
|
13387
13382
|
return null;
|
|
13388
13383
|
}
|
|
13389
|
-
const
|
|
13390
|
-
|
|
13391
|
-
return categoryStrings ? _collection__WEBPACK_IMPORTED_MODULE_10__.removeUndefined(categoryStrings) : [];
|
|
13384
|
+
const childProps = child.props || {};
|
|
13385
|
+
return _data__WEBPACK_IMPORTED_MODULE_7__.getStringsFromCategories(childProps, axis);
|
|
13392
13386
|
};
|
|
13393
|
-
return
|
|
13387
|
+
return _helpers__WEBPACK_IMPORTED_MODULE_6__.reduceChildren(childComponents.slice(0), iteratee);
|
|
13394
13388
|
}
|
|
13395
13389
|
function getStringsFromData(childComponents) {
|
|
13396
13390
|
const iteratee = child => {
|
|
13397
13391
|
const childProps = child.props || {};
|
|
13398
13392
|
let data;
|
|
13399
|
-
if (!
|
|
13393
|
+
if (!_data__WEBPACK_IMPORTED_MODULE_7__.isDataComponent(child)) {
|
|
13400
13394
|
return null;
|
|
13401
|
-
} else if (child.type &&
|
|
13395
|
+
} else if (child.type && _helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction(child.type.getData)) {
|
|
13402
13396
|
data = child.type.getData(childProps);
|
|
13403
13397
|
} else {
|
|
13404
|
-
data =
|
|
13398
|
+
data = _data__WEBPACK_IMPORTED_MODULE_7__.getData(childProps);
|
|
13405
13399
|
}
|
|
13406
13400
|
return data.map(d => ({
|
|
13407
13401
|
x: d.xName,
|
|
@@ -13420,28 +13414,28 @@ function getStringsFromData(childComponents) {
|
|
|
13420
13414
|
y: y !== undefined ? memo.y.concat(y) : memo.y
|
|
13421
13415
|
};
|
|
13422
13416
|
};
|
|
13423
|
-
return
|
|
13417
|
+
return _helpers__WEBPACK_IMPORTED_MODULE_6__.reduceChildren(childComponents.slice(0), iteratee, {}, initialMemo, combine);
|
|
13424
13418
|
}
|
|
13425
13419
|
function getCategoryAndAxisStringsFromChildren(props, axis, childComponents) {
|
|
13426
|
-
const categories =
|
|
13427
|
-
const axisComponent =
|
|
13428
|
-
const axisStrings = axisComponent ?
|
|
13429
|
-
const categoryStrings = categories
|
|
13430
|
-
return
|
|
13420
|
+
const categories = _data__WEBPACK_IMPORTED_MODULE_7__.getStringsFromCategories(props, axis);
|
|
13421
|
+
const axisComponent = _axis__WEBPACK_IMPORTED_MODULE_13__.getAxisComponent(childComponents, axis);
|
|
13422
|
+
const axisStrings = axisComponent ? _data__WEBPACK_IMPORTED_MODULE_7__.getStringsFromAxes(axisComponent.props, axis) : [];
|
|
13423
|
+
const categoryStrings = categories.length ? categories : getStringsFromChildrenCategories(childComponents, axis);
|
|
13424
|
+
return lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default()([...categoryStrings, ...axisStrings].flat());
|
|
13431
13425
|
}
|
|
13432
13426
|
function getStringsFromChildren(props, childComponents) {
|
|
13433
|
-
const children = childComponents ||
|
|
13427
|
+
const children = childComponents || react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children);
|
|
13434
13428
|
const xStrings = getCategoryAndAxisStringsFromChildren(props, "x", children);
|
|
13435
13429
|
const yStrings = getCategoryAndAxisStringsFromChildren(props, "y", children);
|
|
13436
13430
|
const dataStrings = getStringsFromData(children);
|
|
13437
13431
|
return {
|
|
13438
|
-
x:
|
|
13439
|
-
y:
|
|
13432
|
+
x: lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default()([...xStrings, ...dataStrings.x].flat()),
|
|
13433
|
+
y: lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default()([...yStrings, ...dataStrings.y].flat())
|
|
13440
13434
|
};
|
|
13441
13435
|
}
|
|
13442
13436
|
function getCategories(props, childComponents, allStrings) {
|
|
13443
|
-
const xPropCategories = props.categories &&
|
|
13444
|
-
const yPropCategories = props.categories &&
|
|
13437
|
+
const xPropCategories = props.categories && _data__WEBPACK_IMPORTED_MODULE_7__.getStringsFromCategories(props, "x");
|
|
13438
|
+
const yPropCategories = props.categories && _data__WEBPACK_IMPORTED_MODULE_7__.getStringsFromCategories(props, "y");
|
|
13445
13439
|
const fallbackRequired = !xPropCategories || !yPropCategories;
|
|
13446
13440
|
const fallbackProps = fallbackRequired ? allStrings || getStringsFromChildren(props, childComponents) : {};
|
|
13447
13441
|
const xCategories = xPropCategories || fallbackProps.x;
|