@mui/x-charts-pro 8.17.0 → 8.18.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 +100 -0
- package/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
- package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +5 -2
- package/ChartZoomSlider/internals/ChartAxisZoomSliderThumb.js +8 -5
- package/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +6 -3
- package/ChartsToolbarPro/ChartsToolbarImageExportTrigger.js +1 -0
- package/ChartsToolbarPro/ChartsToolbarPrintExportTrigger.js +1 -0
- package/ChartsToolbarPro/ChartsToolbarPro.js +1 -0
- package/SankeyChart/calculateSankeyLayout.js +16 -7
- package/SankeyChart/sankey.types.d.ts +17 -4
- package/esm/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +5 -2
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderThumb.js +8 -5
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +6 -3
- package/esm/ChartsToolbarPro/ChartsToolbarImageExportTrigger.js +1 -0
- package/esm/ChartsToolbarPro/ChartsToolbarPrintExportTrigger.js +1 -0
- package/esm/ChartsToolbarPro/ChartsToolbarPro.js +1 -0
- package/esm/SankeyChart/calculateSankeyLayout.js +16 -7
- package/esm/SankeyChart/sankey.types.d.ts +17 -4
- package/esm/index.js +1 -1
- package/esm/internals/plugins/useChartProExport/exportImage.js +5 -3
- package/esm/internals/plugins/useChartProExport/print.d.ts +2 -1
- package/esm/internals/plugins/useChartProExport/print.js +3 -2
- package/esm/internals/plugins/useChartProExport/useChartProExport.types.d.ts +5 -0
- package/index.js +1 -1
- package/internals/plugins/useChartProExport/exportImage.js +5 -3
- package/internals/plugins/useChartProExport/print.d.ts +2 -1
- package/internals/plugins/useChartProExport/print.js +3 -2
- package/internals/plugins/useChartProExport/useChartProExport.types.d.ts +5 -0
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,106 @@
|
|
|
5
5
|
All notable changes to this project will be documented in this file.
|
|
6
6
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
7
7
|
|
|
8
|
+
## 8.18.0
|
|
9
|
+
|
|
10
|
+
<!-- generated comparing v8.17.0..master -->
|
|
11
|
+
|
|
12
|
+
_Nov 13, 2025_
|
|
13
|
+
|
|
14
|
+
We'd like to extend a big thank you to the 14 contributors who made this release possible. Here are some highlights ✨:
|
|
15
|
+
|
|
16
|
+
- Add `barLabelPlacement` property to customize the bar label position in bar charts, enabling labels to be placed above bars.
|
|
17
|
+
|
|
18
|
+

