@mui/x-charts 6.18.2 → 6.18.4
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/BarChart/BarElement.d.ts +5 -1
- package/BarChart/BarElement.js +24 -1
- package/BarChart/BarPlot.js +7 -6
- package/BarChart/formatter.js +15 -3
- package/BarChart/index.d.ts +3 -2
- package/BarChart/index.js +31 -12
- package/CHANGELOG.md +192 -1
- package/ChartsAxis/ChartsAxis.js +4 -4
- package/ChartsLegend/ChartsLegend.d.ts +1 -1
- package/ChartsLegend/ChartsLegend.js +3 -2
- package/ChartsLegend/index.d.ts +1 -0
- package/ChartsLegend/index.js +11 -0
- package/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
- package/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
- package/ChartsReferenceLine/common.d.ts +1 -1
- package/ChartsText/ChartsText.d.ts +17 -0
- package/{internals/components → ChartsText}/ChartsText.js +32 -17
- package/ChartsText/index.d.ts +3 -0
- package/ChartsText/index.js +12 -0
- package/ChartsText/package.json +6 -0
- package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +5 -2
- package/ChartsTooltip/ChartsAxisTooltipContent.js +93 -73
- package/ChartsTooltip/ChartsItemTooltipContent.d.ts +5 -2
- package/ChartsTooltip/ChartsItemTooltipContent.js +38 -57
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.d.ts +7 -0
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +174 -0
- package/ChartsTooltip/DefaultChartsItemTooltipContent.d.ts +8 -0
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +99 -0
- package/ChartsTooltip/index.d.ts +4 -0
- package/ChartsTooltip/index.js +44 -0
- package/ChartsXAxis/ChartsXAxis.js +3 -2
- package/ChartsYAxis/ChartsYAxis.js +7 -5
- package/LineChart/AreaPlot.js +3 -2
- package/LineChart/LineHighlightPlot.js +2 -1
- package/LineChart/LinePlot.js +3 -2
- package/LineChart/MarkPlot.js +2 -1
- package/LineChart/extremums.js +25 -8
- package/LineChart/formatter.js +14 -2
- package/LineChart/index.d.ts +5 -5
- package/LineChart/index.js +50 -41
- package/PieChart/PieArcLabelPlot.d.ts +7 -4
- package/PieChart/PieArcLabelPlot.js +88 -1
- package/PieChart/PieArcPlot.d.ts +7 -4
- package/PieChart/PieArcPlot.js +87 -1
- package/PieChart/PieChart.js +4 -4
- package/PieChart/PiePlot.js +20 -15
- package/PieChart/dataTransform/useTransformData.d.ts +2 -3
- package/PieChart/index.d.ts +6 -6
- package/PieChart/index.js +60 -46
- package/ResponsiveChartContainer/index.js +2 -2
- package/ScatterChart/Scatter.js +1 -1
- package/ScatterChart/index.d.ts +3 -3
- package/ScatterChart/index.js +31 -19
- package/context/CartesianContextProvider.js +2 -2
- package/context/SeriesContextProvider.js +1 -1
- package/esm/BarChart/BarElement.js +26 -2
- package/esm/BarChart/BarPlot.js +7 -5
- package/esm/BarChart/formatter.js +20 -4
- package/esm/BarChart/index.js +3 -2
- package/esm/ChartsAxis/ChartsAxis.js +4 -4
- package/esm/ChartsLegend/ChartsLegend.js +2 -1
- package/esm/ChartsLegend/index.js +2 -1
- package/esm/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
- package/esm/{internals/components → ChartsText}/ChartsText.js +33 -16
- package/esm/ChartsText/index.js +1 -0
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +95 -75
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +40 -58
- package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +168 -0
- package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +92 -0
- package/esm/ChartsTooltip/index.js +5 -1
- package/esm/ChartsXAxis/ChartsXAxis.js +2 -1
- package/esm/ChartsYAxis/ChartsYAxis.js +7 -5
- package/esm/LineChart/AreaPlot.js +3 -2
- package/esm/LineChart/LineHighlightPlot.js +2 -1
- package/esm/LineChart/LinePlot.js +3 -2
- package/esm/LineChart/MarkPlot.js +2 -1
- package/esm/LineChart/extremums.js +25 -8
- package/esm/LineChart/formatter.js +16 -3
- package/esm/LineChart/index.js +5 -5
- package/esm/PieChart/PieArcLabelPlot.js +90 -2
- package/esm/PieChart/PieArcPlot.js +89 -2
- package/esm/PieChart/PieChart.js +4 -4
- package/esm/PieChart/PiePlot.js +20 -15
- package/esm/PieChart/index.js +6 -4
- package/esm/ResponsiveChartContainer/index.js +2 -2
- package/esm/ScatterChart/Scatter.js +1 -1
- package/esm/ScatterChart/index.js +3 -3
- package/esm/context/CartesianContextProvider.js +2 -2
- package/esm/context/SeriesContextProvider.js +1 -1
- package/esm/index.js +1 -0
- package/esm/internals/defaultizeValueFormatter.js +4 -3
- package/esm/internals/getWordsByLines.js +14 -0
- package/esm/internals/utils.js +40 -0
- package/index.d.ts +1 -0
- package/index.js +12 -1
- package/internals/defaultizeColor.d.ts +4 -4
- package/internals/defaultizeValueFormatter.d.ts +3 -1
- package/internals/defaultizeValueFormatter.js +3 -3
- package/internals/{components/ChartsText.d.ts → getWordsByLines.d.ts} +2 -11
- package/internals/getWordsByLines.js +21 -0
- package/internals/utils.d.ts +13 -0
- package/internals/utils.js +42 -0
- package/legacy/BarChart/BarElement.js +26 -2
- package/legacy/BarChart/BarPlot.js +7 -5
- package/legacy/BarChart/formatter.js +23 -9
- package/legacy/BarChart/index.js +3 -2
- package/legacy/ChartsAxis/ChartsAxis.js +4 -4
- package/legacy/ChartsLegend/ChartsLegend.js +2 -1
- package/legacy/ChartsLegend/index.js +2 -1
- package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/legacy/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
- package/legacy/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
- package/legacy/{internals/components → ChartsText}/ChartsText.js +38 -22
- package/legacy/ChartsText/index.js +1 -0
- package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +95 -74
- package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +40 -55
- package/legacy/ChartsTooltip/DefaultChartsAxisTooltipContent.js +167 -0
- package/legacy/ChartsTooltip/DefaultChartsItemTooltipContent.js +89 -0
- package/legacy/ChartsTooltip/index.js +5 -1
- package/legacy/ChartsXAxis/ChartsXAxis.js +2 -1
- package/legacy/ChartsYAxis/ChartsYAxis.js +7 -5
- package/legacy/LineChart/AreaPlot.js +3 -2
- package/legacy/LineChart/LineHighlightPlot.js +2 -1
- package/legacy/LineChart/LinePlot.js +3 -2
- package/legacy/LineChart/MarkPlot.js +2 -1
- package/legacy/LineChart/extremums.js +29 -14
- package/legacy/LineChart/formatter.js +19 -8
- package/legacy/LineChart/index.js +5 -5
- package/legacy/PieChart/PieArcLabelPlot.js +90 -2
- package/legacy/PieChart/PieArcPlot.js +89 -2
- package/legacy/PieChart/PieChart.js +4 -4
- package/legacy/PieChart/PiePlot.js +20 -15
- package/legacy/PieChart/index.js +6 -4
- package/legacy/ResponsiveChartContainer/index.js +2 -2
- package/legacy/ScatterChart/Scatter.js +1 -1
- package/legacy/ScatterChart/index.js +3 -3
- package/legacy/context/CartesianContextProvider.js +2 -2
- package/legacy/context/SeriesContextProvider.js +1 -1
- package/legacy/index.js +2 -1
- package/legacy/internals/defaultizeValueFormatter.js +4 -3
- package/legacy/internals/getWordsByLines.js +15 -0
- package/legacy/internals/utils.js +40 -0
- package/models/axis.d.ts +1 -1
- package/models/seriesType/config.d.ts +9 -4
- package/models/seriesType/pie.d.ts +29 -7
- package/models/seriesType/scatter.d.ts +1 -1
- package/modern/BarChart/BarElement.js +26 -2
- package/modern/BarChart/BarPlot.js +7 -5
- package/modern/BarChart/formatter.js +15 -3
- package/modern/BarChart/index.js +3 -2
- package/modern/ChartsAxis/ChartsAxis.js +4 -4
- package/modern/ChartsLegend/ChartsLegend.js +2 -1
- package/modern/ChartsLegend/index.js +2 -1
- package/modern/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
- package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
- package/modern/{internals/components → ChartsText}/ChartsText.js +33 -16
- package/modern/ChartsText/index.js +1 -0
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +95 -74
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +40 -58
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +167 -0
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +92 -0
- package/modern/ChartsTooltip/index.js +5 -1
- package/modern/ChartsXAxis/ChartsXAxis.js +2 -1
- package/modern/ChartsYAxis/ChartsYAxis.js +7 -5
- package/modern/LineChart/AreaPlot.js +3 -2
- package/modern/LineChart/LineHighlightPlot.js +2 -1
- package/modern/LineChart/LinePlot.js +3 -2
- package/modern/LineChart/MarkPlot.js +2 -1
- package/modern/LineChart/extremums.js +25 -8
- package/modern/LineChart/formatter.js +14 -2
- package/modern/LineChart/index.js +5 -5
- package/modern/PieChart/PieArcLabelPlot.js +90 -2
- package/modern/PieChart/PieArcPlot.js +89 -2
- package/modern/PieChart/PieChart.js +4 -4
- package/modern/PieChart/PiePlot.js +20 -15
- package/modern/PieChart/index.js +6 -4
- package/modern/ResponsiveChartContainer/index.js +2 -2
- package/modern/ScatterChart/Scatter.js +1 -1
- package/modern/ScatterChart/index.js +3 -3
- package/modern/context/CartesianContextProvider.js +2 -2
- package/modern/context/SeriesContextProvider.js +1 -1
- package/modern/index.js +2 -1
- package/modern/internals/defaultizeValueFormatter.js +3 -3
- package/modern/internals/getWordsByLines.js +14 -0
- package/modern/internals/utils.js +40 -0
- package/package.json +1 -1
package/BarChart/BarElement.d.ts
CHANGED
|
@@ -1355,4 +1355,8 @@ export type BarElementProps = Omit<BarElementOwnerState, 'isFaded' | 'isHighligh
|
|
|
1355
1355
|
bar?: React.ElementType;
|
|
1356
1356
|
};
|
|
1357
1357
|
};
|
|
1358
|
-
|
|
1358
|
+
declare function BarElement(props: BarElementProps): React.JSX.Element;
|
|
1359
|
+
declare namespace BarElement {
|
|
1360
|
+
var propTypes: any;
|
|
1361
|
+
}
|
|
1362
|
+
export { BarElement };
|
package/BarChart/BarElement.js
CHANGED
|
@@ -10,6 +10,7 @@ exports.getBarElementUtilityClass = getBarElementUtilityClass;
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
12
|
var React = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
14
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
14
15
|
var _utils = require("@mui/base/utils");
|
|
15
16
|
var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
|
|
@@ -100,4 +101,26 @@ function BarElement(props) {
|
|
|
100
101
|
ownerState
|
|
101
102
|
});
|
|
102
103
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Bar, (0, _extends2.default)({}, barProps));
|
|
103
|
-
}
|
|
104
|
+
}
|
|
105
|
+
process.env.NODE_ENV !== "production" ? BarElement.propTypes = {
|
|
106
|
+
// ----------------------------- Warning --------------------------------
|
|
107
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
108
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
109
|
+
// ----------------------------------------------------------------------
|
|
110
|
+
classes: _propTypes.default.object,
|
|
111
|
+
dataIndex: _propTypes.default.number.isRequired,
|
|
112
|
+
highlightScope: _propTypes.default.shape({
|
|
113
|
+
faded: _propTypes.default.oneOf(['global', 'none', 'series']),
|
|
114
|
+
highlighted: _propTypes.default.oneOf(['item', 'none', 'series'])
|
|
115
|
+
}),
|
|
116
|
+
/**
|
|
117
|
+
* The props used for each component slot.
|
|
118
|
+
* @default {}
|
|
119
|
+
*/
|
|
120
|
+
slotProps: _propTypes.default.object,
|
|
121
|
+
/**
|
|
122
|
+
* Overridable component slots.
|
|
123
|
+
* @default {}
|
|
124
|
+
*/
|
|
125
|
+
slots: _propTypes.default.object
|
|
126
|
+
} : void 0;
|
package/BarChart/BarPlot.js
CHANGED
|
@@ -14,10 +14,9 @@ var _SeriesContextProvider = require("../context/SeriesContextProvider");
|
|
|
14
14
|
var _CartesianContextProvider = require("../context/CartesianContextProvider");
|
|
15
15
|
var _BarElement = require("./BarElement");
|
|
16
16
|
var _axis = require("../models/axis");
|
|
17
|
+
var _constants = require("../constants");
|
|
17
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
19
|
const _excluded = ["skipAnimation"];
|
|
19
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
20
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
20
|
/**
|
|
22
21
|
* Solution of the equations
|
|
23
22
|
* W = barWidth * N + offset * (N-1)
|
|
@@ -27,6 +26,8 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
27
26
|
* @param gapRatio The ratio of the gap between bars over the bar width.
|
|
28
27
|
* @returns The bar width and the offset between bars.
|
|
29
28
|
*/
|
|
29
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
30
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
30
31
|
function getBandSize({
|
|
31
32
|
bandWidth: W,
|
|
32
33
|
numberOfGroups: N,
|
|
@@ -76,18 +77,18 @@ const useCompletedData = () => {
|
|
|
76
77
|
let baseScaleConfig;
|
|
77
78
|
if (verticalLayout) {
|
|
78
79
|
if (!(0, _axis.isBandScaleConfig)(xAxisConfig)) {
|
|
79
|
-
throw new Error(`
|
|
80
|
+
throw new Error(`MUI-X-Charts: ${xAxisKey === _constants.DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} shoud be of type "band" to display the bar series of id "${seriesId}"`);
|
|
80
81
|
}
|
|
81
82
|
if (xAxis[xAxisKey].data === undefined) {
|
|
82
|
-
throw new Error(`
|
|
83
|
+
throw new Error(`MUI-X-Charts: ${xAxisKey === _constants.DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} shoud have data property`);
|
|
83
84
|
}
|
|
84
85
|
baseScaleConfig = xAxisConfig;
|
|
85
86
|
} else {
|
|
86
87
|
if (!(0, _axis.isBandScaleConfig)(yAxisConfig)) {
|
|
87
|
-
throw new Error(`
|
|
88
|
+
throw new Error(`MUI-X-Charts: ${yAxisKey === _constants.DEFAULT_Y_AXIS_KEY ? 'The first `yAxis`' : `The y-axis with id "${yAxisKey}"`} shoud be of type "band" to display the bar series of id "${seriesId}"`);
|
|
88
89
|
}
|
|
89
90
|
if (yAxis[yAxisKey].data === undefined) {
|
|
90
|
-
throw new Error(`
|
|
91
|
+
throw new Error(`MUI-X-Charts: ${yAxisKey === _constants.DEFAULT_Y_AXIS_KEY ? 'The first `yAxis`' : `The y-axis with id "${yAxisKey}"`} shoud have data property`);
|
|
91
92
|
}
|
|
92
93
|
baseScaleConfig = yAxisConfig;
|
|
93
94
|
}
|
package/BarChart/formatter.js
CHANGED
|
@@ -9,6 +9,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
var _d3Shape = require("d3-shape");
|
|
10
10
|
var _stackSeries = require("../internals/stackSeries");
|
|
11
11
|
var _defaultizeValueFormatter = _interopRequireDefault(require("../internals/defaultizeValueFormatter"));
|
|
12
|
+
let warnOnce = false;
|
|
12
13
|
const formatter = (params, dataset) => {
|
|
13
14
|
const {
|
|
14
15
|
seriesOrder,
|
|
@@ -31,7 +32,7 @@ const formatter = (params, dataset) => {
|
|
|
31
32
|
}
|
|
32
33
|
});
|
|
33
34
|
} else if (dataset === undefined) {
|
|
34
|
-
throw new Error([`MUI: bar series with id='${id}' has no data.`, 'Either provide a data property to the series or use the dataset prop.'].join('\n'));
|
|
35
|
+
throw new Error([`MUI-X-Charts: bar series with id='${id}' has no data.`, 'Either provide a data property to the series or use the dataset prop.'].join('\n'));
|
|
35
36
|
}
|
|
36
37
|
});
|
|
37
38
|
const completedSeries = {};
|
|
@@ -46,13 +47,24 @@ const formatter = (params, dataset) => {
|
|
|
46
47
|
// Use dataKey if needed and available
|
|
47
48
|
const dataKey = series[id].dataKey;
|
|
48
49
|
return series[id].data === undefined && dataKey !== undefined ? dataKey : id;
|
|
49
|
-
})).
|
|
50
|
+
})).value((d, key) => d[key] ?? 0) // defaultize null value to 0
|
|
51
|
+
.order(stackingOrder).offset(stackingOffset)(d3Dataset);
|
|
50
52
|
ids.forEach((id, index) => {
|
|
51
53
|
const dataKey = series[id].dataKey;
|
|
52
54
|
completedSeries[id] = (0, _extends2.default)({
|
|
53
55
|
layout: 'vertical'
|
|
54
56
|
}, series[id], {
|
|
55
|
-
data: dataKey ? dataset.map(
|
|
57
|
+
data: dataKey ? dataset.map(data => {
|
|
58
|
+
const value = data[dataKey];
|
|
59
|
+
if (typeof value !== 'number') {
|
|
60
|
+
if (process.env.NODE_ENV !== 'production' && !warnOnce && value !== null) {
|
|
61
|
+
warnOnce = true;
|
|
62
|
+
console.error([`MUI-X charts: your dataset key "${dataKey}" is used for plotting bars, but contains nonnumerical elements.`, 'Bar plots only support numbers and null values.']);
|
|
63
|
+
}
|
|
64
|
+
return 0;
|
|
65
|
+
}
|
|
66
|
+
return value;
|
|
67
|
+
}) : series[id].data,
|
|
56
68
|
stackedData: stackedSeries[index].map(([a, b]) => [a, b])
|
|
57
69
|
});
|
|
58
70
|
});
|
package/BarChart/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export * from './BarChart';
|
|
2
|
+
export * from './BarPlot';
|
|
3
|
+
export * from './BarElement';
|
package/BarChart/index.js
CHANGED
|
@@ -3,17 +3,36 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
6
|
+
var _BarChart = require("./BarChart");
|
|
7
|
+
Object.keys(_BarChart).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _BarChart[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _BarChart[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
17
16
|
});
|
|
18
17
|
var _BarPlot = require("./BarPlot");
|
|
19
|
-
|
|
18
|
+
Object.keys(_BarPlot).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _BarPlot[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _BarPlot[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _BarElement = require("./BarElement");
|
|
29
|
+
Object.keys(_BarElement).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _BarElement[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _BarElement[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,196 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 6.18.6
|
|
7
|
+
|
|
8
|
+
_Dec 22, 2023_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 5 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🌍 Improve Russian (ru-RU) locale (#11429) @wensiet
|
|
13
|
+
- 🐞 Bugfixes
|
|
14
|
+
|
|
15
|
+
### Data Grid
|
|
16
|
+
|
|
17
|
+
#### `@mui/x-data-grid@6.18.6`
|
|
18
|
+
|
|
19
|
+
- [DataGrid] Fix typos in the JSDoc (#11475) @flaviendelangle
|
|
20
|
+
- [l10n] Improve Russian (ru-RU) locale (#11429) @wensiet
|
|
21
|
+
|
|
22
|
+
#### `@mui/x-data-grid-pro@6.18.6` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
23
|
+
|
|
24
|
+
Same changes as in `@mui/x-data-grid@6.18.6`.
|
|
25
|
+
|
|
26
|
+
#### `@mui/x-data-grid-premium@6.18.6` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
27
|
+
|
|
28
|
+
Same changes as in `@mui/x-data-grid-pro@6.18.6`.
|
|
29
|
+
|
|
30
|
+
### Date Pickers
|
|
31
|
+
|
|
32
|
+
#### `@mui/x-date-pickers@6.18.6`
|
|
33
|
+
|
|
34
|
+
- [fields] Fix section pasting (#11467) @LukasTy
|
|
35
|
+
|
|
36
|
+
#### `@mui/x-date-pickers-pro@6.18.6` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
37
|
+
|
|
38
|
+
Same changes as in `@mui/x-date-pickers@6.18.6`.
|
|
39
|
+
|
|
40
|
+
### Charts / `@mui/x-charts@6.18.6`
|
|
41
|
+
|
|
42
|
+
- [charts] Allow percentage values for pie chart center and radius (#11464) @alexfauquette
|
|
43
|
+
- [charts] Make error message more explicit (#11457) @alexfauquette
|
|
44
|
+
- [charts] Make the helper `ChartsText` component public (#11370) @alexfauquette
|
|
45
|
+
- [charts] Improve dataset typing (#11372) @alexfauquette
|
|
46
|
+
- [charts] Fix size overflow (#11385) @alexfauquette
|
|
47
|
+
|
|
48
|
+
### Docs
|
|
49
|
+
|
|
50
|
+
- [docs] Document false default values for boolean props (#11489) @cherniavskii
|
|
51
|
+
- [docs] Improve Pickers `name` prop examples (#11442) @LukasTy
|
|
52
|
+
- [docs] Limit `date-fns` package to v2 in codesandbox (#11478) @LukasTy
|
|
53
|
+
- [test] Reload the page if its blank and there are no links to the remaining tests (#11471) @cherniavskii
|
|
54
|
+
|
|
55
|
+
## 6.18.5
|
|
56
|
+
|
|
57
|
+
_Dec 14, 2023_
|
|
58
|
+
|
|
59
|
+
We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
60
|
+
|
|
61
|
+
- 🌍 Improve Swedish (sv-SE) and Urdu (ur-PK) locales on the Data Grid
|
|
62
|
+
- 🐞 Bugfixes
|
|
63
|
+
|
|
64
|
+
### Data Grid
|
|
65
|
+
|
|
66
|
+
#### `@mui/x-data-grid@6.18.5`
|
|
67
|
+
|
|
68
|
+
- [l10n] Improve Swedish (sv-SE) locale (#11379) @fredrikcarlbom
|
|
69
|
+
- [l10n] Improve Urdu (ur-PK) locale for data grid (#11409) @MBilalShafi
|
|
70
|
+
|
|
71
|
+
#### `@mui/x-data-grid-pro@6.18.5` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
72
|
+
|
|
73
|
+
Same changes as in `@mui/x-data-grid@6.18.5`.
|
|
74
|
+
|
|
75
|
+
#### `@mui/x-data-grid-premium@6.18.5` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
76
|
+
|
|
77
|
+
Same changes as in `@mui/x-data-grid-pro@6.18.5`.
|
|
78
|
+
|
|
79
|
+
### Date Pickers
|
|
80
|
+
|
|
81
|
+
#### `@mui/x-date-pickers@6.18.5`
|
|
82
|
+
|
|
83
|
+
- [pickers] Fix field types to avoid error on latest `@types/react` version (#11398) @LukasTy
|
|
84
|
+
- [pickers] Support name prop (#11380) @gitstart
|
|
85
|
+
|
|
86
|
+
#### `@mui/x-date-pickers-pro@6.18.5` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
87
|
+
|
|
88
|
+
Same changes as in `@mui/x-date-pickers@6.18.5`, plus:
|
|
89
|
+
|
|
90
|
+
- [DateRangePicker] Fix `autoFocus` behavior (#11376) @kealjones-wk
|
|
91
|
+
|
|
92
|
+
### Docs
|
|
93
|
+
|
|
94
|
+
- [docs] Respect GoT books (#11294) @janoma
|
|
95
|
+
- [test] Fix flaky screenshots (#11391) @cherniavskii
|
|
96
|
+
|
|
97
|
+
## 6.18.4
|
|
98
|
+
|
|
99
|
+
_Dec 8, 2023_
|
|
100
|
+
|
|
101
|
+
We'd like to offer a big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
|
|
102
|
+
|
|
103
|
+
- 📚 Add [Pickers FAQ page](https://mui.com/x/react-date-pickers/faq/)
|
|
104
|
+
- 🌍 Improve Danish (da-DK) locale on Data Grid
|
|
105
|
+
- 🐞 Bugfixes
|
|
106
|
+
|
|
107
|
+
### Data Grid
|
|
108
|
+
|
|
109
|
+
#### `@mui/x-data-grid@6.18.4`
|
|
110
|
+
|
|
111
|
+
- [DataGrid] Fix cell slot style override (#11215) @oliviertassinari
|
|
112
|
+
- [l10n] Improve Danish (da-DK) locale (#11346) @goibon
|
|
113
|
+
|
|
114
|
+
#### `@mui/x-data-grid-pro@6.18.4` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
115
|
+
|
|
116
|
+
Same changes as in `@mui/x-data-grid@6.18.4`.
|
|
117
|
+
|
|
118
|
+
#### `@mui/x-data-grid-premium@6.18.4` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
119
|
+
|
|
120
|
+
Same changes as in `@mui/x-data-grid-pro@6.18.4`.
|
|
121
|
+
|
|
122
|
+
### Date Pickers
|
|
123
|
+
|
|
124
|
+
#### `@mui/x-date-pickers@6.18.4`
|
|
125
|
+
|
|
126
|
+
- [pickers] Fix `MultiSectionDigitalClock` issues (#11308) @LukasTy
|
|
127
|
+
|
|
128
|
+
#### `@mui/x-date-pickers-pro@6.18.4` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
129
|
+
|
|
130
|
+
Same changes as in `@mui/x-date-pickers@6.18.4`.
|
|
131
|
+
|
|
132
|
+
### Docs
|
|
133
|
+
|
|
134
|
+
- [docs] Fix typo (#11323) @cadam11
|
|
135
|
+
- [docs] Add FAQ page (#11347) @noraleonte
|
|
136
|
+
|
|
137
|
+
## 6.18.3
|
|
138
|
+
|
|
139
|
+
_Dec 4, 2023_
|
|
140
|
+
|
|
141
|
+
We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
|
|
142
|
+
|
|
143
|
+
- 📈 Fix a lot of Charts package issues
|
|
144
|
+
- 🌍 Improve Bulgarian (bg-BG) locale on Data Grid
|
|
145
|
+
- 🐞 Bugfixes
|
|
146
|
+
- 📚 Documentation improvements
|
|
147
|
+
|
|
148
|
+
### Data Grid
|
|
149
|
+
|
|
150
|
+
#### `@mui/x-data-grid@6.18.3`
|
|
151
|
+
|
|
152
|
+
- [DataGrid] Fix cell editing adding a leading "v" on paste (#11166) @prasad5795
|
|
153
|
+
- [DataGrid] Fix handling of event target in portal (#11209) @cherniavskii
|
|
154
|
+
- [DataGrid] Fix `onFilterModelChange` being fired with stale field value (#11244) @gitstart
|
|
155
|
+
- [l10n] Improve Bulgarian (bg-BG) locale (#10856) (#11206) @Kristiqn95
|
|
156
|
+
|
|
157
|
+
#### `@mui/x-data-grid-pro@6.18.3` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
158
|
+
|
|
159
|
+
Same changes as in `@mui/x-data-grid@6.18.3`.
|
|
160
|
+
|
|
161
|
+
#### `@mui/x-data-grid-premium@6.18.3` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
162
|
+
|
|
163
|
+
Same changes as in `@mui/x-data-grid-pro@6.18.3`, plus:
|
|
164
|
+
|
|
165
|
+
- [DataGridPremium] Fix aggregated column ignoring column definition changes (#11176) @cherniavskii
|
|
166
|
+
- [DataGridPremium] Fix custom filter operators not working on aggregated column (#11201) @cherniavskii
|
|
167
|
+
|
|
168
|
+
### Date Pickers
|
|
169
|
+
|
|
170
|
+
#### `@mui/x-date-pickers@6.18.3`
|
|
171
|
+
|
|
172
|
+
- [pickers] Correctly format `MultiSectionDigitalClock` number sections (#11297) @LukasTy
|
|
173
|
+
- [pickers] Expand field placeholder methods flexibility by providing `format` parameter (#11254) @LukasTy
|
|
174
|
+
|
|
175
|
+
#### `@mui/x-date-pickers-pro@6.18.3` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
176
|
+
|
|
177
|
+
Same changes as in `@mui/x-date-pickers@6.18.3`.
|
|
178
|
+
|
|
179
|
+
### Charts / `@mui/x-charts@6.18.3`
|
|
180
|
+
|
|
181
|
+
- [charts] Adjusted `defaultizeValueFormatter` util to accept an optional `series.valueFormatter` value (#11213) @michelengelen
|
|
182
|
+
- [charts] Apply `labelStyle` and `tickLabelStyle` props on `<ChartsYAxis />` (#11180) @akamfoad
|
|
183
|
+
- [charts] Fix TS config (#11259) @alexfauquette
|
|
184
|
+
- [charts] Fix error with empty dataset (#11063) @alexfauquette
|
|
185
|
+
- [charts] Fix export strategy (#11235) @alexfauquette
|
|
186
|
+
|
|
187
|
+
### Docs
|
|
188
|
+
|
|
189
|
+
- [docs] Add LTS section to support page (#11300) @joserodolfofreitas
|
|
190
|
+
- [docs] Add end v6 blogpost to whats new page (#11299) @joserodolfofreitas
|
|
191
|
+
- [docs] Document charts composition (#10710) @alexfauquette
|
|
192
|
+
- [docs] Fix version links (#11167) @LukasTy
|
|
193
|
+
- [docs] Improve Data Grid togglable columns example (#11241) @MBilalShafi
|
|
194
|
+
- [docs] Split charts overview and getting started in distinct pages (#10910) @alexfauquette
|
|
195
|
+
|
|
6
196
|
## 6.18.2
|
|
7
197
|
|
|
8
198
|
_Nov 23, 2023_
|
|
@@ -288,7 +478,7 @@ Same changes as in `@mui/x-date-pickers@6.16.3`, plus:
|
|
|
288
478
|
|
|
289
479
|
- [charts] Add reference links to area + bar chart components (#10652) @michelengelen
|
|
290
480
|
- [charts] Add reference links to line chart + sparkline components (#10650) @michelengelen
|
|
291
|
-
- [charts] Add reference links to pie + scatter chart components
|
|
481
|
+
- [charts] Add reference links to pie + scatter chart components (#10653) @michelengelen
|
|
292
482
|
- [charts] Render only when `width` and `height` are resolved (#10714) @alexfauquette
|
|
293
483
|
- [charts] Support animation on `BarChart` (#9926) @alexfauquette
|
|
294
484
|
- [charts] Use new text component to avoid tick label overflow on x-axis (#10648) @alexfauquette
|
|
@@ -364,6 +554,7 @@ It adds line break support and avoids overlapping text in the legend.
|
|
|
364
554
|
This comes with some breaking changes.
|
|
365
555
|
|
|
366
556
|
- The DOM structure is modified. An intermediary `<tspan />` element has been added. This can impact how your style is applied.
|
|
557
|
+
|
|
367
558
|
```diff
|
|
368
559
|
- <text>The label</text>
|
|
369
560
|
+ <text><tspan>The label</tspan></text>
|
package/ChartsAxis/ChartsAxis.js
CHANGED
|
@@ -66,16 +66,16 @@ function ChartsAxis(props) {
|
|
|
66
66
|
const topId = getAxisId(topAxis);
|
|
67
67
|
const rightId = getAxisId(rightAxis);
|
|
68
68
|
if (topId !== null && !xAxis[topId]) {
|
|
69
|
-
throw Error(`MUI: id used for top axis "${topId}" is not defined`);
|
|
69
|
+
throw Error([`MUI-X-Charts: id used for top axis "${topId}" is not defined.`, `Available ids are: ${xAxisIds.join(', ')}.`].join('\n'));
|
|
70
70
|
}
|
|
71
71
|
if (leftId !== null && !yAxis[leftId]) {
|
|
72
|
-
throw Error(`MUI: id used for left axis "${leftId}" is not defined`);
|
|
72
|
+
throw Error([`MUI-X-Charts: id used for left axis "${leftId}" is not defined.`, `Available ids are: ${yAxisIds.join(', ')}.`].join('\n'));
|
|
73
73
|
}
|
|
74
74
|
if (rightId !== null && !yAxis[rightId]) {
|
|
75
|
-
throw Error(`MUI: id used for right axis "${rightId}" is not defined`);
|
|
75
|
+
throw Error([`MUI-X-Charts: id used for right axis "${rightId}" is not defined.`, `Available ids are: ${yAxisIds.join(', ')}.`].join('\n'));
|
|
76
76
|
}
|
|
77
77
|
if (bottomId !== null && !xAxis[bottomId]) {
|
|
78
|
-
throw Error(`MUI: id used for bottom axis "${bottomId}" is not defined`);
|
|
78
|
+
throw Error([`MUI-X-Charts: id used for bottom axis "${bottomId}" is not defined.`, `Available ids are: ${xAxisIds.join(', ')}.`].join('\n'));
|
|
79
79
|
}
|
|
80
80
|
const topAxisProps = mergeProps(topAxis, slots, slotProps);
|
|
81
81
|
const bottomAxisProps = mergeProps(bottomAxis, slots, slotProps);
|
|
@@ -6,7 +6,7 @@ import { FormattedSeries } from '../context/SeriesContextProvider';
|
|
|
6
6
|
import { ChartsLegendClasses } from './chartsLegendClasses';
|
|
7
7
|
import { DefaultizedProps } from '../models/helpers';
|
|
8
8
|
import { LegendParams } from '../models/seriesType/config';
|
|
9
|
-
import { ChartsTextStyle } from '../
|
|
9
|
+
import { ChartsTextStyle } from '../ChartsText';
|
|
10
10
|
import { CardinalDirections } from '../models/layout';
|
|
11
11
|
export interface ChartsLegendSlotsComponent {
|
|
12
12
|
legend?: React.JSXElementConstructor<LegendRendererProps>;
|
|
@@ -17,7 +17,8 @@ var _DrawingProvider = require("../context/DrawingProvider");
|
|
|
17
17
|
var _utils3 = require("./utils");
|
|
18
18
|
var _SeriesContextProvider = require("../context/SeriesContextProvider");
|
|
19
19
|
var _chartsLegendClasses = require("./chartsLegendClasses");
|
|
20
|
-
var _ChartsText = require("../
|
|
20
|
+
var _ChartsText = require("../ChartsText");
|
|
21
|
+
var _getWordsByLines = require("../internals/getWordsByLines");
|
|
21
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
23
|
const _excluded = ["rotate", "dominantBaseline"],
|
|
23
24
|
_excluded2 = ["label"];
|
|
@@ -95,7 +96,7 @@ function DefaultChartsLegend(props) {
|
|
|
95
96
|
const padding = React.useMemo(() => getStandardizedPadding(paddingProps), [paddingProps]);
|
|
96
97
|
const getItemSpace = React.useCallback((label, inStyle = {}) => {
|
|
97
98
|
const style = (0, _objectWithoutPropertiesLoose2.default)(inStyle, _excluded);
|
|
98
|
-
const linesSize = (0,
|
|
99
|
+
const linesSize = (0, _getWordsByLines.getWordsByLines)({
|
|
99
100
|
style,
|
|
100
101
|
needsComputation: true,
|
|
101
102
|
text: label
|
package/ChartsLegend/index.d.ts
CHANGED
package/ChartsLegend/index.js
CHANGED
|
@@ -24,4 +24,15 @@ Object.keys(_chartsLegendClasses).forEach(function (key) {
|
|
|
24
24
|
return _chartsLegendClasses[key];
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
|
+
});
|
|
28
|
+
var _utils = require("./utils");
|
|
29
|
+
Object.keys(_utils).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _utils[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _utils[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
27
38
|
});
|
|
@@ -15,10 +15,10 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
15
15
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
16
|
function ChartsReferenceLine(props) {
|
|
17
17
|
if (props.x !== undefined && props.y !== undefined) {
|
|
18
|
-
throw new Error('MUI-X: The ChartsReferenceLine can not have both `x` and `y` props set.');
|
|
18
|
+
throw new Error('MUI-X-Charts: The ChartsReferenceLine can not have both `x` and `y` props set.');
|
|
19
19
|
}
|
|
20
20
|
if (props.x === undefined && props.y === undefined) {
|
|
21
|
-
throw new Error('MUI-X: The ChartsReferenceLine should have a value in `x` or `y` prop.');
|
|
21
|
+
throw new Error('MUI-X-Charts: The ChartsReferenceLine should have a value in `x` or `y` prop.');
|
|
22
22
|
}
|
|
23
23
|
if (props.x !== undefined) {
|
|
24
24
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsXReferenceLine.ChartsXReferenceLine, (0, _extends2.default)({}, props));
|
|
@@ -11,7 +11,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
12
12
|
var _hooks = require("../hooks");
|
|
13
13
|
var _common = require("./common");
|
|
14
|
-
var _ChartsText = require("../
|
|
14
|
+
var _ChartsText = require("../ChartsText");
|
|
15
15
|
var _chartsReferenceLineClasses = require("./chartsReferenceLineClasses");
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
@@ -11,7 +11,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
12
12
|
var _hooks = require("../hooks");
|
|
13
13
|
var _common = require("./common");
|
|
14
|
-
var _ChartsText = require("../
|
|
14
|
+
var _ChartsText = require("../ChartsText");
|
|
15
15
|
var _chartsReferenceLineClasses = require("./chartsReferenceLineClasses");
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ChartsReferenceLineClasses } from './chartsReferenceLineClasses';
|
|
3
|
-
import { ChartsTextStyle } from '../
|
|
3
|
+
import { ChartsTextStyle } from '../ChartsText';
|
|
4
4
|
export type CommonChartsReferenceLineProps = {
|
|
5
5
|
/**
|
|
6
6
|
* The alignment if the label is in the chart drawing area.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { GetWordsByLinesParams } from '../internals/getWordsByLines';
|
|
3
|
+
export interface ChartsTextProps extends Omit<React.SVGTextElementAttributes<SVGTextElement>, 'width' | 'ref' | 'style' | 'dominantBaseline'>, GetWordsByLinesParams {
|
|
4
|
+
/**
|
|
5
|
+
* Height of a text line (in `em`).
|
|
6
|
+
*/
|
|
7
|
+
lineHeight?: number;
|
|
8
|
+
ownerState?: any;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Helper component to manage multiline text in SVG
|
|
12
|
+
*/
|
|
13
|
+
declare function ChartsText(props: ChartsTextProps): React.JSX.Element;
|
|
14
|
+
declare namespace ChartsText {
|
|
15
|
+
var propTypes: any;
|
|
16
|
+
}
|
|
17
|
+
export { ChartsText };
|
|
@@ -5,28 +5,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.ChartsText = ChartsText;
|
|
8
|
-
exports.getWordsByLines = getWordsByLines;
|
|
9
|
-
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
10
|
var React = _interopRequireWildcard(require("react"));
|
|
12
|
-
var
|
|
11
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
+
var _getWordsByLines = require("../internals/getWordsByLines");
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
14
|
const _excluded = ["x", "y", "style", "text", "ownerState"],
|
|
15
15
|
_excluded2 = ["angle", "textAnchor", "dominantBaseline"];
|
|
16
16
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
17
17
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
text
|
|
22
|
-
}) {
|
|
23
|
-
return text.split('\n').map(subText => (0, _extends2.default)({
|
|
24
|
-
text: subText
|
|
25
|
-
}, needsComputation ? (0, _domUtils.getStringSize)(subText, style) : {
|
|
26
|
-
width: 0,
|
|
27
|
-
height: 0
|
|
28
|
-
}));
|
|
29
|
-
}
|
|
18
|
+
/**
|
|
19
|
+
* Helper component to manage multiline text in SVG
|
|
20
|
+
*/
|
|
30
21
|
function ChartsText(props) {
|
|
31
22
|
const {
|
|
32
23
|
x,
|
|
@@ -42,7 +33,7 @@ function ChartsText(props) {
|
|
|
42
33
|
dominantBaseline
|
|
43
34
|
} = _ref,
|
|
44
35
|
style = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded2);
|
|
45
|
-
const wordsByLines = React.useMemo(() => getWordsByLines({
|
|
36
|
+
const wordsByLines = React.useMemo(() => (0, _getWordsByLines.getWordsByLines)({
|
|
46
37
|
style,
|
|
47
38
|
needsComputation: text.includes('\n'),
|
|
48
39
|
text
|
|
@@ -84,4 +75,28 @@ function ChartsText(props) {
|
|
|
84
75
|
children: line.text
|
|
85
76
|
}, index))
|
|
86
77
|
}));
|
|
87
|
-
}
|
|
78
|
+
}
|
|
79
|
+
process.env.NODE_ENV !== "production" ? ChartsText.propTypes = {
|
|
80
|
+
// ----------------------------- Warning --------------------------------
|
|
81
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
82
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
83
|
+
// ----------------------------------------------------------------------
|
|
84
|
+
/**
|
|
85
|
+
* Height of a text line (in `em`).
|
|
86
|
+
*/
|
|
87
|
+
lineHeight: _propTypes.default.number,
|
|
88
|
+
/**
|
|
89
|
+
* If `true`, the line width is computed.
|
|
90
|
+
* @default false
|
|
91
|
+
*/
|
|
92
|
+
needsComputation: _propTypes.default.bool,
|
|
93
|
+
ownerState: _propTypes.default.any,
|
|
94
|
+
/**
|
|
95
|
+
* Style applied to text elements.
|
|
96
|
+
*/
|
|
97
|
+
style: _propTypes.default.object,
|
|
98
|
+
/**
|
|
99
|
+
* Text displayed.
|
|
100
|
+
*/
|
|
101
|
+
text: _propTypes.default.string.isRequired
|
|
102
|
+
} : void 0;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "ChartsText", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _ChartsText.ChartsText;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _ChartsText = require("./ChartsText");
|