@mui/x-charts-pro 8.13.1 → 8.14.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/BarChartPro/BarChartPro.js +49 -37
- package/CHANGELOG.md +204 -1
- package/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
- package/FunnelChart/funnelAxisPlugin/computeAxisValue.js +38 -36
- package/Heatmap/Heatmap.js +0 -4
- package/LineChartPro/LineChartPro.js +49 -37
- package/SankeyChart/SankeyChart.d.ts +1 -1
- package/SankeyChart/SankeyChart.js +30 -0
- package/SankeyChart/SankeyChart.plugins.d.ts +3 -2
- package/SankeyChart/SankeyChart.plugins.js +2 -1
- package/SankeyChart/SankeyLinkElement.d.ts +1 -1
- package/SankeyChart/SankeyLinkElement.js +15 -2
- package/SankeyChart/SankeyNodeElement.d.ts +1 -1
- package/SankeyChart/SankeyNodeElement.js +16 -1
- package/SankeyChart/SankeyPlot.js +13 -1
- package/SankeyChart/plugins/index.d.ts +3 -0
- package/SankeyChart/plugins/index.js +49 -0
- package/SankeyChart/plugins/useSankeyHighlight.d.ts +7 -0
- package/SankeyChart/plugins/useSankeyHighlight.js +76 -0
- package/SankeyChart/plugins/useSankeyHighlight.selectors.d.ts +68 -0
- package/SankeyChart/plugins/useSankeyHighlight.selectors.js +126 -0
- package/SankeyChart/plugins/useSankeyHighlight.types.d.ts +55 -0
- package/SankeyChart/plugins/useSankeyHighlight.types.js +5 -0
- package/SankeyChart/sankey.highlight.types.d.ts +42 -0
- package/SankeyChart/sankey.highlight.types.js +6 -0
- package/SankeyChart/sankey.types.d.ts +3 -2
- package/SankeyChart/sankeyClasses.d.ts +1 -1
- package/SankeyChart/useSankeyChartProps.js +5 -5
- package/ScatterChartPro/ScatterChartPro.js +49 -37
- package/esm/BarChartPro/BarChartPro.js +49 -37
- package/esm/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
- package/esm/FunnelChart/funnelAxisPlugin/computeAxisValue.js +39 -37
- package/esm/Heatmap/Heatmap.js +0 -4
- package/esm/LineChartPro/LineChartPro.js +49 -37
- package/esm/SankeyChart/SankeyChart.d.ts +1 -1
- package/esm/SankeyChart/SankeyChart.js +30 -0
- package/esm/SankeyChart/SankeyChart.plugins.d.ts +3 -2
- package/esm/SankeyChart/SankeyChart.plugins.js +3 -4
- package/esm/SankeyChart/SankeyLinkElement.d.ts +1 -1
- package/esm/SankeyChart/SankeyLinkElement.js +16 -3
- package/esm/SankeyChart/SankeyNodeElement.d.ts +1 -1
- package/esm/SankeyChart/SankeyNodeElement.js +17 -2
- package/esm/SankeyChart/SankeyPlot.js +15 -3
- package/esm/SankeyChart/plugins/index.d.ts +3 -0
- package/esm/SankeyChart/plugins/index.js +3 -0
- package/esm/SankeyChart/plugins/useSankeyHighlight.d.ts +7 -0
- package/esm/SankeyChart/plugins/useSankeyHighlight.js +68 -0
- package/esm/SankeyChart/plugins/useSankeyHighlight.selectors.d.ts +68 -0
- package/esm/SankeyChart/plugins/useSankeyHighlight.selectors.js +120 -0
- package/esm/SankeyChart/plugins/useSankeyHighlight.types.d.ts +55 -0
- package/esm/SankeyChart/plugins/useSankeyHighlight.types.js +1 -0
- package/esm/SankeyChart/sankey.highlight.types.d.ts +42 -0
- package/esm/SankeyChart/sankey.highlight.types.js +3 -0
- package/esm/SankeyChart/sankey.types.d.ts +3 -2
- package/esm/SankeyChart/sankeyClasses.d.ts +1 -1
- package/esm/SankeyChart/useSankeyChartProps.js +5 -5
- package/esm/ScatterChartPro/ScatterChartPro.js +49 -37
- package/esm/index.js +1 -1
- package/esm/internals/plugins/useChartProZoom/ZoomInteractionConfig.selectors.d.ts +2 -6
- package/esm/internals/plugins/useChartProZoom/ZoomInteractionConfig.types.d.ts +5 -1
- package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.d.ts +8 -0
- package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.js +73 -0
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.js +2 -0
- package/index.js +1 -1
- package/internals/plugins/useChartProZoom/ZoomInteractionConfig.selectors.d.ts +2 -6
- package/internals/plugins/useChartProZoom/ZoomInteractionConfig.types.d.ts +5 -1
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.d.ts +8 -0
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.js +80 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.js +2 -0
- package/package.json +7 -7
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { SankeyLayoutLink, SankeyLayoutNode } from "../sankey.types.js";
|
|
2
|
+
import type { SankeyLinkFade, SankeyLinkHighlight, SankeyNodeFade, SankeyNodeHighlight } from "../sankey.highlight.types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Get the node highlight configuration from the Sankey series.
|
|
5
|
+
* Defaults to 'nodes' if not specified.
|
|
6
|
+
*/
|
|
7
|
+
export declare const selectorNodeHighlightConfig: import("reselect").Selector<import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types").UseChartExperimentalFeaturesState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & Partial<{}> & {
|
|
8
|
+
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
9
|
+
} & {
|
|
10
|
+
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
11
|
+
}, SankeyNodeHighlight, any[]>;
|
|
12
|
+
/**
|
|
13
|
+
* Get the node fade configuration from the Sankey series.
|
|
14
|
+
* Defaults to 'none' if not specified.
|
|
15
|
+
*/
|
|
16
|
+
export declare const selectorNodeFadeConfig: import("reselect").Selector<import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types").UseChartExperimentalFeaturesState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & Partial<{}> & {
|
|
17
|
+
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
18
|
+
} & {
|
|
19
|
+
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
20
|
+
}, SankeyNodeFade, any[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Get the link highlight configuration from the Sankey series.
|
|
23
|
+
* Defaults to 'links' if not specified.
|
|
24
|
+
*/
|
|
25
|
+
export declare const selectorLinkHighlightConfig: import("reselect").Selector<import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types").UseChartExperimentalFeaturesState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & Partial<{}> & {
|
|
26
|
+
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
27
|
+
} & {
|
|
28
|
+
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
29
|
+
}, SankeyLinkHighlight, any[]>;
|
|
30
|
+
/**
|
|
31
|
+
* Get the link fade configuration from the Sankey series.
|
|
32
|
+
* Defaults to 'none' if not specified.
|
|
33
|
+
*/
|
|
34
|
+
export declare const selectorLinkFadeConfig: import("reselect").Selector<import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types").UseChartExperimentalFeaturesState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & Partial<{}> & {
|
|
35
|
+
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
36
|
+
} & {
|
|
37
|
+
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
38
|
+
}, SankeyLinkFade, any[]>;
|
|
39
|
+
/**
|
|
40
|
+
* Get the currently highlighted item in the Sankey chart.
|
|
41
|
+
* @param {UseSankeyHighlightSignature['state']} state The state of the chart.
|
|
42
|
+
* @returns {SankeyItemIdentifier | null} The highlighted item identifier or null.
|
|
43
|
+
*/
|
|
44
|
+
export declare const selectorSankeyHighlightedItem: import("reselect").Selector<import("./useSankeyHighlight.types.js").UseSankeyHighlightState & {
|
|
45
|
+
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
46
|
+
}, import("../index.js").SankeyItemIdentifier | null, []>;
|
|
47
|
+
/**
|
|
48
|
+
* Determines if a specific node should be highlighted.
|
|
49
|
+
* A node is highlighted if:
|
|
50
|
+
* - It's the highlighted node (unless highlight mode is 'none')
|
|
51
|
+
* - It's connected to a highlighted link (based on linkOptions.highlight)
|
|
52
|
+
*/
|
|
53
|
+
export declare const selectorIsNodeHighlighted: import("reselect").Selector<any, boolean, [node: SankeyLayoutNode]>;
|
|
54
|
+
/**
|
|
55
|
+
* Selector that determines if a specific link should be highlighted.
|
|
56
|
+
* A link is highlighted if:
|
|
57
|
+
* - It's the highlighted link (unless highlight mode is 'none')
|
|
58
|
+
* - It's connected to a highlighted node (based on nodeOptions.highlight)
|
|
59
|
+
*/
|
|
60
|
+
export declare const selectorIsLinkHighlighted: import("reselect").Selector<any, boolean, [link: SankeyLayoutLink]>;
|
|
61
|
+
/**
|
|
62
|
+
* Selector that determines if an item should be faded.
|
|
63
|
+
* An item is faded if:
|
|
64
|
+
* - There's a highlighted item
|
|
65
|
+
* - This item is not highlighted
|
|
66
|
+
* - The fade mode is 'global' for the highlighted element type
|
|
67
|
+
*/
|
|
68
|
+
export declare const selectorIsSankeyItemFaded: import("reselect").Selector<any, boolean, [isHighlighted: any]>;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.selectorSankeyHighlightedItem = exports.selectorNodeHighlightConfig = exports.selectorNodeFadeConfig = exports.selectorLinkHighlightConfig = exports.selectorLinkFadeConfig = exports.selectorIsSankeyItemFaded = exports.selectorIsNodeHighlighted = exports.selectorIsLinkHighlighted = void 0;
|
|
7
|
+
var _internals = require("@mui/x-charts/internals");
|
|
8
|
+
const selectorSankeyHighlight = state => state.highlight;
|
|
9
|
+
const selectSeries = state => state.series;
|
|
10
|
+
const selectorSankeySeries = (0, _internals.createSelector)([selectSeries], series => series.processedSeries.sankey?.series[series.processedSeries.sankey?.seriesOrder[0]] || null);
|
|
11
|
+
const DEFAULT_NODE_HIGHLIGHT = 'links';
|
|
12
|
+
const DEFAULT_LINK_HIGHLIGHT = 'links';
|
|
13
|
+
const DEFAULT_FADE = 'none';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Get the node highlight configuration from the Sankey series.
|
|
17
|
+
* Defaults to 'nodes' if not specified.
|
|
18
|
+
*/
|
|
19
|
+
const selectorNodeHighlightConfig = exports.selectorNodeHighlightConfig = (0, _internals.createSelector)([selectorSankeySeries], series => series?.nodeOptions?.highlight ?? DEFAULT_NODE_HIGHLIGHT);
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Get the node fade configuration from the Sankey series.
|
|
23
|
+
* Defaults to 'none' if not specified.
|
|
24
|
+
*/
|
|
25
|
+
const selectorNodeFadeConfig = exports.selectorNodeFadeConfig = (0, _internals.createSelector)([selectorSankeySeries], series => series?.nodeOptions?.fade ?? DEFAULT_FADE);
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Get the link highlight configuration from the Sankey series.
|
|
29
|
+
* Defaults to 'links' if not specified.
|
|
30
|
+
*/
|
|
31
|
+
const selectorLinkHighlightConfig = exports.selectorLinkHighlightConfig = (0, _internals.createSelector)([selectorSankeySeries], series => series?.linkOptions?.highlight ?? DEFAULT_LINK_HIGHLIGHT);
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Get the link fade configuration from the Sankey series.
|
|
35
|
+
* Defaults to 'none' if not specified.
|
|
36
|
+
*/
|
|
37
|
+
const selectorLinkFadeConfig = exports.selectorLinkFadeConfig = (0, _internals.createSelector)([selectorSankeySeries], series => series?.linkOptions?.fade ?? DEFAULT_FADE);
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Get the currently highlighted item in the Sankey chart.
|
|
41
|
+
* @param {UseSankeyHighlightSignature['state']} state The state of the chart.
|
|
42
|
+
* @returns {SankeyItemIdentifier | null} The highlighted item identifier or null.
|
|
43
|
+
*/
|
|
44
|
+
const selectorSankeyHighlightedItem = exports.selectorSankeyHighlightedItem = (0, _internals.createSelector)([selectorSankeyHighlight], highlight => highlight.item);
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Determines if a specific node should be highlighted.
|
|
48
|
+
* A node is highlighted if:
|
|
49
|
+
* - It's the highlighted node (unless highlight mode is 'none')
|
|
50
|
+
* - It's connected to a highlighted link (based on linkOptions.highlight)
|
|
51
|
+
*/
|
|
52
|
+
const selectorIsNodeHighlighted = exports.selectorIsNodeHighlighted = (0, _internals.createSelector)([selectorSankeyHighlightedItem, selectorNodeHighlightConfig, selectorLinkHighlightConfig, (_, node) => node.id], (highlightedItem, nodeHighlight, linkHighlight, nodeId) => {
|
|
53
|
+
if (!highlightedItem) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
if (highlightedItem.subType === 'node' && highlightedItem.nodeId === nodeId) {
|
|
57
|
+
return nodeHighlight !== 'none';
|
|
58
|
+
}
|
|
59
|
+
if (highlightedItem.subType === 'link') {
|
|
60
|
+
if (!linkHighlight || linkHighlight === 'none' || linkHighlight === 'links') {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
const {
|
|
64
|
+
sourceId,
|
|
65
|
+
targetId
|
|
66
|
+
} = highlightedItem;
|
|
67
|
+
switch (linkHighlight) {
|
|
68
|
+
case 'nodes':
|
|
69
|
+
return nodeId === sourceId || nodeId === targetId;
|
|
70
|
+
case 'source':
|
|
71
|
+
return nodeId === sourceId;
|
|
72
|
+
case 'target':
|
|
73
|
+
return nodeId === targetId;
|
|
74
|
+
default:
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return false;
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Selector that determines if a specific link should be highlighted.
|
|
83
|
+
* A link is highlighted if:
|
|
84
|
+
* - It's the highlighted link (unless highlight mode is 'none')
|
|
85
|
+
* - It's connected to a highlighted node (based on nodeOptions.highlight)
|
|
86
|
+
*/
|
|
87
|
+
const selectorIsLinkHighlighted = exports.selectorIsLinkHighlighted = (0, _internals.createSelector)([selectorSankeyHighlightedItem, selectorNodeHighlightConfig, selectorLinkHighlightConfig, (_, link) => link], (highlightedItem, nodeHighlight, linkHighlight, link) => {
|
|
88
|
+
if (!highlightedItem) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
if (highlightedItem.subType === 'link' && highlightedItem.sourceId === link.source.id && highlightedItem.targetId === link.target.id) {
|
|
92
|
+
return linkHighlight !== 'none';
|
|
93
|
+
}
|
|
94
|
+
if (highlightedItem.subType === 'node') {
|
|
95
|
+
if (!nodeHighlight || nodeHighlight === 'none' || nodeHighlight === 'nodes') {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
const highlightedNodeId = highlightedItem.nodeId;
|
|
99
|
+
switch (nodeHighlight) {
|
|
100
|
+
case 'links':
|
|
101
|
+
return link.source.id === highlightedNodeId || link.target.id === highlightedNodeId;
|
|
102
|
+
case 'incoming':
|
|
103
|
+
return link.target.id === highlightedNodeId;
|
|
104
|
+
case 'outgoing':
|
|
105
|
+
return link.source.id === highlightedNodeId;
|
|
106
|
+
default:
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return false;
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Selector that determines if an item should be faded.
|
|
115
|
+
* An item is faded if:
|
|
116
|
+
* - There's a highlighted item
|
|
117
|
+
* - This item is not highlighted
|
|
118
|
+
* - The fade mode is 'global' for the highlighted element type
|
|
119
|
+
*/
|
|
120
|
+
const selectorIsSankeyItemFaded = exports.selectorIsSankeyItemFaded = (0, _internals.createSelector)([selectorSankeyHighlightedItem, selectorNodeFadeConfig, selectorLinkFadeConfig, (_, isHighlighted) => isHighlighted], (highlightedItem, nodeFade, linkFade, isHighlighted) => {
|
|
121
|
+
if (!highlightedItem || isHighlighted) {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
const fadeMode = highlightedItem.subType === 'node' ? nodeFade : linkFade;
|
|
125
|
+
return fadeMode === 'global';
|
|
126
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { DefaultizedProps } from '@mui/x-internals/types';
|
|
2
|
+
import { ChartPluginSignature } from '@mui/x-charts/internals';
|
|
3
|
+
import { SankeyItemIdentifier } from "../sankey.types.js";
|
|
4
|
+
/**
|
|
5
|
+
* The data of the highlighted item in a Sankey chart.
|
|
6
|
+
* Can be either a node or a link.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* // Highlight a node
|
|
10
|
+
* { type: 'sankey', seriesId: 'series-1', subType: 'node', nodeId: 'A' }
|
|
11
|
+
*
|
|
12
|
+
* // Highlight a link
|
|
13
|
+
* { type: 'sankey', seriesId: 'series-1', subType: 'link', sourceId: 'A', targetId: 'B' }
|
|
14
|
+
*
|
|
15
|
+
* // Clear the highlight
|
|
16
|
+
* null
|
|
17
|
+
*/
|
|
18
|
+
export type SankeyHighlightItemData = SankeyItemIdentifier;
|
|
19
|
+
export interface UseSankeyHighlightInstance {
|
|
20
|
+
/**
|
|
21
|
+
* Remove all highlight.
|
|
22
|
+
*/
|
|
23
|
+
clearHighlight: () => void;
|
|
24
|
+
/**
|
|
25
|
+
* Set the highlighted item.
|
|
26
|
+
* @param {SankeyHighlightItemData} item The item to highlight.
|
|
27
|
+
*/
|
|
28
|
+
setHighlight: (item: SankeyHighlightItemData) => void;
|
|
29
|
+
}
|
|
30
|
+
export interface UseSankeyHighlightParameters {
|
|
31
|
+
/**
|
|
32
|
+
* The highlighted item.
|
|
33
|
+
* Used when the highlight is controlled.
|
|
34
|
+
*/
|
|
35
|
+
highlightedItem?: SankeyHighlightItemData | null;
|
|
36
|
+
/**
|
|
37
|
+
* The callback fired when the highlighted item changes.
|
|
38
|
+
*
|
|
39
|
+
* @param {SankeyHighlightItemData | null} highlightedItem The newly highlighted item.
|
|
40
|
+
*/
|
|
41
|
+
onHighlightChange?: (highlightedItem: SankeyHighlightItemData | null) => void;
|
|
42
|
+
}
|
|
43
|
+
export type UseSankeyHighlightDefaultizedParameters = DefaultizedProps<UseSankeyHighlightParameters, 'highlightedItem'>;
|
|
44
|
+
export interface UseSankeyHighlightState {
|
|
45
|
+
highlight: {
|
|
46
|
+
item: SankeyHighlightItemData | null;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export type UseSankeyHighlightSignature = ChartPluginSignature<{
|
|
50
|
+
instance: UseSankeyHighlightInstance;
|
|
51
|
+
state: UseSankeyHighlightState;
|
|
52
|
+
params: UseSankeyHighlightParameters;
|
|
53
|
+
defaultizedParams: UseSankeyHighlightDefaultizedParameters;
|
|
54
|
+
modelNames: 'highlightedItem';
|
|
55
|
+
}>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type SankeyNodeHighlight = 'nodes' | 'links' | 'incoming' | 'outgoing' | 'none';
|
|
2
|
+
export type SankeyNodeFade = 'global' | 'none';
|
|
3
|
+
export type SankeyLinkHighlight = 'links' | 'nodes' | 'source' | 'target' | 'none';
|
|
4
|
+
export type SankeyLinkFade = 'global' | 'none';
|
|
5
|
+
export type SankeyNodeHighlightScope = {
|
|
6
|
+
/**
|
|
7
|
+
* Highlight mode for nodes
|
|
8
|
+
* - 'nodes': Highlight hovered node
|
|
9
|
+
* - 'links': Highlight links connected to hovered node
|
|
10
|
+
* - 'incoming': Highlight incoming links to hovered node
|
|
11
|
+
* - 'outgoing': Highlight outgoing links from hovered node
|
|
12
|
+
* - 'none': No highlighting
|
|
13
|
+
* @default 'links'
|
|
14
|
+
*/
|
|
15
|
+
highlight?: SankeyNodeHighlight;
|
|
16
|
+
/**
|
|
17
|
+
* Fade mode for nodes
|
|
18
|
+
* - 'global': Fade all non-highlighted items
|
|
19
|
+
* - 'none': No fading
|
|
20
|
+
* @default 'none'
|
|
21
|
+
*/
|
|
22
|
+
fade?: SankeyNodeFade;
|
|
23
|
+
};
|
|
24
|
+
export type SankeyLinkHighlightScope = {
|
|
25
|
+
/**
|
|
26
|
+
* Highlight mode for links
|
|
27
|
+
* - 'links': Highlight hovered link
|
|
28
|
+
* - 'nodes': Highlight nodes connected to hovered link
|
|
29
|
+
* - 'source': Highlight source node of hovered link
|
|
30
|
+
* - 'target': Highlight target node of hovered link
|
|
31
|
+
* - 'none': No highlighting
|
|
32
|
+
* @default 'links'
|
|
33
|
+
*/
|
|
34
|
+
highlight?: SankeyLinkHighlight;
|
|
35
|
+
/**
|
|
36
|
+
* Fade mode for links
|
|
37
|
+
* - 'global': Fade all non-highlighted items
|
|
38
|
+
* - 'none': No fading
|
|
39
|
+
* @default 'none'
|
|
40
|
+
*/
|
|
41
|
+
fade?: SankeyLinkFade;
|
|
42
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { HighlightScope, SeriesId } from '@mui/x-charts/internals';
|
|
2
2
|
import type { DefaultizedProps, MakeRequired } from '@mui/x-internals/types';
|
|
3
3
|
import type { SankeyLink as D3SankeyLink, SankeyNode as D3SankeyNode } from '@mui/x-charts-vendor/d3-sankey';
|
|
4
|
+
import type { SankeyLinkHighlightScope, SankeyNodeHighlightScope } from "./sankey.highlight.types.js";
|
|
4
5
|
export type SankeyNodeId = string | number;
|
|
5
6
|
export interface SankeyNode {
|
|
6
7
|
/**
|
|
@@ -79,7 +80,7 @@ export type SankeyNodeOptions = {
|
|
|
79
80
|
* @returns {number} Comparison result
|
|
80
81
|
*/
|
|
81
82
|
sort?: (a: SankeyLayoutNode, b: SankeyLayoutNode) => number | null;
|
|
82
|
-
};
|
|
83
|
+
} & SankeyNodeHighlightScope;
|
|
83
84
|
export type SankeyLinkOptions = {
|
|
84
85
|
/**
|
|
85
86
|
* Default color for links without specified colors.
|
|
@@ -111,7 +112,7 @@ export type SankeyLinkOptions = {
|
|
|
111
112
|
* @default 10
|
|
112
113
|
*/
|
|
113
114
|
curveCorrection?: number;
|
|
114
|
-
};
|
|
115
|
+
} & SankeyLinkHighlightScope;
|
|
115
116
|
export interface SankeyData {
|
|
116
117
|
/**
|
|
117
118
|
* An array of node configs for the Sankey diagram
|
|
@@ -12,4 +12,4 @@ export declare function getSankeyPlotUtilityClass(slot: string): string;
|
|
|
12
12
|
export declare const sankeyPlotClasses: SankeyPlotClasses;
|
|
13
13
|
export declare const useUtilityClasses: (ownerState: {
|
|
14
14
|
classes?: Partial<SankeyPlotClasses>;
|
|
15
|
-
}) => Record<"
|
|
15
|
+
}) => Record<"nodes" | "links" | "root" | "linkLabels", string>;
|
|
@@ -10,7 +10,7 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
|
|
|
10
10
|
var _constants = require("@mui/x-charts/constants");
|
|
11
11
|
var _internals = require("@mui/x-charts/internals");
|
|
12
12
|
var _SankeyChart = require("./SankeyChart.plugins");
|
|
13
|
-
const _excluded = ["series", "width", "height", "margin", "colors", "sx", "children", "slots", "slotProps", "loading", "className", "apiRef", "onNodeClick", "onLinkClick"];
|
|
13
|
+
const _excluded = ["series", "width", "height", "margin", "colors", "sx", "children", "slots", "slotProps", "loading", "highlightedItem", "onHighlightChange", "className", "apiRef", "onNodeClick", "onLinkClick"];
|
|
14
14
|
/**
|
|
15
15
|
* A helper function that extracts SankeyChartProps from the input props
|
|
16
16
|
* and returns an object with props for the children components of SankeyChart.
|
|
@@ -30,8 +30,8 @@ const useSankeyChartProps = props => {
|
|
|
30
30
|
slots,
|
|
31
31
|
slotProps,
|
|
32
32
|
loading,
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
highlightedItem,
|
|
34
|
+
onHighlightChange,
|
|
35
35
|
className,
|
|
36
36
|
apiRef,
|
|
37
37
|
onNodeClick,
|
|
@@ -48,8 +48,8 @@ const useSankeyChartProps = props => {
|
|
|
48
48
|
margin,
|
|
49
49
|
colors,
|
|
50
50
|
sx,
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
highlightedItem,
|
|
52
|
+
onHighlightChange,
|
|
53
53
|
className,
|
|
54
54
|
apiRef,
|
|
55
55
|
plugins: _SankeyChart.SANKEY_CHART_PLUGINS
|
|
@@ -306,8 +306,6 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
306
306
|
ignoreTooltip: _propTypes.default.bool,
|
|
307
307
|
label: _propTypes.default.string,
|
|
308
308
|
labelStyle: _propTypes.default.object,
|
|
309
|
-
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
310
|
-
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
311
309
|
offset: _propTypes.default.number,
|
|
312
310
|
position: _propTypes.default.oneOf(['bottom', 'none', 'top']),
|
|
313
311
|
reverse: _propTypes.default.bool,
|
|
@@ -375,8 +373,6 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
375
373
|
ignoreTooltip: _propTypes.default.bool,
|
|
376
374
|
label: _propTypes.default.string,
|
|
377
375
|
labelStyle: _propTypes.default.object,
|
|
378
|
-
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
379
|
-
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
380
376
|
offset: _propTypes.default.number,
|
|
381
377
|
position: _propTypes.default.oneOf(['bottom', 'none', 'top']),
|
|
382
378
|
reverse: _propTypes.default.bool,
|
|
@@ -434,8 +430,8 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
434
430
|
ignoreTooltip: _propTypes.default.bool,
|
|
435
431
|
label: _propTypes.default.string,
|
|
436
432
|
labelStyle: _propTypes.default.object,
|
|
437
|
-
max: _propTypes.default.
|
|
438
|
-
min: _propTypes.default.
|
|
433
|
+
max: _propTypes.default.number,
|
|
434
|
+
min: _propTypes.default.number,
|
|
439
435
|
offset: _propTypes.default.number,
|
|
440
436
|
position: _propTypes.default.oneOf(['bottom', 'none', 'top']),
|
|
441
437
|
reverse: _propTypes.default.bool,
|
|
@@ -494,8 +490,8 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
494
490
|
ignoreTooltip: _propTypes.default.bool,
|
|
495
491
|
label: _propTypes.default.string,
|
|
496
492
|
labelStyle: _propTypes.default.object,
|
|
497
|
-
max: _propTypes.default.
|
|
498
|
-
min: _propTypes.default.
|
|
493
|
+
max: _propTypes.default.number,
|
|
494
|
+
min: _propTypes.default.number,
|
|
499
495
|
offset: _propTypes.default.number,
|
|
500
496
|
position: _propTypes.default.oneOf(['bottom', 'none', 'top']),
|
|
501
497
|
reverse: _propTypes.default.bool,
|
|
@@ -553,8 +549,8 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
553
549
|
ignoreTooltip: _propTypes.default.bool,
|
|
554
550
|
label: _propTypes.default.string,
|
|
555
551
|
labelStyle: _propTypes.default.object,
|
|
556
|
-
max: _propTypes.default.
|
|
557
|
-
min: _propTypes.default.
|
|
552
|
+
max: _propTypes.default.number,
|
|
553
|
+
min: _propTypes.default.number,
|
|
558
554
|
offset: _propTypes.default.number,
|
|
559
555
|
position: _propTypes.default.oneOf(['bottom', 'none', 'top']),
|
|
560
556
|
reverse: _propTypes.default.bool,
|
|
@@ -612,8 +608,8 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
612
608
|
ignoreTooltip: _propTypes.default.bool,
|
|
613
609
|
label: _propTypes.default.string,
|
|
614
610
|
labelStyle: _propTypes.default.object,
|
|
615
|
-
max: _propTypes.default.
|
|
616
|
-
min: _propTypes.default.
|
|
611
|
+
max: _propTypes.default.number,
|
|
612
|
+
min: _propTypes.default.number,
|
|
617
613
|
offset: _propTypes.default.number,
|
|
618
614
|
position: _propTypes.default.oneOf(['bottom', 'none', 'top']),
|
|
619
615
|
reverse: _propTypes.default.bool,
|
|
@@ -671,8 +667,12 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
671
667
|
ignoreTooltip: _propTypes.default.bool,
|
|
672
668
|
label: _propTypes.default.string,
|
|
673
669
|
labelStyle: _propTypes.default.object,
|
|
674
|
-
max: _propTypes.default.oneOfType([_propTypes.default.
|
|
675
|
-
|
|
670
|
+
max: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
|
|
671
|
+
valueOf: _propTypes.default.func.isRequired
|
|
672
|
+
})]),
|
|
673
|
+
min: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
|
|
674
|
+
valueOf: _propTypes.default.func.isRequired
|
|
675
|
+
})]),
|
|
676
676
|
offset: _propTypes.default.number,
|
|
677
677
|
position: _propTypes.default.oneOf(['bottom', 'none', 'top']),
|
|
678
678
|
reverse: _propTypes.default.bool,
|
|
@@ -730,8 +730,12 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
730
730
|
ignoreTooltip: _propTypes.default.bool,
|
|
731
731
|
label: _propTypes.default.string,
|
|
732
732
|
labelStyle: _propTypes.default.object,
|
|
733
|
-
max: _propTypes.default.oneOfType([_propTypes.default.
|
|
734
|
-
|
|
733
|
+
max: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
|
|
734
|
+
valueOf: _propTypes.default.func.isRequired
|
|
735
|
+
})]),
|
|
736
|
+
min: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
|
|
737
|
+
valueOf: _propTypes.default.func.isRequired
|
|
738
|
+
})]),
|
|
735
739
|
offset: _propTypes.default.number,
|
|
736
740
|
position: _propTypes.default.oneOf(['bottom', 'none', 'top']),
|
|
737
741
|
reverse: _propTypes.default.bool,
|
|
@@ -789,8 +793,8 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
789
793
|
ignoreTooltip: _propTypes.default.bool,
|
|
790
794
|
label: _propTypes.default.string,
|
|
791
795
|
labelStyle: _propTypes.default.object,
|
|
792
|
-
max: _propTypes.default.
|
|
793
|
-
min: _propTypes.default.
|
|
796
|
+
max: _propTypes.default.number,
|
|
797
|
+
min: _propTypes.default.number,
|
|
794
798
|
offset: _propTypes.default.number,
|
|
795
799
|
position: _propTypes.default.oneOf(['bottom', 'none', 'top']),
|
|
796
800
|
reverse: _propTypes.default.bool,
|
|
@@ -865,8 +869,6 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
865
869
|
ignoreTooltip: _propTypes.default.bool,
|
|
866
870
|
label: _propTypes.default.string,
|
|
867
871
|
labelStyle: _propTypes.default.object,
|
|
868
|
-
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
869
|
-
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
870
872
|
offset: _propTypes.default.number,
|
|
871
873
|
position: _propTypes.default.oneOf(['left', 'none', 'right']),
|
|
872
874
|
reverse: _propTypes.default.bool,
|
|
@@ -933,8 +935,6 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
933
935
|
ignoreTooltip: _propTypes.default.bool,
|
|
934
936
|
label: _propTypes.default.string,
|
|
935
937
|
labelStyle: _propTypes.default.object,
|
|
936
|
-
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
937
|
-
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
938
938
|
offset: _propTypes.default.number,
|
|
939
939
|
position: _propTypes.default.oneOf(['left', 'none', 'right']),
|
|
940
940
|
reverse: _propTypes.default.bool,
|
|
@@ -991,8 +991,8 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
991
991
|
ignoreTooltip: _propTypes.default.bool,
|
|
992
992
|
label: _propTypes.default.string,
|
|
993
993
|
labelStyle: _propTypes.default.object,
|
|
994
|
-
max: _propTypes.default.
|
|
995
|
-
min: _propTypes.default.
|
|
994
|
+
max: _propTypes.default.number,
|
|
995
|
+
min: _propTypes.default.number,
|
|
996
996
|
offset: _propTypes.default.number,
|
|
997
997
|
position: _propTypes.default.oneOf(['left', 'none', 'right']),
|
|
998
998
|
reverse: _propTypes.default.bool,
|
|
@@ -1050,8 +1050,8 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
1050
1050
|
ignoreTooltip: _propTypes.default.bool,
|
|
1051
1051
|
label: _propTypes.default.string,
|
|
1052
1052
|
labelStyle: _propTypes.default.object,
|
|
1053
|
-
max: _propTypes.default.
|
|
1054
|
-
min: _propTypes.default.
|
|
1053
|
+
max: _propTypes.default.number,
|
|
1054
|
+
min: _propTypes.default.number,
|
|
1055
1055
|
offset: _propTypes.default.number,
|
|
1056
1056
|
position: _propTypes.default.oneOf(['left', 'none', 'right']),
|
|
1057
1057
|
reverse: _propTypes.default.bool,
|
|
@@ -1108,8 +1108,8 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
1108
1108
|
ignoreTooltip: _propTypes.default.bool,
|
|
1109
1109
|
label: _propTypes.default.string,
|
|
1110
1110
|
labelStyle: _propTypes.default.object,
|
|
1111
|
-
max: _propTypes.default.
|
|
1112
|
-
min: _propTypes.default.
|
|
1111
|
+
max: _propTypes.default.number,
|
|
1112
|
+
min: _propTypes.default.number,
|
|
1113
1113
|
offset: _propTypes.default.number,
|
|
1114
1114
|
position: _propTypes.default.oneOf(['left', 'none', 'right']),
|
|
1115
1115
|
reverse: _propTypes.default.bool,
|
|
@@ -1166,8 +1166,8 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
1166
1166
|
ignoreTooltip: _propTypes.default.bool,
|
|
1167
1167
|
label: _propTypes.default.string,
|
|
1168
1168
|
labelStyle: _propTypes.default.object,
|
|
1169
|
-
max: _propTypes.default.
|
|
1170
|
-
min: _propTypes.default.
|
|
1169
|
+
max: _propTypes.default.number,
|
|
1170
|
+
min: _propTypes.default.number,
|
|
1171
1171
|
offset: _propTypes.default.number,
|
|
1172
1172
|
position: _propTypes.default.oneOf(['left', 'none', 'right']),
|
|
1173
1173
|
reverse: _propTypes.default.bool,
|
|
@@ -1224,8 +1224,12 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
1224
1224
|
ignoreTooltip: _propTypes.default.bool,
|
|
1225
1225
|
label: _propTypes.default.string,
|
|
1226
1226
|
labelStyle: _propTypes.default.object,
|
|
1227
|
-
max: _propTypes.default.oneOfType([_propTypes.default.
|
|
1228
|
-
|
|
1227
|
+
max: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
|
|
1228
|
+
valueOf: _propTypes.default.func.isRequired
|
|
1229
|
+
})]),
|
|
1230
|
+
min: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
|
|
1231
|
+
valueOf: _propTypes.default.func.isRequired
|
|
1232
|
+
})]),
|
|
1229
1233
|
offset: _propTypes.default.number,
|
|
1230
1234
|
position: _propTypes.default.oneOf(['left', 'none', 'right']),
|
|
1231
1235
|
reverse: _propTypes.default.bool,
|
|
@@ -1282,8 +1286,12 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
1282
1286
|
ignoreTooltip: _propTypes.default.bool,
|
|
1283
1287
|
label: _propTypes.default.string,
|
|
1284
1288
|
labelStyle: _propTypes.default.object,
|
|
1285
|
-
max: _propTypes.default.oneOfType([_propTypes.default.
|
|
1286
|
-
|
|
1289
|
+
max: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
|
|
1290
|
+
valueOf: _propTypes.default.func.isRequired
|
|
1291
|
+
})]),
|
|
1292
|
+
min: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
|
|
1293
|
+
valueOf: _propTypes.default.func.isRequired
|
|
1294
|
+
})]),
|
|
1287
1295
|
offset: _propTypes.default.number,
|
|
1288
1296
|
position: _propTypes.default.oneOf(['left', 'none', 'right']),
|
|
1289
1297
|
reverse: _propTypes.default.bool,
|
|
@@ -1340,8 +1348,8 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
1340
1348
|
ignoreTooltip: _propTypes.default.bool,
|
|
1341
1349
|
label: _propTypes.default.string,
|
|
1342
1350
|
labelStyle: _propTypes.default.object,
|
|
1343
|
-
max: _propTypes.default.
|
|
1344
|
-
min: _propTypes.default.
|
|
1351
|
+
max: _propTypes.default.number,
|
|
1352
|
+
min: _propTypes.default.number,
|
|
1345
1353
|
offset: _propTypes.default.number,
|
|
1346
1354
|
position: _propTypes.default.oneOf(['left', 'none', 'right']),
|
|
1347
1355
|
reverse: _propTypes.default.bool,
|
|
@@ -1413,10 +1421,14 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
1413
1421
|
* Configuration for zoom interactions.
|
|
1414
1422
|
*/
|
|
1415
1423
|
zoomInteractionConfig: _propTypes.default.shape({
|
|
1416
|
-
pan: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf(['drag']), _propTypes.default.shape({
|
|
1424
|
+
pan: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf(['drag', 'pressAndDrag']), _propTypes.default.shape({
|
|
1417
1425
|
pointerMode: _propTypes.default.oneOf(['mouse', 'touch']),
|
|
1418
1426
|
requiredKeys: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
1419
1427
|
type: _propTypes.default.oneOf(['drag']).isRequired
|
|
1428
|
+
}), _propTypes.default.shape({
|
|
1429
|
+
pointerMode: _propTypes.default.oneOf(['mouse', 'touch']),
|
|
1430
|
+
requiredKeys: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
1431
|
+
type: _propTypes.default.oneOf(['pressAndDrag']).isRequired
|
|
1420
1432
|
})]).isRequired),
|
|
1421
1433
|
zoom: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf(['pinch', 'tapAndDrag', 'wheel']), _propTypes.default.shape({
|
|
1422
1434
|
pointerMode: _propTypes.default.any,
|