@@ -42,6 +42,10 @@ export function createGetNextIndexFocusedItem<
4242 * If true, allows cycling from the last item to the first one.
4343 */
4444 allowCycles : boolean = false ,
45+ /**
46+ * If true, series max index is defined by the current series length and not all series.
47+ */
48+ seriesMaxLength : boolean = false ,
4549) {
4650 return function getNextIndexFocusedItem (
4751 currentItem : FocusedItemIdentifier < InSeriesType > | null ,
@@ -71,7 +75,9 @@ export function createGetNextIndexFocusedItem<
7175 seriesId = nextSeries . seriesId ;
7276 }
7377
74- const maxLength = getMaxSeriesLength ( processedSeries , compatibleSeriesTypes ) ;
78+ const maxLength = seriesMaxLength
79+ ? ( processedSeries [ type ] ?. series [ seriesId ] ?. data . length ?? 0 )
80+ : getMaxSeriesLength ( processedSeries , compatibleSeriesTypes ) ;
7581
7682 let dataIndex = currentItem ?. dataIndex == null ? 0 : currentItem . dataIndex + 1 ;
7783 if ( allowCycles ) {
@@ -114,6 +120,10 @@ export function createGetPreviousIndexFocusedItem<
114120 * If true, allows cycling from the last item to the first one.
115121 */
116122 allowCycles : boolean = false ,
123+ /**
124+ * If true, series max index is defined by the current series length and not all series.
125+ */
126+ seriesMaxLength : boolean = false ,
117127) {
118128 return function getPreviousIndexFocusedItem (
119129 currentItem : FocusedItemIdentifier < InSeriesType > | null ,
@@ -143,7 +153,9 @@ export function createGetPreviousIndexFocusedItem<
143153 seriesId = previousSeries . seriesId ;
144154 }
145155
146- const maxLength = getMaxSeriesLength ( processedSeries , compatibleSeriesTypes ) ;
156+ const maxLength = seriesMaxLength
157+ ? ( processedSeries [ type ] ?. series [ seriesId ] ?. data . length ?? 0 )
158+ : getMaxSeriesLength ( processedSeries , compatibleSeriesTypes ) ;
147159
148160 let dataIndex = currentItem ?. dataIndex == null ? maxLength - 1 : currentItem . dataIndex - 1 ;
149161 if ( allowCycles ) {
0 commit comments