|
|
19
|
+
|
|
20
|
+
- Add `source` property to the date/time picker lifecycle and event handler context, enabling clearer differentiation between changes initiated by the picker UI and those from direct field input.
|
|
21
|
+
- 🐞 Bugfixes
|
|
22
|
+
- 📚 Documentation improvements
|
|
23
|
+
|
|
24
|
+
Special thanks go out to these community members for their valuable contributions:
|
|
25
|
+
@htollefsen, @sai6855, @Sigdriv
|
|
26
|
+
|
|
27
|
+
The following team members contributed to this release:
|
|
28
|
+
@arminmeh, @bernardobelchior, @brijeshb42, @cherniavskii, @flaviendelangle, @JCQuintas, @michelengelen, @noraleonte, @prakhargupta1, @rita-codes, @siriwatknp
|
|
29
|
+
|
|
30
|
+
### Data Grid
|
|
31
|
+
|
|
32
|
+
#### `@mui/x-data-grid@8.18.0`
|
|
33
|
+
|
|
34
|
+
- [DataGrid] Allow default event in the column action cell item click event handler (#20272) @arminmeh
|
|
35
|
+
- [DataGrid] Remove unnecessary generic from `useGridApiRef` (#20277) @cherniavskii
|
|
36
|
+
|
|
37
|
+
#### `@mui/x-data-grid-pro@8.18.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
38
|
+
|
|
39
|
+
Same changes as in `@mui/x-data-grid@8.18.0`.
|
|
40
|
+
|
|
41
|
+
#### `@mui/x-data-grid-premium@8.18.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
42
|
+
|
|
43
|
+
Same changes as in `@mui/x-data-grid-pro@8.18.0`, plus:
|
|
44
|
+
|
|
45
|
+
- [DataGridPremium] Return the correct `cellParams` value from the aggregation cells (#20224) @arminmeh
|
|
46
|
+
|
|
47
|
+
### Date and Time Pickers
|
|
48
|
+
|
|
49
|
+
#### `@mui/x-date-pickers@8.18.0`
|
|
50
|
+
|
|
51
|
+
- [pickers] Keep invalid date state consistent (#20040) @michelengelen
|
|
52
|
+
- [pickers] Adds new `source` property to `onChange` and `onAccept` context object (#20234) @michelengelen
|
|
53
|
+
|
|
54
|
+
#### `@mui/x-date-pickers-pro@8.18.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
55
|
+
|
|
56
|
+
Same changes as in `@mui/x-date-pickers@8.18.0`.
|
|
57
|
+
|
|
58
|
+
### Charts
|
|
59
|
+
|
|
60
|
+
#### `@mui/x-charts@8.18.0`
|
|
61
|
+
|
|
62
|
+
- [charts] Add prop for positioning a bar label (#20194) @Sigdriv
|
|
63
|
+
- [charts] Fix applying dark mode styles in `ChartAxisZoomSliderThumb` (#20232) @sai6855
|
|
64
|
+
|
|
65
|
+
#### `@mui/x-charts-pro@8.18.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
66
|
+
|
|
67
|
+
Same changes as in `@mui/x-charts@8.18.0`, plus:
|
|
68
|
+
|
|
69
|
+
- [charts-pro] Allow specifying Content Security Policy nonce on export (#20053) @bernardobelchior
|
|
70
|
+
- [charts-pro] Fix applying dark mode styles to slider (#20220) @sai6855
|
|
71
|
+
- [charts-pro] Sankey should respect node order (#20065) @JCQuintas
|
|
72
|
+
|
|
73
|
+
#### `@mui/x-charts-premium@8.18.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
74
|
+
|
|
75
|
+
Same changes as in `@mui/x-charts-pro@8.18.0`.
|
|
76
|
+
|
|
77
|
+
### Tree View
|
|
78
|
+
|
|
79
|
+
#### `@mui/x-tree-view@8.18.0`
|
|
80
|
+
|
|
81
|
+
- [tree view] Prepare tests for the new store structure (#20225) @flaviendelangle
|
|
82
|
+
- [tree view] Prepare the item plugin files for the store migration (#20240) @flaviendelangle
|
|
83
|
+
- [tree view] Use `TreeItemId` type instead of raw string (#20233) @flaviendelangle
|
|
84
|
+
|
|
85
|
+
#### `@mui/x-tree-view-pro@8.18.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
86
|
+
|
|
87
|
+
Same changes as in `@mui/x-tree-view@8.18.0`.
|
|
88
|
+
|
|
89
|
+
### Codemod
|
|
90
|
+
|
|
91
|
+
#### `@mui/x-codemod@8.18.0`
|
|
92
|
+
|
|
93
|
+
Internal changes.
|
|
94
|
+
|
|
95
|
+
### Docs
|
|
96
|
+
|
|
97
|
+
- [charts] Add a demo for a custom tick label (#20073) @prakhargupta1
|
|
98
|
+
- [charts] Create `useAxes()` hook documentation page (#20229) @JCQuintas
|
|
99
|
+
- [charts] Fix logo alignment (#20228) @JCQuintas
|
|
100
|
+
- [charts] Fixes typo in import example (#20236) @htollefsen
|
|
101
|
+
- [Data Grid] Add recipe for cursor pagination with data source (#19700) @siriwatknp
|
|
102
|
+
- [Data Grid] Add a demo for pinned rows aggregation (#20198) @cherniavskii
|
|
103
|
+
|
|
104
|
+
### Core
|
|
105
|
+
|
|
106
|
+
- [docs-infra] Use deployment config from docs-infra package (#20243) @brijeshb42
|
|
107
|
+
|
|
8
108
|
## 8.17.0
|
|
9
109
|
|
|
10
110
|
_Nov 5, 2025_
|
|
@@ -16,7 +16,7 @@ var _material = require("../internals/material");
|
|
|
16
16
|
var _allPlugins = require("../internals/plugins/allPlugins");
|
|
17
17
|
var _useChartDataProviderProProps = require("./useChartDataProviderProProps");
|
|
18
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
-
const releaseInfo = "
|
|
19
|
+
const releaseInfo = "MTc2Mjk5MjAwMDAwMA==";
|
|
20
20
|
const packageIdentifier = 'x-charts-pro';
|
|
21
21
|
/**
|
|
22
22
|
* Orchestrates the data providers for the chart components and hooks.
|
|
@@ -24,8 +24,11 @@ const ZoomSliderActiveTrackRect = (0, _styles.styled)('rect', {
|
|
|
24
24
|
shouldForwardProp: prop => (0, _system.shouldForwardProp)(prop) && prop !== 'preview'
|
|
25
25
|
})(({
|
|
26
26
|
theme
|
|
27
|
-
}) => ({
|
|
28
|
-
fill:
|
|
27
|
+
}) => (0, _extends2.default)({
|
|
28
|
+
fill: (theme.vars || theme).palette.grey[600]
|
|
29
|
+
}, theme.applyStyles('dark', {
|
|
30
|
+
fill: (theme.vars || theme).palette.grey[500]
|
|
31
|
+
}), {
|
|
29
32
|
cursor: 'grab',
|
|
30
33
|
variants: [{
|
|
31
34
|
props: {
|
|
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
9
|
exports.ChartAxisZoomSliderThumb = void 0;
|
|
10
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
10
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
12
12
|
var React = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _styles = require("@mui/material/styles");
|
|
14
14
|
var _useForkRef = _interopRequireDefault(require("@mui/utils/useForkRef"));
|
|
@@ -21,10 +21,13 @@ const _excluded = ["className", "onMove", "orientation", "placement", "rx", "ry"
|
|
|
21
21
|
const Rect = (0, _styles.styled)('rect')(({
|
|
22
22
|
theme
|
|
23
23
|
}) => ({
|
|
24
|
-
[`&.${_chartAxisZoomSliderThumbClasses.chartAxisZoomSliderThumbClasses.root}`]: {
|
|
25
|
-
fill:
|
|
26
|
-
stroke:
|
|
27
|
-
},
|
|
24
|
+
[`&.${_chartAxisZoomSliderThumbClasses.chartAxisZoomSliderThumbClasses.root}`]: (0, _extends2.default)({
|
|
25
|
+
fill: (theme.vars || theme).palette.common.white,
|
|
26
|
+
stroke: (theme.vars || theme).palette.grey[500]
|
|
27
|
+
}, theme.applyStyles('dark', {
|
|
28
|
+
fill: (theme.vars || theme).palette.grey[300],
|
|
29
|
+
stroke: (theme.vars || theme).palette.grey[600]
|
|
30
|
+
})),
|
|
28
31
|
[`&.${_chartAxisZoomSliderThumbClasses.chartAxisZoomSliderThumbClasses.horizontal}`]: {
|
|
29
32
|
cursor: 'ew-resize'
|
|
30
33
|
},
|
|
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
9
|
exports.ChartAxisZoomSliderTrack = ChartAxisZoomSliderTrack;
|
|
10
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
10
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
12
12
|
var React = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _internals = require("@mui/x-charts/internals");
|
|
14
14
|
var _styles = require("@mui/material/styles");
|
|
@@ -23,8 +23,11 @@ const ZoomSliderTrack = (0, _styles.styled)('rect', {
|
|
|
23
23
|
shouldForwardProp: prop => (0, _system.shouldForwardProp)(prop) && prop !== 'axisDirection' && prop !== 'isSelecting'
|
|
24
24
|
})(({
|
|
25
25
|
theme
|
|
26
|
-
}) => ({
|
|
27
|
-
fill:
|
|
26
|
+
}) => (0, _extends2.default)({
|
|
27
|
+
fill: (theme.vars || theme).palette.grey[300]
|
|
28
|
+
}, theme.applyStyles('dark', {
|
|
29
|
+
fill: (theme.vars || theme).palette.grey[800]
|
|
30
|
+
}), {
|
|
28
31
|
cursor: 'pointer',
|
|
29
32
|
variants: [{
|
|
30
33
|
props: {
|
|
@@ -66,6 +66,7 @@ process.env.NODE_ENV !== "production" ? ChartsToolbarImageExportTrigger.propType
|
|
|
66
66
|
options: _propTypes.default.shape({
|
|
67
67
|
copyStyles: _propTypes.default.bool,
|
|
68
68
|
fileName: _propTypes.default.string,
|
|
69
|
+
nonce: _propTypes.default.string,
|
|
69
70
|
onBeforeExport: _propTypes.default.func,
|
|
70
71
|
quality: _propTypes.default.number,
|
|
71
72
|
type: _propTypes.default.string.isRequired
|
|
@@ -66,6 +66,7 @@ process.env.NODE_ENV !== "production" ? ChartsToolbarPrintExportTrigger.propType
|
|
|
66
66
|
options: _propTypes.default.shape({
|
|
67
67
|
copyStyles: _propTypes.default.bool,
|
|
68
68
|
fileName: _propTypes.default.string,
|
|
69
|
+
nonce: _propTypes.default.string,
|
|
69
70
|
onBeforeExport: _propTypes.default.func
|
|
70
71
|
}),
|
|
71
72
|
/**
|
|
@@ -160,6 +160,7 @@ process.env.NODE_ENV !== "production" ? ChartsToolbarPro.propTypes = {
|
|
|
160
160
|
imageExportOptions: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
161
161
|
copyStyles: _propTypes.default.bool,
|
|
162
162
|
fileName: _propTypes.default.string,
|
|
163
|
+
nonce: _propTypes.default.string,
|
|
163
164
|
onBeforeExport: _propTypes.default.func,
|
|
164
165
|
quality: _propTypes.default.number,
|
|
165
166
|
type: _propTypes.default.string.isRequired
|
|
@@ -30,11 +30,11 @@ function calculateSankeyLayout(data, drawingArea, theme, series = {}) {
|
|
|
30
30
|
width: nodeWidth = 15,
|
|
31
31
|
padding: nodePadding = 10,
|
|
32
32
|
align: nodeAlign = 'justify',
|
|
33
|
-
sort: nodeSort
|
|
33
|
+
sort: nodeSort
|
|
34
34
|
} = nodeOptions ?? {};
|
|
35
35
|
const {
|
|
36
36
|
color: linkColor = 'source',
|
|
37
|
-
sort: linkSort
|
|
37
|
+
sort: linkSort,
|
|
38
38
|
curveCorrection = 10
|
|
39
39
|
} = linkOptions ?? {};
|
|
40
40
|
const {
|
|
@@ -59,12 +59,21 @@ function calculateSankeyLayout(data, drawingArea, theme, series = {}) {
|
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
// Create the sankey layout generator
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
const sankeyGenerator = (0, _d3Sankey.sankey)().nodeWidth(nodeWidth).nodePadding(nodePadding).nodeAlign((0, _utils.getNodeAlignFunction)(nodeAlign)).extent([[left, top], [width + right, height + bottom]]).nodeId(d => d.id).iterations(iterations);
|
|
63
|
+
|
|
64
|
+
// For 'auto' or undefined, don't set anything (use d3-sankey default behavior)
|
|
65
|
+
if (typeof nodeSort === 'function') {
|
|
66
|
+
sankeyGenerator.nodeSort(nodeSort);
|
|
67
|
+
} else if (nodeSort === 'fixed') {
|
|
68
|
+
// Null is not accepted by the types.
|
|
69
|
+
// https://github.com/DefinitelyTyped/DefinitelyTyped/pull/73953
|
|
70
|
+
sankeyGenerator.nodeSort(null);
|
|
65
71
|
}
|
|
66
|
-
if (linkSort) {
|
|
67
|
-
sankeyGenerator
|
|
72
|
+
if (typeof linkSort === 'function') {
|
|
73
|
+
sankeyGenerator.linkSort(linkSort);
|
|
74
|
+
} else if (linkSort === 'fixed') {
|
|
75
|
+
// Null is not accepted by the types.
|
|
76
|
+
sankeyGenerator.linkSort(null);
|
|
68
77
|
}
|
|
69
78
|
|
|
70
79
|
// Generate the layout
|
|
@@ -74,12 +74,19 @@ export type SankeyNodeOptions = {
|
|
|
74
74
|
*/
|
|
75
75
|
showLabels?: boolean;
|
|
76
76
|
/**
|
|
77
|
-
* Custom sort
|
|
77
|
+
* Custom sort mode for nodes
|
|
78
|
+
*
|
|
79
|
+
* - 'auto': Automatic sorting behavior (default)
|
|
80
|
+
* - 'fixed': Preserve the order from the nodes array (disables automatic sorting)
|
|
81
|
+
* - or a custom function
|
|
82
|
+
*
|
|
78
83
|
* @param {SankeyLayoutNode} a - First node to compare
|
|
79
84
|
* @param {SankeyLayoutNode} b - Second node to compare
|
|
80
85
|
* @returns {number} Comparison result
|
|
86
|
+
*
|
|
87
|
+
* @default 'auto'
|
|
81
88
|
*/
|
|
82
|
-
sort?: (a: SankeyLayoutNode, b: SankeyLayoutNode) => number
|
|
89
|
+
sort?: 'auto' | 'fixed' | ((a: SankeyLayoutNode, b: SankeyLayoutNode) => number);
|
|
83
90
|
} & SankeyNodeHighlightScope;
|
|
84
91
|
export type SankeyLinkOptions = {
|
|
85
92
|
/**
|
|
@@ -99,12 +106,18 @@ export type SankeyLinkOptions = {
|
|
|
99
106
|
*/
|
|
100
107
|
showValues?: boolean;
|
|
101
108
|
/**
|
|
102
|
-
* Custom sort
|
|
109
|
+
* Custom sort mode for links
|
|
110
|
+
*
|
|
111
|
+
* - 'auto': Automatic sorting behavior (default)
|
|
112
|
+
* - 'fixed': Preserve the order from the links array (disables automatic sorting)
|
|
113
|
+
* - or a custom function
|
|
114
|
+
*
|
|
103
115
|
* @param {SankeyLayoutLink} a - First link to compare
|
|
104
116
|
* @param {SankeyLayoutLink} b - Second link to compare
|
|
105
117
|
* @returns {number} Comparison result
|
|
118
|
+
* @default 'auto'
|
|
106
119
|
*/
|
|
107
|
-
sort?: (a: SankeyLayoutLink, b: SankeyLayoutLink) => number
|
|
120
|
+
sort?: 'auto' | 'fixed' | ((a: SankeyLayoutLink, b: SankeyLayoutLink) => number);
|
|
108
121
|
/**
|
|
109
122
|
* Applies the given number to the X dimension of the control points of the link's curve function.
|
|
110
123
|
* This can create better looking links between nodes, but is dependent on the graph layout.
|
|
@@ -10,7 +10,7 @@ import { defaultSlotsMaterial } from "../internals/material/index.js";
|
|
|
10
10
|
import { DEFAULT_PLUGINS } from "../internals/plugins/allPlugins.js";
|
|
11
11
|
import { useChartDataProviderProProps } from "./useChartDataProviderProProps.js";
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
const releaseInfo = "
|
|
13
|
+
const releaseInfo = "MTc2Mjk5MjAwMDAwMA==";
|
|
14
14
|
const packageIdentifier = 'x-charts-pro';
|
|
15
15
|
/**
|
|
16
16
|
* Orchestrates the data providers for the chart components and hooks.
|
|
@@ -17,8 +17,11 @@ const ZoomSliderActiveTrackRect = styled('rect', {
|
|
|
17
17
|
shouldForwardProp: prop => shouldForwardProp(prop) && prop !== 'preview'
|
|
18
18
|
})(({
|
|
19
19
|
theme
|
|
20
|
-
}) => ({
|
|
21
|
-
fill:
|
|
20
|
+
}) => _extends({
|
|
21
|
+
fill: (theme.vars || theme).palette.grey[600]
|
|
22
|
+
}, theme.applyStyles('dark', {
|
|
23
|
+
fill: (theme.vars || theme).palette.grey[500]
|
|
24
|
+
}), {
|
|
22
25
|
cursor: 'grab',
|
|
23
26
|
variants: [{
|
|
24
27
|
props: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
5
|
const _excluded = ["className", "onMove", "orientation", "placement", "rx", "ry"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import { styled } from '@mui/material/styles';
|
|
@@ -14,10 +14,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
14
14
|
const Rect = styled('rect')(({
|
|
15
15
|
theme
|
|
16
16
|
}) => ({
|
|
17
|
-
[`&.${chartAxisZoomSliderThumbClasses.root}`]: {
|
|
18
|
-
fill:
|
|
19
|
-
stroke:
|
|
20
|
-
},
|
|
17
|
+
[`&.${chartAxisZoomSliderThumbClasses.root}`]: _extends({
|
|
18
|
+
fill: (theme.vars || theme).palette.common.white,
|
|
19
|
+
stroke: (theme.vars || theme).palette.grey[500]
|
|
20
|
+
}, theme.applyStyles('dark', {
|
|
21
|
+
fill: (theme.vars || theme).palette.grey[300],
|
|
22
|
+
stroke: (theme.vars || theme).palette.grey[600]
|
|
23
|
+
})),
|
|
21
24
|
[`&.${chartAxisZoomSliderThumbClasses.horizontal}`]: {
|
|
22
25
|
cursor: 'ew-resize'
|
|
23
26
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
5
|
const _excluded = ["axisId", "axisDirection", "reverse", "onSelectStart", "onSelectEnd"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import { useChartContext, getSVGPoint, selectorChartAxisZoomOptionsLookup, useStore } from '@mui/x-charts/internals';
|
|
@@ -16,8 +16,11 @@ const ZoomSliderTrack = styled('rect', {
|
|
|
16
16
|
shouldForwardProp: prop => shouldForwardProp(prop) && prop !== 'axisDirection' && prop !== 'isSelecting'
|
|
17
17
|
})(({
|
|
18
18
|
theme
|
|
19
|
-
}) => ({
|
|
20
|
-
fill:
|
|
19
|
+
}) => _extends({
|
|
20
|
+
fill: (theme.vars || theme).palette.grey[300]
|
|
21
|
+
}, theme.applyStyles('dark', {
|
|
22
|
+
fill: (theme.vars || theme).palette.grey[800]
|
|
23
|
+
}), {
|
|
21
24
|
cursor: 'pointer',
|
|
22
25
|
variants: [{
|
|
23
26
|
props: {
|
|
@@ -58,6 +58,7 @@ process.env.NODE_ENV !== "production" ? ChartsToolbarImageExportTrigger.propType
|
|
|
58
58
|
options: PropTypes.shape({
|
|
59
59
|
copyStyles: PropTypes.bool,
|
|
60
60
|
fileName: PropTypes.string,
|
|
61
|
+
nonce: PropTypes.string,
|
|
61
62
|
onBeforeExport: PropTypes.func,
|
|
62
63
|
quality: PropTypes.number,
|
|
63
64
|
type: PropTypes.string.isRequired
|
|
@@ -153,6 +153,7 @@ process.env.NODE_ENV !== "production" ? ChartsToolbarPro.propTypes = {
|
|
|
153
153
|
imageExportOptions: PropTypes.arrayOf(PropTypes.shape({
|
|
154
154
|
copyStyles: PropTypes.bool,
|
|
155
155
|
fileName: PropTypes.string,
|
|
156
|
+
nonce: PropTypes.string,
|
|
156
157
|
onBeforeExport: PropTypes.func,
|
|
157
158
|
quality: PropTypes.number,
|
|
158
159
|
type: PropTypes.string.isRequired
|
|
@@ -24,11 +24,11 @@ export function calculateSankeyLayout(data, drawingArea, theme, series = {}) {
|
|
|
24
24
|
width: nodeWidth = 15,
|
|
25
25
|
padding: nodePadding = 10,
|
|
26
26
|
align: nodeAlign = 'justify',
|
|
27
|
-
sort: nodeSort
|
|
27
|
+
sort: nodeSort
|
|
28
28
|
} = nodeOptions ?? {};
|
|
29
29
|
const {
|
|
30
30
|
color: linkColor = 'source',
|
|
31
|
-
sort: linkSort
|
|
31
|
+
sort: linkSort,
|
|
32
32
|
curveCorrection = 10
|
|
33
33
|
} = linkOptions ?? {};
|
|
34
34
|
const {
|
|
@@ -53,12 +53,21 @@ export function calculateSankeyLayout(data, drawingArea, theme, series = {}) {
|
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
// Create the sankey layout generator
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
const sankeyGenerator = sankey().nodeWidth(nodeWidth).nodePadding(nodePadding).nodeAlign(getNodeAlignFunction(nodeAlign)).extent([[left, top], [width + right, height + bottom]]).nodeId(d => d.id).iterations(iterations);
|
|
57
|
+
|
|
58
|
+
// For 'auto' or undefined, don't set anything (use d3-sankey default behavior)
|
|
59
|
+
if (typeof nodeSort === 'function') {
|
|
60
|
+
sankeyGenerator.nodeSort(nodeSort);
|
|
61
|
+
} else if (nodeSort === 'fixed') {
|
|
62
|
+
// Null is not accepted by the types.
|
|
63
|
+
// https://github.com/DefinitelyTyped/DefinitelyTyped/pull/73953
|
|
64
|
+
sankeyGenerator.nodeSort(null);
|
|
59
65
|
}
|
|
60
|
-
if (linkSort) {
|
|
61
|
-
sankeyGenerator
|
|
66
|
+
if (typeof linkSort === 'function') {
|
|
67
|
+
sankeyGenerator.linkSort(linkSort);
|
|
68
|
+
} else if (linkSort === 'fixed') {
|
|
69
|
+
// Null is not accepted by the types.
|
|
70
|
+
sankeyGenerator.linkSort(null);
|
|
62
71
|
}
|
|
63
72
|
|
|
64
73
|
// Generate the layout
|
|
@@ -74,12 +74,19 @@ export type SankeyNodeOptions = {
|
|
|
74
74
|
*/
|
|
75
75
|
showLabels?: boolean;
|
|
76
76
|
/**
|
|
77
|
-
* Custom sort
|
|
77
|
+
* Custom sort mode for nodes
|
|
78
|
+
*
|
|
79
|
+
* - 'auto': Automatic sorting behavior (default)
|
|
80
|
+
* - 'fixed': Preserve the order from the nodes array (disables automatic sorting)
|
|
81
|
+
* - or a custom function
|
|
82
|
+
*
|
|
78
83
|
* @param {SankeyLayoutNode} a - First node to compare
|
|
79
84
|
* @param {SankeyLayoutNode} b - Second node to compare
|
|
80
85
|
* @returns {number} Comparison result
|
|
86
|
+
*
|
|
87
|
+
* @default 'auto'
|
|
81
88
|
*/
|
|
82
|
-
sort?: (a: SankeyLayoutNode, b: SankeyLayoutNode) => number
|
|
89
|
+
sort?: 'auto' | 'fixed' | ((a: SankeyLayoutNode, b: SankeyLayoutNode) => number);
|
|
83
90
|
} & SankeyNodeHighlightScope;
|
|
84
91
|
export type SankeyLinkOptions = {
|
|
85
92
|
/**
|
|
@@ -99,12 +106,18 @@ export type SankeyLinkOptions = {
|
|
|
99
106
|
*/
|
|
100
107
|
showValues?: boolean;
|
|
101
108
|
/**
|
|
102
|
-
* Custom sort
|
|
109
|
+
* Custom sort mode for links
|
|
110
|
+
*
|
|
111
|
+
* - 'auto': Automatic sorting behavior (default)
|
|
112
|
+
* - 'fixed': Preserve the order from the links array (disables automatic sorting)
|
|
113
|
+
* - or a custom function
|
|
114
|
+
*
|
|
103
115
|
* @param {SankeyLayoutLink} a - First link to compare
|
|
104
116
|
* @param {SankeyLayoutLink} b - Second link to compare
|
|
105
117
|
* @returns {number} Comparison result
|
|
118
|
+
* @default 'auto'
|
|
106
119
|
*/
|
|
107
|
-
sort?: (a: SankeyLayoutLink, b: SankeyLayoutLink) => number
|
|
120
|
+
sort?: 'auto' | 'fixed' | ((a: SankeyLayoutLink, b: SankeyLayoutLink) => number);
|
|
108
121
|
/**
|
|
109
122
|
* Applies the given number to the X dimension of the control points of the link's curve function.
|
|
110
123
|
* This can create better looking links between nodes, but is dependent on the graph layout.
|
package/esm/index.js
CHANGED
|
@@ -18,7 +18,8 @@ export async function exportImage(element, svg, params) {
|
|
|
18
18
|
type = 'image/png',
|
|
19
19
|
quality = 0.9,
|
|
20
20
|
onBeforeExport = defaultOnBeforeExport,
|
|
21
|
-
copyStyles = true
|
|
21
|
+
copyStyles = true,
|
|
22
|
+
nonce
|
|
22
23
|
} = params ?? {};
|
|
23
24
|
const drawDocumentPromise = getDrawDocument();
|
|
24
25
|
const doc = ownerDocument(element);
|
|
@@ -45,7 +46,7 @@ export async function exportImage(element, svg, params) {
|
|
|
45
46
|
const rootCandidate = element.getRootNode();
|
|
46
47
|
const root = rootCandidate.constructor.name === 'ShadowRoot' ? rootCandidate : doc;
|
|
47
48
|
if (copyStyles) {
|
|
48
|
-
await Promise.all(loadStyleSheets(exportDoc, root));
|
|
49
|
+
await Promise.all(loadStyleSheets(exportDoc, root, nonce));
|
|
49
50
|
}
|
|
50
51
|
resolve();
|
|
51
52
|
};
|
|
@@ -65,7 +66,8 @@ export async function exportImage(element, svg, params) {
|
|
|
65
66
|
try {
|
|
66
67
|
await drawDocument(iframe.contentDocument, canvas, {
|
|
67
68
|
// Handle retina displays: https://github.com/cburgmer/rasterizeHTML.js/blob/262b3404d1c469ce4a7750a2976dec09b8ae2d6c/examples/retina.html#L71
|
|
68
|
-
zoom: ratio
|
|
69
|
+
zoom: ratio,
|
|
70
|
+
nonce
|
|
69
71
|
});
|
|
70
72
|
} finally {
|
|
71
73
|
doc.body.removeChild(iframe);
|
|
@@ -5,7 +5,8 @@ import { defaultOnBeforeExport } from "./defaults.js";
|
|
|
5
5
|
export function printChart(element, {
|
|
6
6
|
fileName,
|
|
7
7
|
onBeforeExport = defaultOnBeforeExport,
|
|
8
|
-
copyStyles = true
|
|
8
|
+
copyStyles = true,
|
|
9
|
+
nonce
|
|
9
10
|
} = {}) {
|
|
10
11
|
const printWindow = createExportIframe(fileName);
|
|
11
12
|
const doc = ownerDocument(element);
|
|
@@ -17,7 +18,7 @@ export function printChart(element, {
|
|
|
17
18
|
const rootCandidate = element.getRootNode();
|
|
18
19
|
const root = rootCandidate.constructor.name === 'ShadowRoot' ? rootCandidate : doc;
|
|
19
20
|
if (copyStyles) {
|
|
20
|
-
await Promise.all(loadStyleSheets(printDoc, root));
|
|
21
|
+
await Promise.all(loadStyleSheets(printDoc, root, nonce));
|
|
21
22
|
}
|
|
22
23
|
const mediaQueryList = printWindow.contentWindow.matchMedia('print');
|
|
23
24
|
mediaQueryList.addEventListener('change', mql => {
|
|
@@ -24,6 +24,11 @@ export interface ChartExportOptions {
|
|
|
24
24
|
* @default true
|
|
25
25
|
*/
|
|
26
26
|
copyStyles?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* A nonce to be used for Content Security Policy (CSP) compliance.
|
|
29
|
+
* If provided, this nonce will be added to any style elements created during the export process.
|
|
30
|
+
*/
|
|
31
|
+
nonce?: string;
|
|
27
32
|
}
|
|
28
33
|
/**
|
|
29
34
|
* The options to apply on the Print export.
|
package/index.js
CHANGED
|
@@ -28,7 +28,8 @@ async function exportImage(element, svg, params) {
|
|
|
28
28
|
type = 'image/png',
|
|
29
29
|
quality = 0.9,
|
|
30
30
|
onBeforeExport = _defaults.defaultOnBeforeExport,
|
|
31
|
-
copyStyles = true
|
|
31
|
+
copyStyles = true,
|
|
32
|
+
nonce
|
|
32
33
|
} = params ?? {};
|
|
33
34
|
const drawDocumentPromise = getDrawDocument();
|
|
34
35
|
const doc = (0, _ownerDocument.default)(element);
|
|
@@ -55,7 +56,7 @@ async function exportImage(element, svg, params) {
|
|
|
55
56
|
const rootCandidate = element.getRootNode();
|
|
56
57
|
const root = rootCandidate.constructor.name === 'ShadowRoot' ? rootCandidate : doc;
|
|
57
58
|
if (copyStyles) {
|
|
58
|
-
await Promise.all((0, _export.loadStyleSheets)(exportDoc, root));
|
|
59
|
+
await Promise.all((0, _export.loadStyleSheets)(exportDoc, root, nonce));
|
|
59
60
|
}
|
|
60
61
|
resolve();
|
|
61
62
|
};
|
|
@@ -75,7 +76,8 @@ async function exportImage(element, svg, params) {
|
|
|
75
76
|
try {
|
|
76
77
|
await drawDocument(iframe.contentDocument, canvas, {
|
|
77
78
|
// Handle retina displays: https://github.com/cburgmer/rasterizeHTML.js/blob/262b3404d1c469ce4a7750a2976dec09b8ae2d6c/examples/retina.html#L71
|
|
78
|
-
zoom: ratio
|
|
79
|
+
zoom: ratio,
|
|
80
|
+
nonce
|
|
79
81
|
});
|
|
80
82
|
} finally {
|
|
81
83
|
doc.body.removeChild(iframe);
|
|
@@ -12,7 +12,8 @@ var _defaults = require("./defaults");
|
|
|
12
12
|
function printChart(element, {
|
|
13
13
|
fileName,
|
|
14
14
|
onBeforeExport = _defaults.defaultOnBeforeExport,
|
|
15
|
-
copyStyles = true
|
|
15
|
+
copyStyles = true,
|
|
16
|
+
nonce
|
|
16
17
|
} = {}) {
|
|
17
18
|
const printWindow = (0, _common.createExportIframe)(fileName);
|
|
18
19
|
const doc = (0, _ownerDocument.default)(element);
|
|
@@ -24,7 +25,7 @@ function printChart(element, {
|
|
|
24
25
|
const rootCandidate = element.getRootNode();
|
|
25
26
|
const root = rootCandidate.constructor.name === 'ShadowRoot' ? rootCandidate : doc;
|
|
26
27
|
if (copyStyles) {
|
|
27
|
-
await Promise.all((0, _export.loadStyleSheets)(printDoc, root));
|
|
28
|
+
await Promise.all((0, _export.loadStyleSheets)(printDoc, root, nonce));
|
|
28
29
|
}
|
|
29
30
|
const mediaQueryList = printWindow.contentWindow.matchMedia('print');
|
|
30
31
|
mediaQueryList.addEventListener('change', mql => {
|
|
@@ -24,6 +24,11 @@ export interface ChartExportOptions {
|
|
|
24
24
|
* @default true
|
|
25
25
|
*/
|
|
26
26
|
copyStyles?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* A nonce to be used for Content Security Policy (CSP) compliance.
|
|
29
|
+
* If provided, this nonce will be added to any style elements created during the export process.
|
|
30
|
+
*/
|
|
31
|
+
nonce?: string;
|
|
27
32
|
}
|
|
28
33
|
/**
|
|
29
34
|
* The options to apply on the Print export.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-charts-pro",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.18.0",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "The Pro plan edition of the MUI X Charts components.",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@babel/runtime": "^7.28.4",
|
|
31
|
-
"@mui/utils": "^7.3.
|
|
31
|
+
"@mui/utils": "^7.3.5",
|
|
32
32
|
"clsx": "^2.1.1",
|
|
33
33
|
"prop-types": "^15.8.1",
|
|
34
|
-
"@mui/x-charts": "8.
|
|
35
|
-
"@mui/x-
|
|
36
|
-
"@mui/x-
|
|
37
|
-
"@mui/x-
|
|
38
|
-
"@mui/x-
|
|
34
|
+
"@mui/x-charts-vendor": "8.18.0",
|
|
35
|
+
"@mui/x-license": "8.18.0",
|
|
36
|
+
"@mui/x-internals": "8.18.0",
|
|
37
|
+
"@mui/x-charts": "8.18.0",
|
|
38
|
+
"@mui/x-internal-gestures": "0.3.5"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@emotion/react": "^11.9.0",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
"optionalDependencies": {
|
|
57
|
-
"rasterizehtml": "^1.
|
|
57
|
+
"rasterizehtml": "^1.4.0"
|
|
58
58
|
},
|
|
59
59
|
"engines": {
|
|
60
60
|
"node": ">=14.0.0"
|