@@ -26,6 +26,7 @@ export type UseFilteredRowCounterInfoReturn = {
26
26
rowCountLabel : string | undefined ;
27
27
tooltipContent : ReactElement | undefined ;
28
28
registerRowCounterEvents : ( params : RowDataUpdatedEvent ) => void ;
29
+ displayedRows : number | null ;
29
30
} ;
30
31
31
32
export function useFilteredRowCounterInfo ( {
@@ -101,8 +102,8 @@ export function useFilteredRowCounterInfo({
101
102
if ( displayedRows === 0 && isAnyFilterPresent ) {
102
103
return intl . formatMessage ( { id : 'NoMatch' } ) ;
103
104
} else {
104
- const plural = ` ${ intl . formatMessage ( { id : 'Rows' } ) } ${ totalRows === 1 ? '' : 's' } ` ;
105
- return displayedRows !== totalRows ? `${ displayedRows } / ${ totalRows } ${ plural } ` : `${ totalRows } ${ plural } ` ;
105
+ const plural = intl . formatMessage ( { id : 'Rows' } , { count : totalRows } ) ;
106
+ return displayedRows === totalRows ? `${ totalRows } ${ plural } ` : `${ displayedRows } / ${ totalRows } ${ plural } ` ;
106
107
}
107
108
} , [ displayedRows , totalRows , intl , isAnyFilterPresent ] ) ;
108
109
@@ -119,16 +120,15 @@ export function useFilteredRowCounterInfo({
119
120
const lines : string [ ] = [ `${ intl . formatMessage ( { id : 'ClickToReset' } ) } ` ] ;
120
121
if ( Object . keys ( gsFilterByType ) ?. length > 0 ) {
121
122
lines . push ( `${ intl . formatMessage ( { id : 'ExternalFilters' } ) } : ` ) ;
122
-
123
- Object . entries ( gsFilterByType ) . forEach ( ( [ filterType , labels ] ) => {
123
+ for ( const [ filterType , labels ] of Object . entries ( gsFilterByType ) ) {
124
124
const formattedLabels = labels . map ( ( label ) => intl . formatMessage ( { id : label } ) ) . join ( ', ' ) ;
125
125
lines . push ( `- ${ intl . formatMessage ( { id : filterType } ) } : "${ formattedLabels } "` ) ;
126
- } ) ;
126
+ }
127
127
}
128
128
129
129
if ( spreadsheetColumnsFiltersState ?. length > 0 ) {
130
130
lines . push ( `${ intl . formatMessage ( { id : 'ColumnsFilters' } ) } : ` ) ;
131
- spreadsheetColumnsFiltersState . forEach ( ( filterModel ) => {
131
+ for ( const filterModel of spreadsheetColumnsFiltersState ) {
132
132
const headerName =
133
133
gridRef . current ?. api . getColumn ( filterModel . column ) ?. getColDef ( ) ?. headerName ?? filterModel . column ;
134
134
lines . push (
@@ -137,7 +137,7 @@ export function useFilteredRowCounterInfo({
137
137
', '
138
138
)
139
139
) ;
140
- } ) ;
140
+ }
141
141
}
142
142
return < span style = { { whiteSpace : 'pre-line' } } > { lines . join ( '\n' ) } </ span > ;
143
143
} , [ globalFilterSpreadsheetState , gridRef , intl , isAnyFilterPresent , isLoading , spreadsheetColumnsFiltersState ] ) ;
@@ -158,5 +158,6 @@ export function useFilteredRowCounterInfo({
158
158
rowCountLabel,
159
159
tooltipContent,
160
160
registerRowCounterEvents,
161
+ displayedRows,
161
162
} ;
162
163
}
0 commit comments