@mui/x-charts 8.22.1 → 8.24.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/BarChart/BarChart.js +39 -0
- package/BarChart/BarChart.plugins.d.ts +2 -1
- package/BarChart/BarChart.plugins.js +2 -1
- package/BarChart/BarElement.js +1 -1
- package/BarChart/BarLabel/BarLabel.d.ts +2 -0
- package/BarChart/BarLabel/BarLabel.js +8 -3
- package/BarChart/BarLabel/BarLabelItem.d.ts +2 -0
- package/BarChart/BarLabel/BarLabelItem.js +4 -2
- package/BarChart/BarPlot.d.ts +12 -2
- package/BarChart/BarPlot.js +29 -86
- package/BarChart/BatchBarPlot/BarGroup.d.ts +15 -0
- package/BarChart/BatchBarPlot/BarGroup.js +142 -0
- package/BarChart/BatchBarPlot/BatchBarPlot.d.ts +12 -0
- package/BarChart/BatchBarPlot/BatchBarPlot.js +140 -0
- package/BarChart/BatchBarPlot/index.d.ts +1 -0
- package/BarChart/BatchBarPlot/index.js +12 -0
- package/BarChart/BatchBarPlot/useCreateBarPaths.d.ts +8 -0
- package/BarChart/BatchBarPlot/useCreateBarPaths.js +53 -0
- package/BarChart/FocusedBar.js +6 -2
- package/BarChart/IndividualBarPlot.d.ts +21 -0
- package/BarChart/IndividualBarPlot.js +106 -0
- package/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.ts +1 -1
- package/BarChart/seriesConfig/bar/keyboardFocusHandler.d.ts +3 -0
- package/BarChart/seriesConfig/bar/keyboardFocusHandler.js +23 -0
- package/BarChart/seriesConfig/bar/legend.js +1 -0
- package/BarChart/seriesConfig/bar/seriesProcessor.js +2 -2
- package/BarChart/seriesConfig/index.js +5 -1
- package/BarChart/types.d.ts +2 -0
- package/BarChart/useBarChartProps.d.ts +6 -2
- package/BarChart/useBarChartProps.js +4 -2
- package/BarChart/useBarPlotData.d.ts +1 -1
- package/BarChart/useBarPlotData.js +23 -4
- package/BarChart/useRegisterItemClickHandlers.d.ts +6 -0
- package/BarChart/useRegisterItemClickHandlers.js +72 -0
- package/CHANGELOG.md +211 -0
- package/ChartContainer/ChartContainer.js +34 -0
- package/ChartContainer/useChartContainerProps.js +6 -2
- package/ChartsLegend/ChartsLegend.js +2 -2
- package/ChartsLegend/legendContext.types.d.ts +12 -0
- package/ChartsLegend/onClickContextBuilder.js +2 -1
- package/ChartsOverlay/ChartsLoadingOverlay.js +4 -1
- package/ChartsOverlay/ChartsNoDataOverlay.js +4 -1
- package/ChartsReferenceLine/common.d.ts +1 -1
- package/ChartsReferenceLine/common.js +4 -1
- package/ChartsTooltip/ChartsTooltipContainer.js +25 -21
- package/Gauge/GaugeContainer.js +4 -1
- package/LineChart/AnimatedLine.js +7 -3
- package/LineChart/AppearingMask.js +4 -1
- package/LineChart/CircleMarkElement.d.ts +5 -0
- package/LineChart/CircleMarkElement.js +13 -5
- package/LineChart/FocusedLineMark.js +6 -2
- package/LineChart/LineChart.js +30 -0
- package/LineChart/LineChart.plugins.d.ts +2 -1
- package/LineChart/LineChart.plugins.js +2 -1
- package/LineChart/LineElement.d.ts +4 -0
- package/LineChart/LineElement.js +7 -3
- package/LineChart/MarkElement.d.ts +5 -0
- package/LineChart/MarkElement.js +17 -10
- package/LineChart/markElementClasses.d.ts +0 -1
- package/LineChart/seriesConfig/index.js +5 -1
- package/LineChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
- package/LineChart/seriesConfig/keyboardFocusHandler.js +23 -0
- package/LineChart/seriesConfig/legend.js +1 -0
- package/LineChart/seriesConfig/seriesProcessor.js +2 -2
- package/PieChart/FocusedPieArc.js +6 -3
- package/PieChart/PieArcLabel.d.ts +2 -0
- package/PieChart/PieArcLabel.js +5 -2
- package/PieChart/PieChart.js +35 -5
- package/PieChart/PieChart.plugins.d.ts +2 -1
- package/PieChart/PieChart.plugins.js +2 -1
- package/PieChart/dataTransform/useTransformData.js +1 -1
- package/PieChart/seriesConfig/index.js +5 -1
- package/PieChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
- package/PieChart/seriesConfig/keyboardFocusHandler.js +23 -0
- package/PieChart/seriesConfig/legend.js +6 -3
- package/RadarChart/RadarChart.js +30 -0
- package/RadarChart/RadarChart.plugins.d.ts +3 -2
- package/RadarChart/RadarChart.plugins.js +2 -1
- package/RadarChart/seriesConfig/index.js +3 -1
- package/RadarChart/seriesConfig/legend.js +1 -0
- package/ScatterChart/BatchScatter.js +8 -14
- package/ScatterChart/FocusedScatterMark.js +1 -1
- package/ScatterChart/ScatterChart.js +30 -0
- package/ScatterChart/ScatterChart.plugins.d.ts +2 -1
- package/ScatterChart/ScatterChart.plugins.js +2 -1
- package/ScatterChart/seriesConfig/index.js +5 -1
- package/ScatterChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
- package/ScatterChart/seriesConfig/keyboardFocusHandler.js +23 -0
- package/ScatterChart/seriesConfig/legend.js +1 -0
- package/SparkLineChart/SparkLineChart.js +46 -0
- package/esm/BarChart/BarChart.js +39 -0
- package/esm/BarChart/BarChart.plugins.d.ts +2 -1
- package/esm/BarChart/BarChart.plugins.js +2 -1
- package/esm/BarChart/BarElement.js +1 -1
- package/esm/BarChart/BarLabel/BarLabel.d.ts +2 -0
- package/esm/BarChart/BarLabel/BarLabel.js +8 -3
- package/esm/BarChart/BarLabel/BarLabelItem.d.ts +2 -0
- package/esm/BarChart/BarLabel/BarLabelItem.js +4 -2
- package/esm/BarChart/BarPlot.d.ts +12 -2
- package/esm/BarChart/BarPlot.js +29 -86
- package/esm/BarChart/BatchBarPlot/BarGroup.d.ts +15 -0
- package/esm/BarChart/BatchBarPlot/BarGroup.js +134 -0
- package/esm/BarChart/BatchBarPlot/BatchBarPlot.d.ts +12 -0
- package/esm/BarChart/BatchBarPlot/BatchBarPlot.js +133 -0
- package/esm/BarChart/BatchBarPlot/index.d.ts +1 -0
- package/esm/BarChart/BatchBarPlot/index.js +1 -0
- package/esm/BarChart/BatchBarPlot/useCreateBarPaths.d.ts +8 -0
- package/esm/BarChart/BatchBarPlot/useCreateBarPaths.js +46 -0
- package/esm/BarChart/FocusedBar.js +6 -2
- package/esm/BarChart/IndividualBarPlot.d.ts +21 -0
- package/esm/BarChart/IndividualBarPlot.js +98 -0
- package/esm/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.ts +1 -1
- package/esm/BarChart/seriesConfig/bar/keyboardFocusHandler.d.ts +3 -0
- package/esm/BarChart/seriesConfig/bar/keyboardFocusHandler.js +17 -0
- package/esm/BarChart/seriesConfig/bar/legend.js +1 -0
- package/esm/BarChart/seriesConfig/bar/seriesProcessor.js +1 -1
- package/esm/BarChart/seriesConfig/index.js +5 -1
- package/esm/BarChart/types.d.ts +2 -0
- package/esm/BarChart/useBarChartProps.d.ts +6 -2
- package/esm/BarChart/useBarChartProps.js +4 -3
- package/esm/BarChart/useBarPlotData.d.ts +1 -1
- package/esm/BarChart/useBarPlotData.js +20 -1
- package/esm/BarChart/useRegisterItemClickHandlers.d.ts +6 -0
- package/esm/BarChart/useRegisterItemClickHandlers.js +67 -0
- package/esm/ChartContainer/ChartContainer.js +34 -0
- package/esm/ChartContainer/useChartContainerProps.js +6 -2
- package/esm/ChartsLegend/ChartsLegend.js +2 -2
- package/esm/ChartsLegend/legendContext.types.d.ts +12 -0
- package/esm/ChartsLegend/onClickContextBuilder.js +2 -1
- package/esm/ChartsOverlay/ChartsLoadingOverlay.js +4 -1
- package/esm/ChartsOverlay/ChartsNoDataOverlay.js +4 -1
- package/esm/ChartsReferenceLine/common.d.ts +1 -1
- package/esm/ChartsReferenceLine/common.js +4 -1
- package/esm/ChartsTooltip/ChartsTooltipContainer.js +26 -22
- package/esm/Gauge/GaugeContainer.js +4 -1
- package/esm/LineChart/AnimatedLine.js +7 -3
- package/esm/LineChart/AppearingMask.js +4 -1
- package/esm/LineChart/CircleMarkElement.d.ts +5 -0
- package/esm/LineChart/CircleMarkElement.js +13 -5
- package/esm/LineChart/FocusedLineMark.js +6 -2
- package/esm/LineChart/LineChart.js +30 -0
- package/esm/LineChart/LineChart.plugins.d.ts +2 -1
- package/esm/LineChart/LineChart.plugins.js +2 -1
- package/esm/LineChart/LineElement.d.ts +4 -0
- package/esm/LineChart/LineElement.js +7 -3
- package/esm/LineChart/MarkElement.d.ts +5 -0
- package/esm/LineChart/MarkElement.js +17 -10
- package/esm/LineChart/markElementClasses.d.ts +0 -1
- package/esm/LineChart/seriesConfig/index.js +5 -1
- package/esm/LineChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
- package/esm/LineChart/seriesConfig/keyboardFocusHandler.js +17 -0
- package/esm/LineChart/seriesConfig/legend.js +1 -0
- package/esm/LineChart/seriesConfig/seriesProcessor.js +1 -1
- package/esm/PieChart/FocusedPieArc.js +5 -2
- package/esm/PieChart/PieArcLabel.d.ts +2 -0
- package/esm/PieChart/PieArcLabel.js +5 -2
- package/esm/PieChart/PieChart.js +35 -5
- package/esm/PieChart/PieChart.plugins.d.ts +2 -1
- package/esm/PieChart/PieChart.plugins.js +2 -1
- package/esm/PieChart/dataTransform/useTransformData.js +1 -1
- package/esm/PieChart/seriesConfig/index.js +5 -1
- package/esm/PieChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
- package/esm/PieChart/seriesConfig/keyboardFocusHandler.js +17 -0
- package/esm/PieChart/seriesConfig/legend.js +6 -3
- package/esm/RadarChart/RadarChart.js +30 -0
- package/esm/RadarChart/RadarChart.plugins.d.ts +3 -2
- package/esm/RadarChart/RadarChart.plugins.js +2 -1
- package/esm/RadarChart/seriesConfig/index.js +3 -1
- package/esm/RadarChart/seriesConfig/legend.js +1 -0
- package/esm/ScatterChart/BatchScatter.js +5 -11
- package/esm/ScatterChart/FocusedScatterMark.js +1 -1
- package/esm/ScatterChart/ScatterChart.js +30 -0
- package/esm/ScatterChart/ScatterChart.plugins.d.ts +2 -1
- package/esm/ScatterChart/ScatterChart.plugins.js +2 -1
- package/esm/ScatterChart/seriesConfig/index.js +5 -1
- package/esm/ScatterChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
- package/esm/ScatterChart/seriesConfig/keyboardFocusHandler.js +17 -0
- package/esm/ScatterChart/seriesConfig/legend.js +1 -0
- package/esm/SparkLineChart/SparkLineChart.js +46 -0
- package/esm/hooks/useFocusedItem.d.ts +1 -12
- package/esm/hooks/useFocusedItem.js +3 -10
- package/esm/hooks/useIsItemFocused.d.ts +4 -3
- package/esm/hooks/useIsItemFocused.js +1 -1
- package/esm/hooks/useIsItemFocusedGetter.d.ts +3 -2
- package/esm/hooks/useIsItemFocusedGetter.js +2 -1
- package/esm/index.js +1 -1
- package/esm/internals/appendAtKey.d.ts +8 -0
- package/esm/internals/appendAtKey.js +17 -0
- package/esm/internals/commonNextFocusItem.d.ts +14 -0
- package/esm/internals/commonNextFocusItem.js +88 -0
- package/esm/internals/getBarDimensions.d.ts +1 -2
- package/esm/internals/identifierSerializer.d.ts +9 -0
- package/esm/internals/identifierSerializer.js +6 -0
- package/esm/internals/index.d.ts +7 -3
- package/esm/internals/index.js +7 -3
- package/esm/internals/invertScale.d.ts +6 -2
- package/esm/internals/invertScale.js +9 -1
- package/esm/internals/plugins/allPlugins.d.ts +4 -3
- package/esm/internals/plugins/allPlugins.js +2 -1
- package/esm/internals/plugins/corePlugins/useChartSeries/serializeIdentifier.d.ts +14 -0
- package/esm/internals/plugins/corePlugins/useChartSeries/serializeIdentifier.js +18 -0
- package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.js +8 -1
- package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.types.d.ts +12 -1
- package/esm/internals/plugins/featurePlugins/shared/useRegisterPointerInteractions.d.ts +11 -0
- package/esm/internals/plugins/featurePlugins/shared/useRegisterPointerInteractions.js +74 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +20 -3
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +10 -3
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPosition.selectors.d.ts +4 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPosition.selectors.js +83 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/keyboardFocusHandler.types.d.ts +13 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/keyboardFocusHandler.types.js +1 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.d.ts +2 -2
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +12 -105
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +5 -31
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +9 -15
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +6 -21
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.js +6 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.d.ts +15 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.js +18 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNonEmptySeriesArray.d.ts +7 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNonEmptySeriesArray.js +9 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries.d.ts +11 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries.js +18 -0
- package/esm/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.ts +2 -10
- package/esm/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.js +2 -2
- package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/index.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/index.js +3 -0
- package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/isIdentifierVisible.d.ts +4 -0
- package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/isIdentifierVisible.js +5 -0
- package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.js +78 -0
- package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.selectors.d.ts +16 -0
- package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.selectors.js +19 -0
- package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.types.d.ts +90 -0
- package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.types.js +1 -0
- package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/visibilityParamToMap.d.ts +4 -0
- package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/visibilityParamToMap.js +11 -0
- package/esm/internals/plugins/models/seriesConfig/identifierSerializer.types.d.ts +2 -0
- package/esm/internals/plugins/models/seriesConfig/identifierSerializer.types.js +1 -0
- package/esm/internals/plugins/models/seriesConfig/index.d.ts +2 -1
- package/esm/internals/plugins/models/seriesConfig/index.js +2 -1
- package/esm/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +9 -0
- package/esm/internals/plugins/models/seriesConfig/seriesProcessor.types.d.ts +1 -1
- package/esm/internals/seriesHasData.d.ts +4 -0
- package/esm/internals/seriesHasData.js +8 -0
- package/esm/internals/stacking/index.d.ts +1 -0
- package/esm/internals/stacking/index.js +1 -0
- package/esm/internals/stacking/offset/index.d.ts +1 -0
- package/esm/internals/stacking/offset/index.js +1 -0
- package/esm/internals/stacking/offset/offsetDiverging.d.ts +8 -0
- package/esm/internals/stacking/offset/offsetDiverging.js +47 -0
- package/esm/internals/{stackSeries.d.ts → stacking/stackSeries.d.ts} +8 -8
- package/esm/internals/{stackSeries.js → stacking/stackSeries.js} +8 -6
- package/esm/models/axis.d.ts +5 -4
- package/esm/models/featureFlags.d.ts +1 -0
- package/esm/models/featureFlags.js +1 -0
- package/esm/models/index.d.ts +1 -0
- package/esm/models/index.js +1 -0
- package/esm/models/seriesType/index.d.ts +3 -1
- package/esm/moduleAugmentation/barChartBatchRendererOnItemClick.d.ts +13 -0
- package/esm/moduleAugmentation/barChartBatchRendererOnItemClick.js +1 -0
- package/hooks/useFocusedItem.d.ts +1 -12
- package/hooks/useFocusedItem.js +1 -10
- package/hooks/useIsItemFocused.d.ts +4 -3
- package/hooks/useIsItemFocused.js +1 -1
- package/hooks/useIsItemFocusedGetter.d.ts +3 -2
- package/hooks/useIsItemFocusedGetter.js +2 -1
- package/index.js +1 -1
- package/internals/appendAtKey.d.ts +8 -0
- package/internals/appendAtKey.js +23 -0
- package/internals/commonNextFocusItem.d.ts +14 -0
- package/internals/commonNextFocusItem.js +97 -0
- package/internals/getBarDimensions.d.ts +1 -2
- package/internals/identifierSerializer.d.ts +9 -0
- package/internals/identifierSerializer.js +16 -0
- package/internals/index.d.ts +7 -3
- package/internals/index.js +55 -11
- package/internals/invertScale.d.ts +6 -2
- package/internals/invertScale.js +10 -1
- package/internals/plugins/allPlugins.d.ts +4 -3
- package/internals/plugins/allPlugins.js +2 -1
- package/internals/plugins/corePlugins/useChartSeries/serializeIdentifier.d.ts +14 -0
- package/internals/plugins/corePlugins/useChartSeries/serializeIdentifier.js +25 -0
- package/internals/plugins/corePlugins/useChartSeries/useChartSeries.js +8 -1
- package/internals/plugins/corePlugins/useChartSeries/useChartSeries.types.d.ts +12 -1
- package/internals/plugins/featurePlugins/shared/useRegisterPointerInteractions.d.ts +11 -0
- package/internals/plugins/featurePlugins/shared/useRegisterPointerInteractions.js +81 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +20 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +10 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPosition.selectors.d.ts +4 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPosition.selectors.js +89 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/keyboardFocusHandler.types.d.ts +13 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/keyboardFocusHandler.types.js +5 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.d.ts +2 -2
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +11 -104
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +5 -31
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +10 -16
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +6 -21
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.js +12 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.d.ts +15 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.js +23 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNonEmptySeriesArray.d.ts +7 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNonEmptySeriesArray.js +15 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries.d.ts +11 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries.js +23 -0
- package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.ts +2 -10
- package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.js +1 -1
- package/internals/plugins/featurePlugins/useChartVisibilityManager/index.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartVisibilityManager/index.js +39 -0
- package/internals/plugins/featurePlugins/useChartVisibilityManager/isIdentifierVisible.d.ts +4 -0
- package/internals/plugins/featurePlugins/useChartVisibilityManager/isIdentifierVisible.js +12 -0
- package/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.js +85 -0
- package/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.selectors.d.ts +16 -0
- package/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.selectors.js +25 -0
- package/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.types.d.ts +90 -0
- package/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.types.js +5 -0
- package/internals/plugins/featurePlugins/useChartVisibilityManager/visibilityParamToMap.d.ts +4 -0
- package/internals/plugins/featurePlugins/useChartVisibilityManager/visibilityParamToMap.js +18 -0
- package/internals/plugins/models/seriesConfig/identifierSerializer.types.d.ts +2 -0
- package/internals/plugins/models/seriesConfig/identifierSerializer.types.js +5 -0
- package/internals/plugins/models/seriesConfig/index.d.ts +2 -1
- package/internals/plugins/models/seriesConfig/index.js +11 -0
- package/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +9 -0
- package/internals/plugins/models/seriesConfig/seriesProcessor.types.d.ts +1 -1
- package/internals/seriesHasData.d.ts +4 -0
- package/internals/seriesHasData.js +14 -0
- package/internals/stacking/index.d.ts +1 -0
- package/internals/stacking/index.js +16 -0
- package/internals/stacking/offset/index.d.ts +1 -0
- package/internals/stacking/offset/index.js +16 -0
- package/internals/stacking/offset/offsetDiverging.d.ts +8 -0
- package/internals/stacking/offset/offsetDiverging.js +53 -0
- package/internals/{stackSeries.d.ts → stacking/stackSeries.d.ts} +8 -8
- package/internals/{stackSeries.js → stacking/stackSeries.js} +3 -1
- package/models/axis.d.ts +5 -4
- package/models/featureFlags.d.ts +1 -0
- package/models/featureFlags.js +5 -0
- package/models/index.d.ts +1 -0
- package/models/index.js +11 -0
- package/models/seriesType/index.d.ts +3 -1
- package/moduleAugmentation/barChartBatchRendererOnItemClick.d.ts +13 -0
- package/moduleAugmentation/barChartBatchRendererOnItemClick.js +5 -0
- package/package.json +14 -4
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.d.ts +0 -3
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.js +0 -4
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.d.ts +0 -21
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.js +0 -92
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.d.ts +0 -3
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.js +0 -10
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.d.ts +0 -21
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.js +0 -99
package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js
CHANGED
|
@@ -11,92 +11,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
|
13
13
|
var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
|
|
14
|
-
var _useChartKeyboardNavigation = require("./useChartKeyboardNavigation.helpers");
|
|
15
14
|
var _useChartSeries = require("../../corePlugins/useChartSeries/useChartSeries.selectors");
|
|
16
|
-
function getNextIndexFocusedItem(state) {
|
|
17
|
-
const processedSeries = (0, _useChartSeries.selectorChartSeriesProcessed)(state);
|
|
18
|
-
let {
|
|
19
|
-
type,
|
|
20
|
-
seriesId
|
|
21
|
-
} = state.keyboardNavigation.item ?? {};
|
|
22
|
-
if (type === undefined ||
|
|
23
|
-
// @ts-ignore sankey is not in MIT version
|
|
24
|
-
type === 'sankey' || seriesId === undefined || !(0, _useChartKeyboardNavigation.seriesHasData)(processedSeries, type, seriesId)) {
|
|
25
|
-
const nextSeries = (0, _useChartKeyboardNavigation.getNextSeriesWithData)(processedSeries, type, seriesId);
|
|
26
|
-
if (nextSeries === null) {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
type = nextSeries.type;
|
|
30
|
-
seriesId = nextSeries.seriesId;
|
|
31
|
-
}
|
|
32
|
-
const dataLength = processedSeries[type].series[seriesId].data.length;
|
|
33
|
-
return {
|
|
34
|
-
type,
|
|
35
|
-
seriesId,
|
|
36
|
-
dataIndex: ((state.keyboardNavigation.item?.dataIndex ?? -1) + 1) % dataLength
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
function getPreviousIndexFocusedItem(state) {
|
|
40
|
-
const processedSeries = (0, _useChartSeries.selectorChartSeriesProcessed)(state);
|
|
41
|
-
let {
|
|
42
|
-
type,
|
|
43
|
-
seriesId
|
|
44
|
-
} = state.keyboardNavigation.item ?? {};
|
|
45
|
-
if (type === undefined ||
|
|
46
|
-
// @ts-ignore sankey is not in MIT version
|
|
47
|
-
type === 'sankey' || seriesId === undefined || !(0, _useChartKeyboardNavigation.seriesHasData)(processedSeries, type, seriesId)) {
|
|
48
|
-
const previousSeries = (0, _useChartKeyboardNavigation.getPreviousSeriesWithData)(processedSeries, type, seriesId);
|
|
49
|
-
if (previousSeries === null) {
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
type = previousSeries.type;
|
|
53
|
-
seriesId = previousSeries.seriesId;
|
|
54
|
-
}
|
|
55
|
-
const dataLength = processedSeries[type].series[seriesId].data.length;
|
|
56
|
-
return {
|
|
57
|
-
type,
|
|
58
|
-
seriesId,
|
|
59
|
-
dataIndex: (dataLength + (state.keyboardNavigation.item?.dataIndex ?? 1) - 1) % dataLength
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
function getNextSeriesFocusedItem(state) {
|
|
63
|
-
const processedSeries = (0, _useChartSeries.selectorChartSeriesProcessed)(state);
|
|
64
|
-
let {
|
|
65
|
-
type,
|
|
66
|
-
seriesId
|
|
67
|
-
} = state.keyboardNavigation.item ?? {};
|
|
68
|
-
const nextSeries = (0, _useChartKeyboardNavigation.getNextSeriesWithData)(processedSeries, type, seriesId);
|
|
69
|
-
if (nextSeries === null) {
|
|
70
|
-
return null; // No series to move the focus to.
|
|
71
|
-
}
|
|
72
|
-
type = nextSeries.type;
|
|
73
|
-
seriesId = nextSeries.seriesId;
|
|
74
|
-
const dataLength = processedSeries[type].series[seriesId].data.length;
|
|
75
|
-
return {
|
|
76
|
-
type,
|
|
77
|
-
seriesId,
|
|
78
|
-
dataIndex: Math.min(dataLength - 1, state.keyboardNavigation.item?.dataIndex ?? 0)
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
function getPreviousSeriesFocusedItem(state) {
|
|
82
|
-
const processedSeries = (0, _useChartSeries.selectorChartSeriesProcessed)(state);
|
|
83
|
-
let {
|
|
84
|
-
type,
|
|
85
|
-
seriesId
|
|
86
|
-
} = state.keyboardNavigation.item ?? {};
|
|
87
|
-
const previousSeries = (0, _useChartKeyboardNavigation.getPreviousSeriesWithData)(processedSeries, type, seriesId);
|
|
88
|
-
if (previousSeries === null) {
|
|
89
|
-
return null; // No series to move the focus to.
|
|
90
|
-
}
|
|
91
|
-
type = previousSeries.type;
|
|
92
|
-
seriesId = previousSeries.seriesId;
|
|
93
|
-
const dataLength = processedSeries[type].series[seriesId].data.length;
|
|
94
|
-
return {
|
|
95
|
-
type,
|
|
96
|
-
seriesId,
|
|
97
|
-
dataIndex: Math.min(dataLength - 1, state.keyboardNavigation.item?.dataIndex ?? 0)
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
15
|
const useChartKeyboardNavigation = ({
|
|
101
16
|
params,
|
|
102
17
|
store,
|
|
@@ -116,26 +31,18 @@ const useChartKeyboardNavigation = ({
|
|
|
116
31
|
}
|
|
117
32
|
function keyboardHandler(event) {
|
|
118
33
|
let newFocusedItem = store.state.keyboardNavigation.item;
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
break;
|
|
130
|
-
}
|
|
131
|
-
case 'ArrowUp':
|
|
132
|
-
{
|
|
133
|
-
newFocusedItem = getNextSeriesFocusedItem(store.state);
|
|
134
|
-
break;
|
|
135
|
-
}
|
|
136
|
-
default:
|
|
137
|
-
break;
|
|
34
|
+
let seriesType = newFocusedItem?.type;
|
|
35
|
+
if (!seriesType) {
|
|
36
|
+
seriesType = Object.keys((0, _useChartSeries.selectorChartDefaultizedSeries)(store.state)).find(key => store.state.series.seriesConfig[key] !== undefined);
|
|
37
|
+
if (seriesType === undefined) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const calculateFocusedItem = store.state.series.seriesConfig[seriesType]?.keyboardFocusHandler?.(event);
|
|
42
|
+
if (!calculateFocusedItem) {
|
|
43
|
+
return;
|
|
138
44
|
}
|
|
45
|
+
newFocusedItem = calculateFocusedItem(newFocusedItem, store.state);
|
|
139
46
|
if (newFocusedItem !== store.state.keyboardNavigation.item) {
|
|
140
47
|
event.preventDefault();
|
|
141
48
|
store.update((0, _extends2.default)({}, store.state.highlight && {
|
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { FocusedItemIdentifier } from "../../../../models/seriesType/index.js";
|
|
2
2
|
import { type AxisItemIdentifier } from "../../../../models/axis.js";
|
|
3
|
-
import { type FocusedItemData } from "../../../../hooks/useFocusedItem.js";
|
|
4
3
|
export declare const selectorChartsItemIsFocused: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartKeyboardNavigation.types.js").UseChartKeyboardNavigationState> & {
|
|
5
4
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
6
|
-
}, item:
|
|
5
|
+
}, item: FocusedItemIdentifier<keyof import("../../../index.js").ChartsSeriesConfig>) => boolean;
|
|
7
6
|
export declare const selectorChartsHasFocusedItem: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartKeyboardNavigation.types.js").UseChartKeyboardNavigationState> & {
|
|
8
7
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
9
8
|
}) => boolean;
|
|
10
|
-
export declare const
|
|
9
|
+
export declare const selectorChartsFocusedItem: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartKeyboardNavigation.types.js").UseChartKeyboardNavigationState> & {
|
|
11
10
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
12
|
-
}) =>
|
|
13
|
-
export declare const selectorChartsFocusedSeriesId: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartKeyboardNavigation.types.js").UseChartKeyboardNavigationState> & {
|
|
14
|
-
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
15
|
-
}) => SeriesId | undefined;
|
|
16
|
-
export declare const selectorChartsFocusedDataIndex: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartKeyboardNavigation.types.js").UseChartKeyboardNavigationState> & {
|
|
17
|
-
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
18
|
-
}) => number | undefined;
|
|
11
|
+
}) => FocusedItemIdentifier<keyof import("../../../index.js").ChartsSeriesConfig> | null;
|
|
19
12
|
export declare const selectorChartsIsKeyboardNavigationEnabled: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartKeyboardNavigation.types.js").UseChartKeyboardNavigationState> & {
|
|
20
13
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
21
14
|
}) => boolean;
|
|
@@ -27,23 +20,4 @@ export declare const selectorChartsKeyboardYAxisIndex: (args_0: import("../../co
|
|
|
27
20
|
}) => AxisItemIdentifier | undefined;
|
|
28
21
|
export declare const selectorChartsKeyboardItem: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartKeyboardNavigation.types.js").UseChartKeyboardNavigationState> & {
|
|
29
22
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
30
|
-
}) =>
|
|
31
|
-
type: "line";
|
|
32
|
-
seriesId: SeriesId;
|
|
33
|
-
dataIndex: number;
|
|
34
|
-
} | {
|
|
35
|
-
type: "bar";
|
|
36
|
-
seriesId: SeriesId;
|
|
37
|
-
dataIndex: number;
|
|
38
|
-
} | {
|
|
39
|
-
type: "scatter";
|
|
40
|
-
seriesId: SeriesId;
|
|
41
|
-
dataIndex: number;
|
|
42
|
-
} | {
|
|
43
|
-
type: "pie";
|
|
44
|
-
seriesId: SeriesId;
|
|
45
|
-
dataIndex: number;
|
|
46
|
-
} | null;
|
|
47
|
-
export declare const selectorChartsKeyboardItemIsDefined: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartKeyboardNavigation.types.js").UseChartKeyboardNavigationState> & {
|
|
48
|
-
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
49
|
-
}) => boolean;
|
|
23
|
+
}) => FocusedItemIdentifier<keyof import("../../../index.js").ChartsSeriesConfig> | null;
|
|
@@ -3,29 +3,26 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.selectorChartsKeyboardYAxisIndex = exports.selectorChartsKeyboardXAxisIndex = exports.
|
|
6
|
+
exports.selectorChartsKeyboardYAxisIndex = exports.selectorChartsKeyboardXAxisIndex = exports.selectorChartsKeyboardItem = exports.selectorChartsItemIsFocused = exports.selectorChartsIsKeyboardNavigationEnabled = exports.selectorChartsHasFocusedItem = exports.selectorChartsFocusedItem = void 0;
|
|
7
7
|
var _store = require("@mui/x-internals/store");
|
|
8
|
+
var _fastObjectShallowCompare = require("@mui/x-internals/fastObjectShallowCompare");
|
|
8
9
|
var _useChartSeries = require("../../corePlugins/useChartSeries");
|
|
9
10
|
var _useChartCartesianAxisRendering = require("../useChartCartesianAxis/useChartCartesianAxisRendering.selectors");
|
|
10
11
|
const selectKeyboardNavigation = state => state.keyboardNavigation;
|
|
11
|
-
const selectorChartsItemIsFocused = exports.selectorChartsItemIsFocused = (0, _store.createSelector)(selectKeyboardNavigation, (keyboardNavigationState, item) =>
|
|
12
|
-
return keyboardNavigationState?.item != null && keyboardNavigationState.item.type === item.seriesType && keyboardNavigationState.item.seriesId === item.seriesId && keyboardNavigationState.item.dataIndex === item.dataIndex;
|
|
13
|
-
});
|
|
12
|
+
const selectorChartsItemIsFocused = exports.selectorChartsItemIsFocused = (0, _store.createSelector)(selectKeyboardNavigation, (keyboardNavigationState, item) => keyboardNavigationState?.item != null && (0, _fastObjectShallowCompare.fastObjectShallowCompare)(keyboardNavigationState.item, item));
|
|
14
13
|
const selectorChartsHasFocusedItem = exports.selectorChartsHasFocusedItem = (0, _store.createSelector)(selectKeyboardNavigation, keyboardNavigationState => keyboardNavigationState?.item != null);
|
|
15
|
-
const
|
|
16
|
-
const selectorChartsFocusedSeriesId = exports.selectorChartsFocusedSeriesId = (0, _store.createSelector)(selectKeyboardNavigation, keyboardNavigationState => keyboardNavigationState?.item?.seriesId);
|
|
17
|
-
const selectorChartsFocusedDataIndex = exports.selectorChartsFocusedDataIndex = (0, _store.createSelector)(selectKeyboardNavigation, keyboardNavigationState => keyboardNavigationState?.item?.dataIndex);
|
|
14
|
+
const selectorChartsFocusedItem = exports.selectorChartsFocusedItem = (0, _store.createSelector)(selectKeyboardNavigation, keyboardNavigationState => keyboardNavigationState?.item ?? null);
|
|
18
15
|
const selectorChartsIsKeyboardNavigationEnabled = exports.selectorChartsIsKeyboardNavigationEnabled = (0, _store.createSelector)(selectKeyboardNavigation, keyboardNavigationState => !!keyboardNavigationState?.enableKeyboardNavigation);
|
|
19
16
|
|
|
20
17
|
/**
|
|
21
18
|
* Selectors to override highlight behavior.
|
|
22
19
|
*/
|
|
23
20
|
|
|
24
|
-
const createSelectAxisHighlight = direction => (
|
|
25
|
-
if (
|
|
21
|
+
const createSelectAxisHighlight = direction => (item, axis, series) => {
|
|
22
|
+
if (item == null || !('dataIndex' in item) || item.dataIndex === undefined) {
|
|
26
23
|
return undefined;
|
|
27
24
|
}
|
|
28
|
-
const seriesConfig = series[type]?.series[seriesId];
|
|
25
|
+
const seriesConfig = series[item.type]?.series[item.seriesId];
|
|
29
26
|
if (!seriesConfig) {
|
|
30
27
|
return undefined;
|
|
31
28
|
}
|
|
@@ -35,11 +32,11 @@ const createSelectAxisHighlight = direction => (type, seriesId, dataIndex, axis,
|
|
|
35
32
|
}
|
|
36
33
|
return {
|
|
37
34
|
axisId,
|
|
38
|
-
dataIndex
|
|
35
|
+
dataIndex: item.dataIndex
|
|
39
36
|
};
|
|
40
37
|
};
|
|
41
|
-
const selectorChartsKeyboardXAxisIndex = exports.selectorChartsKeyboardXAxisIndex = (0, _store.createSelector)(
|
|
42
|
-
const selectorChartsKeyboardYAxisIndex = exports.selectorChartsKeyboardYAxisIndex = (0, _store.createSelector)(
|
|
38
|
+
const selectorChartsKeyboardXAxisIndex = exports.selectorChartsKeyboardXAxisIndex = (0, _store.createSelector)(selectorChartsFocusedItem, _useChartCartesianAxisRendering.selectorChartXAxis, _useChartSeries.selectorChartSeriesProcessed, createSelectAxisHighlight('x'));
|
|
39
|
+
const selectorChartsKeyboardYAxisIndex = exports.selectorChartsKeyboardYAxisIndex = (0, _store.createSelector)(selectorChartsFocusedItem, _useChartCartesianAxisRendering.selectorChartYAxis, _useChartSeries.selectorChartSeriesProcessed, createSelectAxisHighlight('y'));
|
|
43
40
|
const selectorChartsKeyboardItem = exports.selectorChartsKeyboardItem = (0, _store.createSelector)(selectKeyboardNavigation, function selectorChartsKeyboardItem(keyboardState) {
|
|
44
41
|
if (keyboardState?.item == null) {
|
|
45
42
|
return null;
|
|
@@ -52,7 +49,4 @@ const selectorChartsKeyboardItem = exports.selectorChartsKeyboardItem = (0, _sto
|
|
|
52
49
|
return null;
|
|
53
50
|
}
|
|
54
51
|
return keyboardState.item;
|
|
55
|
-
});
|
|
56
|
-
const selectorChartsKeyboardItemIsDefined = exports.selectorChartsKeyboardItemIsDefined = (0, _store.createSelector)(selectorChartsFocusedSeriesType, selectorChartsFocusedSeriesId, selectorChartsFocusedDataIndex, function selectorChartsKeyboardItemIsDefined(seriesType, seriesId, dataIndex) {
|
|
57
|
-
return seriesId !== undefined && dataIndex !== undefined;
|
|
58
52
|
});
|
|
@@ -1,27 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import type { ChartPluginSignature } from "../../models/index.js";
|
|
2
|
+
import type { UseChartInteractionSignature } from "../useChartInteraction/index.js";
|
|
3
|
+
import type { UseChartHighlightSignature } from "../useChartHighlight/index.js";
|
|
4
|
+
import type { FocusedItemIdentifier } from "../../../../models/seriesType/index.js";
|
|
5
|
+
import type { ChartSeriesType } from "../../../../models/seriesType/config.js";
|
|
6
6
|
export interface UseChartKeyboardNavigationInstance {}
|
|
7
|
-
type SeriesItemIdentifier<SeriesType extends ChartSeriesType = FocusableSeriesTypes> = SeriesType extends FocusableSeriesTypes ? {
|
|
8
|
-
/**
|
|
9
|
-
* The type of the series
|
|
10
|
-
*/
|
|
11
|
-
type: SeriesType;
|
|
12
|
-
/**
|
|
13
|
-
* The id of the series with focus.
|
|
14
|
-
*/
|
|
15
|
-
seriesId: SeriesId;
|
|
16
|
-
/**
|
|
17
|
-
* The index of the data point with focus.
|
|
18
|
-
*/
|
|
19
|
-
dataIndex: number;
|
|
20
|
-
} : never;
|
|
21
|
-
export type FocusableSeriesTypes = 'bar' | 'line' | 'scatter' | 'pie';
|
|
22
7
|
export interface UseChartKeyboardNavigationState {
|
|
23
8
|
keyboardNavigation: {
|
|
24
|
-
item: null |
|
|
9
|
+
item: null | FocusedItemIdentifier<ChartSeriesType>;
|
|
25
10
|
enableKeyboardNavigation: boolean;
|
|
26
11
|
};
|
|
27
12
|
}
|
package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ChartSeriesType } from "../../../../../models/seriesType/config.js";
|
|
2
|
+
import type { ProcessedSeries } from "../../../corePlugins/useChartSeries/useChartSeries.types.js";
|
|
3
|
+
export declare function getMaxSeriesLength<OutSeriesType extends Exclude<ChartSeriesType, 'sankey'>>(series: ProcessedSeries<ChartSeriesType>, availableSeriesTypes: Set<OutSeriesType>): number;
|
package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getMaxSeriesLength = getMaxSeriesLength;
|
|
7
|
+
function getMaxSeriesLength(series, availableSeriesTypes) {
|
|
8
|
+
return Object.keys(series).filter(type => availableSeriesTypes.has(type)).flatMap(type => {
|
|
9
|
+
const seriesOfType = series[type];
|
|
10
|
+
return seriesOfType.seriesOrder.filter(seriesId => seriesOfType.series[seriesId].data.length > 0 && seriesOfType.series[seriesId].data.some(value => value != null)).map(seriesId => seriesOfType.series[seriesId].data.length);
|
|
11
|
+
}).reduce((maxLengths, length) => Math.max(maxLengths, length), 0);
|
|
12
|
+
}
|
package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ChartSeriesType } from "../../../../../models/seriesType/config.js";
|
|
2
|
+
import type { SeriesId } from "../../../../../models/seriesType/common.js";
|
|
3
|
+
import type { ProcessedSeries } from "../../../corePlugins/useChartSeries/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* Returns the next series type and id that contains some data.
|
|
6
|
+
* Returns `null` if no other series have data.
|
|
7
|
+
* @param series - The processed series from the store.
|
|
8
|
+
* @param availableSeriesTypes - The set of series types that can be focused.
|
|
9
|
+
* @param type - The current series type.
|
|
10
|
+
* @param seriesId - The current series id.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getNextNonEmptySeries<OutSeriesType extends Exclude<ChartSeriesType, 'sankey'> = Exclude<ChartSeriesType, 'sankey'>>(series: ProcessedSeries<ChartSeriesType>, availableSeriesTypes: Set<OutSeriesType>, type?: ChartSeriesType, seriesId?: SeriesId): {
|
|
13
|
+
type: OutSeriesType;
|
|
14
|
+
seriesId: SeriesId;
|
|
15
|
+
} | null;
|
package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getNextNonEmptySeries = getNextNonEmptySeries;
|
|
7
|
+
var _getNonEmptySeriesArray = require("./getNonEmptySeriesArray");
|
|
8
|
+
/**
|
|
9
|
+
* Returns the next series type and id that contains some data.
|
|
10
|
+
* Returns `null` if no other series have data.
|
|
11
|
+
* @param series - The processed series from the store.
|
|
12
|
+
* @param availableSeriesTypes - The set of series types that can be focused.
|
|
13
|
+
* @param type - The current series type.
|
|
14
|
+
* @param seriesId - The current series id.
|
|
15
|
+
*/
|
|
16
|
+
function getNextNonEmptySeries(series, availableSeriesTypes, type, seriesId) {
|
|
17
|
+
const nonEmptySeries = (0, _getNonEmptySeriesArray.getNonEmptySeriesArray)(series, availableSeriesTypes);
|
|
18
|
+
if (nonEmptySeries.length === 0) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
const currentSeriesIndex = type !== undefined && seriesId !== undefined ? nonEmptySeries.findIndex(seriesItem => seriesItem.type === type && seriesItem.seriesId === seriesId) : -1;
|
|
22
|
+
return nonEmptySeries[(currentSeriesIndex + 1) % nonEmptySeries.length];
|
|
23
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SeriesId } from "../../../../../models/seriesType/common.js";
|
|
2
|
+
import type { ChartSeriesType } from "../../../../../models/seriesType/config.js";
|
|
3
|
+
import type { ProcessedSeries } from "../../../corePlugins/useChartSeries/useChartSeries.types.js";
|
|
4
|
+
export declare function getNonEmptySeriesArray<OutSeriesType extends Exclude<ChartSeriesType, 'sankey'>>(series: ProcessedSeries<ChartSeriesType>, availableSeriesTypes: Set<OutSeriesType>): {
|
|
5
|
+
seriesId: SeriesId;
|
|
6
|
+
type: OutSeriesType;
|
|
7
|
+
}[];
|
package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNonEmptySeriesArray.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getNonEmptySeriesArray = getNonEmptySeriesArray;
|
|
7
|
+
function getNonEmptySeriesArray(series, availableSeriesTypes) {
|
|
8
|
+
return Object.keys(series).filter(type => availableSeriesTypes.has(type)).flatMap(type => {
|
|
9
|
+
const seriesOfType = series[type];
|
|
10
|
+
return seriesOfType.seriesOrder.filter(seriesId => seriesOfType.series[seriesId].data.length > 0 && seriesOfType.series[seriesId].data.some(value => value != null)).map(seriesId => ({
|
|
11
|
+
type,
|
|
12
|
+
seriesId
|
|
13
|
+
}));
|
|
14
|
+
});
|
|
15
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ChartSeriesType } from "../../../../../models/seriesType/config.js";
|
|
2
|
+
import type { SeriesId } from "../../../../../models/seriesType/common.js";
|
|
3
|
+
import type { ProcessedSeries } from "../../../corePlugins/useChartSeries/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* Returns the previous series type and id that contains some data.
|
|
6
|
+
* Returns `null` if no other series have data.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getPreviousNonEmptySeries<OutSeriesType extends Exclude<ChartSeriesType, 'sankey'> = Exclude<ChartSeriesType, 'sankey'>>(series: ProcessedSeries<ChartSeriesType>, availableSeriesTypes: Set<OutSeriesType>, type?: ChartSeriesType, seriesId?: SeriesId): {
|
|
9
|
+
type: OutSeriesType;
|
|
10
|
+
seriesId: SeriesId;
|
|
11
|
+
} | null;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getPreviousNonEmptySeries = getPreviousNonEmptySeries;
|
|
7
|
+
var _getNonEmptySeriesArray = require("./getNonEmptySeriesArray");
|
|
8
|
+
/**
|
|
9
|
+
* Returns the previous series type and id that contains some data.
|
|
10
|
+
* Returns `null` if no other series have data.
|
|
11
|
+
*/
|
|
12
|
+
function getPreviousNonEmptySeries(series, availableSeriesTypes, type, seriesId) {
|
|
13
|
+
const nonEmptySeries = (0, _getNonEmptySeriesArray.getNonEmptySeriesArray)(series, availableSeriesTypes);
|
|
14
|
+
if (nonEmptySeries.length === 0) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
const currentSeriesIndex = type !== undefined && seriesId !== undefined ? nonEmptySeries.findIndex(seriesItem => seriesItem.type === type && seriesItem.seriesId === seriesId) : -1;
|
|
18
|
+
if (currentSeriesIndex <= 0) {
|
|
19
|
+
// If no current series, or if it's the first series
|
|
20
|
+
return nonEmptySeries[nonEmptySeries.length - 1];
|
|
21
|
+
}
|
|
22
|
+
return nonEmptySeries[(currentSeriesIndex - 1 + nonEmptySeries.length) % nonEmptySeries.length];
|
|
23
|
+
}
|
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
export declare const selectorChartsTooltipPointerItem: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartTooltip.types.js").UseChartTooltipState> & {
|
|
2
2
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
3
|
-
}) => import("../../../../index.js").
|
|
3
|
+
}) => import("../../../../index.js").LineItemIdentifier | import("../../../../index.js").BarItemIdentifier | import("../../../../index.js").ScatterItemIdentifier | import("../../../../index.js").PieItemIdentifier | import("../../../../index.js").RadarItemIdentifier | null;
|
|
4
4
|
export declare const selectorChartsTooltipPointerItemIsDefined: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartTooltip.types.js").UseChartTooltipState> & {
|
|
5
5
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
6
6
|
}) => boolean;
|
|
7
7
|
export declare const selectorChartsTooltipItem: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("../useChartInteraction/useChartInteraction.types.js").UseChartInteractionState> & {
|
|
8
8
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
9
|
-
}) => import("../../../../index.js").PieItemIdentifier |
|
|
10
|
-
type: "bar";
|
|
11
|
-
seriesId: import("../../../index.js").SeriesId;
|
|
12
|
-
dataIndex: number;
|
|
13
|
-
} | {
|
|
14
|
-
type: "scatter";
|
|
15
|
-
seriesId: import("../../../index.js").SeriesId;
|
|
16
|
-
dataIndex: number;
|
|
17
|
-
} | import("../../../../index.js").LineItemIdentifier | import("../../../../index.js").RadarItemIdentifier | null;
|
|
9
|
+
}) => import("../../../../index.js").LineItemIdentifier | import("../../../../index.js").BarItemIdentifier | import("../../../../index.js").ScatterItemIdentifier | import("../../../../index.js").PieItemIdentifier | import("../../../../index.js").RadarItemIdentifier | null;
|
|
18
10
|
export declare const selectorChartsTooltipItemIsDefined: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("../useChartInteraction/useChartInteraction.types.js").UseChartInteractionState> & {
|
|
19
11
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
20
12
|
}) => boolean;
|
|
@@ -16,7 +16,7 @@ const selectTooltip = state => state.tooltip;
|
|
|
16
16
|
const selectorChartsTooltipPointerItem = exports.selectorChartsTooltipPointerItem = (0, _store.createSelector)(selectTooltip, tooltip => tooltip?.item ?? null);
|
|
17
17
|
const selectorChartsTooltipPointerItemIsDefined = exports.selectorChartsTooltipPointerItemIsDefined = (0, _store.createSelector)(selectorChartsTooltipPointerItem, item => item !== null);
|
|
18
18
|
const selectorChartsTooltipItem = exports.selectorChartsTooltipItem = (0, _store.createSelector)(_useChartInteraction.selectorChartsLastInteraction, selectorChartsTooltipPointerItem, _useChartKeyboardNavigation.selectorChartsKeyboardItem, (lastInteraction, pointerItem, keyboardItem) => lastInteraction === 'keyboard' ? keyboardItem : pointerItem ?? null);
|
|
19
|
-
const selectorChartsTooltipItemIsDefined = exports.selectorChartsTooltipItemIsDefined = (0, _store.createSelector)(_useChartInteraction.selectorChartsLastInteraction, selectorChartsTooltipPointerItemIsDefined, _useChartKeyboardNavigation.
|
|
19
|
+
const selectorChartsTooltipItemIsDefined = exports.selectorChartsTooltipItemIsDefined = (0, _store.createSelector)(_useChartInteraction.selectorChartsLastInteraction, selectorChartsTooltipPointerItemIsDefined, _useChartKeyboardNavigation.selectorChartsHasFocusedItem, (lastInteraction, pointerItemIsDefined, keyboardItemIsDefined) => lastInteraction === 'keyboard' ? keyboardItemIsDefined : pointerItemIsDefined);
|
|
20
20
|
const selectorChartsTooltipAxisConfig = (0, _store.createSelectorMemoized)(selectorChartsTooltipItem, _useChartCartesianAxisRendering.selectorChartXAxis, _useChartCartesianAxisRendering.selectorChartYAxis, _useChartPolarAxis.selectorChartRotationAxis, _useChartPolarAxis.selectorChartRadiusAxis, _useChartSeries.selectorChartSeriesProcessed, function selectorChartsTooltipAxisConfig(identifier, {
|
|
21
21
|
axis: xAxis,
|
|
22
22
|
axisIds: xAxisIds
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
useChartVisibilityManager: true
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "useChartVisibilityManager", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () {
|
|
12
|
+
return _useChartVisibilityManager.useChartVisibilityManager;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
var _useChartVisibilityManager = require("./useChartVisibilityManager");
|
|
16
|
+
var _useChartVisibilityManager2 = require("./useChartVisibilityManager.types");
|
|
17
|
+
Object.keys(_useChartVisibilityManager2).forEach(function (key) {
|
|
18
|
+
if (key === "default" || key === "__esModule") return;
|
|
19
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
20
|
+
if (key in exports && exports[key] === _useChartVisibilityManager2[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _useChartVisibilityManager2[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _useChartVisibilityManager3 = require("./useChartVisibilityManager.selectors");
|
|
29
|
+
Object.keys(_useChartVisibilityManager3).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
32
|
+
if (key in exports && exports[key] === _useChartVisibilityManager3[key]) return;
|
|
33
|
+
Object.defineProperty(exports, key, {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () {
|
|
36
|
+
return _useChartVisibilityManager3[key];
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ChartSeriesType } from "../../../../models/seriesType/config.js";
|
|
2
|
+
import type { ChartSeriesConfig } from "../../models/index.js";
|
|
3
|
+
import type { VisibilityIdentifier, VisibilityMap } from "./useChartVisibilityManager.types.js";
|
|
4
|
+
export declare const isIdentifierVisible: (visibilityMap: VisibilityMap, identifier: VisibilityIdentifier, seriesConfig: ChartSeriesConfig<ChartSeriesType>) => boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isIdentifierVisible = void 0;
|
|
7
|
+
var _serializeIdentifier = require("../../corePlugins/useChartSeries/serializeIdentifier");
|
|
8
|
+
const isIdentifierVisible = (visibilityMap, identifier, seriesConfig) => {
|
|
9
|
+
const uniqueId = (0, _serializeIdentifier.serializeIdentifier)(seriesConfig, identifier);
|
|
10
|
+
return !visibilityMap.has(uniqueId);
|
|
11
|
+
};
|
|
12
|
+
exports.isIdentifierVisible = isIdentifierVisible;
|
package/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.useChartVisibilityManager = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
|
11
|
+
var _useEffectAfterFirstRender = require("@mui/x-internals/useEffectAfterFirstRender");
|
|
12
|
+
var _useChartVisibilityManager = require("./useChartVisibilityManager.selectors");
|
|
13
|
+
var _visibilityParamToMap = require("./visibilityParamToMap");
|
|
14
|
+
const useChartVisibilityManager = ({
|
|
15
|
+
store,
|
|
16
|
+
params,
|
|
17
|
+
seriesConfig,
|
|
18
|
+
instance
|
|
19
|
+
}) => {
|
|
20
|
+
// Manage controlled state
|
|
21
|
+
(0, _useEffectAfterFirstRender.useEffectAfterFirstRender)(() => {
|
|
22
|
+
if (params.hiddenItems === undefined) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (process.env.NODE_ENV !== 'production' && !store.state.visibilityManager.isControlled) {
|
|
26
|
+
console.error([`MUI X Charts: A chart component is changing the \`hiddenItems\` from uncontrolled to controlled.`, 'Elements should not switch from uncontrolled to controlled (or vice versa).', 'Decide between using a controlled or uncontrolled for the lifetime of the component.', "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", 'More info: https://fb.me/react-controlled-components'].join('\n'));
|
|
27
|
+
}
|
|
28
|
+
store.set('visibilityManager', (0, _extends2.default)({}, store.state.visibilityManager, {
|
|
29
|
+
visibilityMap: (0, _visibilityParamToMap.visibilityParamToMap)(params.hiddenItems, seriesConfig)
|
|
30
|
+
}));
|
|
31
|
+
}, [store, params.hiddenItems, seriesConfig]);
|
|
32
|
+
const hideItem = (0, _useEventCallback.default)(identifier => {
|
|
33
|
+
const visibilityMap = store.state.visibilityManager.visibilityMap;
|
|
34
|
+
const id = instance.serializeIdentifier(identifier);
|
|
35
|
+
if (visibilityMap.has(id)) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const newVisibilityMap = new Map(visibilityMap);
|
|
39
|
+
newVisibilityMap.set(id, identifier);
|
|
40
|
+
store.set('visibilityManager', (0, _extends2.default)({}, store.state.visibilityManager, {
|
|
41
|
+
visibilityMap: newVisibilityMap
|
|
42
|
+
}));
|
|
43
|
+
params.onHiddenItemsChange?.(Array.from(newVisibilityMap.values()));
|
|
44
|
+
});
|
|
45
|
+
const showItem = (0, _useEventCallback.default)(identifier => {
|
|
46
|
+
const visibilityMap = store.state.visibilityManager.visibilityMap;
|
|
47
|
+
const id = instance.serializeIdentifier(identifier);
|
|
48
|
+
if (!visibilityMap.has(id)) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const newVisibilityMap = new Map(visibilityMap);
|
|
52
|
+
newVisibilityMap.delete(id);
|
|
53
|
+
store.set('visibilityManager', (0, _extends2.default)({}, store.state.visibilityManager, {
|
|
54
|
+
visibilityMap: newVisibilityMap
|
|
55
|
+
}));
|
|
56
|
+
params.onHiddenItemsChange?.(Array.from(newVisibilityMap.values()));
|
|
57
|
+
});
|
|
58
|
+
const toggleItem = (0, _useEventCallback.default)(identifier => {
|
|
59
|
+
const visibilityMap = store.state.visibilityManager.visibilityMap;
|
|
60
|
+
const id = instance.serializeIdentifier(identifier);
|
|
61
|
+
if (visibilityMap.has(id)) {
|
|
62
|
+
showItem(identifier);
|
|
63
|
+
} else {
|
|
64
|
+
hideItem(identifier);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
return {
|
|
68
|
+
instance: {
|
|
69
|
+
hideItem,
|
|
70
|
+
showItem,
|
|
71
|
+
toggleItemVisibility: toggleItem
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
exports.useChartVisibilityManager = useChartVisibilityManager;
|
|
76
|
+
useChartVisibilityManager.getInitialState = (params, _, seriesConfig) => ({
|
|
77
|
+
visibilityManager: {
|
|
78
|
+
visibilityMap: params.hiddenItems ? (0, _visibilityParamToMap.visibilityParamToMap)(params.hiddenItems, seriesConfig) : _useChartVisibilityManager.EMPTY_VISIBILITY_MAP,
|
|
79
|
+
isControlled: params.hiddenItems !== undefined
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
useChartVisibilityManager.params = {
|
|
83
|
+
onHiddenItemsChange: true,
|
|
84
|
+
hiddenItems: true
|
|
85
|
+
};
|