1
1
import ListItemType from '@ui5/webcomponents/dist/types/ListItemType.js' ;
2
2
import PopoverHorizontalAlign from '@ui5/webcomponents/dist/types/PopoverHorizontalAlign.js' ;
3
3
import PopoverPlacement from '@ui5/webcomponents/dist/types/PopoverPlacement.js' ;
4
+ import { getScopedVarName } from '@ui5/webcomponents-base/CustomElementsScope.js' ;
4
5
import iconDecline from '@ui5/webcomponents-icons/dist/decline.js' ;
5
6
import iconFilter from '@ui5/webcomponents-icons/dist/filter.js' ;
6
7
import iconGroup from '@ui5/webcomponents-icons/dist/group-2.js' ;
7
8
import iconSortAscending from '@ui5/webcomponents-icons/dist/sort-ascending.js' ;
8
9
import iconSortDescending from '@ui5/webcomponents-icons/dist/sort-descending.js' ;
9
10
import { enrichEventWithDetails , useI18nBundle , useStylesheet } from '@ui5/webcomponents-react-base' ;
10
11
import type { MutableRefObject } from 'react' ;
11
- import { useEffect , useRef } from 'react' ;
12
+ import { useEffect , useMemo , useRef } from 'react' ;
12
13
import { FlexBoxAlignItems , TextAlign } from '../../../enums/index.js' ;
13
- import { CLEAR_SORTING , GROUP , SORT_ASCENDING , SORT_DESCENDING , UNGROUP } from '../../../i18n/i18n-defaults.js' ;
14
+ import { CLEAR_SORTING , FILTER , GROUP , SORT_ASCENDING , SORT_DESCENDING , UNGROUP } from '../../../i18n/i18n-defaults.js' ;
14
15
import { stopPropagation } from '../../../internal/stopPropagation.js' ;
15
16
import { getUi5TagWithSuffix } from '../../../internal/utils.js' ;
16
17
import { Icon } from '../../../webComponents/Icon/index.js' ;
@@ -19,6 +20,7 @@ import { ListItemCustom } from '../../../webComponents/ListItemCustom/index.js';
19
20
import { ListItemStandard } from '../../../webComponents/ListItemStandard/index.js' ;
20
21
import type { PopoverDomRef } from '../../../webComponents/Popover/index.js' ;
21
22
import { Popover } from '../../../webComponents/Popover/index.js' ;
23
+ import { Text } from '../../../webComponents/Text/index.js' ;
22
24
import { FlexBox } from '../../FlexBox/index.js' ;
23
25
import type { AnalyticalTableColumnDefinition } from '../types/index.js' ;
24
26
import { classNames , styleData } from './ColumnHeaderModal.module.css.js' ;
@@ -52,6 +54,16 @@ export const ColumnHeaderModal = (props: ColumnHeaderModalProperties) => {
52
54
const sortDescendingText = i18nBundle . getText ( SORT_DESCENDING ) ;
53
55
const groupText = i18nBundle . getText ( GROUP ) ;
54
56
const ungroupText = i18nBundle . getText ( UNGROUP ) ;
57
+ const filterText = i18nBundle . getText ( FILTER ) ;
58
+
59
+ const filterStyles = useMemo ( ( ) => {
60
+ if ( showFilter ) {
61
+ return {
62
+ iconDimensions : `var(${ getScopedVarName ( '--_ui5_list_item_icon_size' ) } )` ,
63
+ fontSize : `var(${ getScopedVarName ( '--_ui5_list_item_title_size' ) } )`
64
+ } ;
65
+ }
66
+ } , [ showFilter ] ) ;
55
67
56
68
const handleSort = ( e ) => {
57
69
const sortType = e . detail . item . getAttribute ( 'data-sort' ) ;
@@ -195,10 +207,26 @@ export const ColumnHeaderModal = (props: ColumnHeaderModalProperties) => {
195
207
</ ListItemStandard >
196
208
) }
197
209
{ showFilter && (
198
- //todo maybe need to enhance Input selection after ui5-webcomponents issue has been fixed (undefined is displayed as val)
199
- < ListItemCustom type = { ListItemType . Inactive } onKeyDown = { handleCustomLiKeyDown } >
210
+ < ListItemCustom type = { ListItemType . Inactive } onKeyDown = { handleCustomLiKeyDown } accessibleName = { filterText } >
200
211
< FlexBox alignItems = { FlexBoxAlignItems . Center } >
201
- < Icon name = { iconFilter } className = { classNames . filterIcon } aria-hidden />
212
+ < Icon
213
+ name = { iconFilter }
214
+ className = { classNames . filterIcon }
215
+ aria-hidden
216
+ style = { {
217
+ minWidth : filterStyles . iconDimensions ,
218
+ minHeight : filterStyles . iconDimensions
219
+ } }
220
+ />
221
+ < Text
222
+ maxLines = { 1 }
223
+ className = { classNames . filterText }
224
+ style = { {
225
+ fontSize : filterStyles . fontSize
226
+ } }
227
+ >
228
+ { filterText }
229
+ </ Text >
202
230
< Filter column = { column } popoverRef = { ref } />
203
231
</ FlexBox >
204
232
</ ListItemCustom >
0 commit comments