@@ -3,8 +3,8 @@ import '@ui5/webcomponents-icons/dist/icons/group-2';
3
3
import '@ui5/webcomponents-icons/dist/icons/sort-ascending' ;
4
4
import '@ui5/webcomponents-icons/dist/icons/sort-descending' ;
5
5
import { createComponentStyles } from '@ui5/webcomponents-react-base/lib/createComponentStyles' ;
6
- import { ThemingParameters } from '@ui5/webcomponents-react-base/lib/ThemingParameters' ;
7
6
import { StyleClassHelper } from '@ui5/webcomponents-react-base/lib/StyleClassHelper' ;
7
+ import { ThemingParameters } from '@ui5/webcomponents-react-base/lib/ThemingParameters' ;
8
8
import { Icon } from '@ui5/webcomponents-react/lib/Icon' ;
9
9
import React , { CSSProperties , DragEventHandler , FC , ReactNode , ReactNodeArray , useMemo } from 'react' ;
10
10
import { ColumnType } from '../types/ColumnType' ;
@@ -18,12 +18,9 @@ export interface ColumnHeaderProps {
18
18
className : string ;
19
19
column : ColumnType ;
20
20
style : CSSProperties ;
21
- groupable : boolean ;
22
- sortable : boolean ;
23
- filterable : boolean ;
24
21
isLastColumn ?: boolean ;
25
- onSort ?: ( e : CustomEvent < { column : unknown ; sortDirection : string } > ) => void ;
26
- onGroupBy ?: ( e : CustomEvent < { column : unknown ; isGrouped : boolean } > ) => void ;
22
+ onSort ?: ( e : CustomEvent < { column : unknown ; sortDirection : string } > ) => void ;
23
+ onGroupBy ?: ( e : CustomEvent < { column : unknown ; isGrouped : boolean } > ) => void ;
27
24
onDragStart : DragEventHandler < HTMLDivElement > ;
28
25
onDragOver : DragEventHandler < HTMLDivElement > ;
29
26
onDrop : DragEventHandler < HTMLDivElement > ;
@@ -32,6 +29,7 @@ export interface ColumnHeaderProps {
32
29
dragOver : boolean ;
33
30
isResizing : boolean ;
34
31
isDraggable : boolean ;
32
+ role : string ;
35
33
}
36
34
37
35
const styles = {
@@ -91,9 +89,6 @@ export const ColumnHeader: FC<ColumnHeaderProps> = (props: ColumnHeaderProps) =>
91
89
column,
92
90
className,
93
91
style,
94
- groupable,
95
- sortable,
96
- filterable,
97
92
isLastColumn,
98
93
onSort,
99
94
onGroupBy,
@@ -103,7 +98,8 @@ export const ColumnHeader: FC<ColumnHeaderProps> = (props: ColumnHeaderProps) =>
103
98
onDrop,
104
99
onDragEnd,
105
100
isDraggable,
106
- dragOver
101
+ dragOver,
102
+ role
107
103
} = props ;
108
104
109
105
const openBy = useMemo ( ( ) => {
@@ -179,18 +175,9 @@ export const ColumnHeader: FC<ColumnHeaderProps> = (props: ColumnHeaderProps) =>
179
175
if ( ! column ) return null ;
180
176
181
177
return (
182
- < div id = { id } className = { className } style = { style } role = "columnheader" >
183
- { groupable || sortable || filterable ? (
184
- < ColumnHeaderModal
185
- openBy = { openBy }
186
- showFilter = { filterable }
187
- showGroup = { groupable && column . disableGrouping !== true }
188
- showSort = { sortable }
189
- column = { column }
190
- style = { innerStyle }
191
- onSort = { onSort }
192
- onGroupBy = { onGroupBy }
193
- />
178
+ < div id = { id } className = { className } style = { style } role = { role } >
179
+ { column . canGroupBy || column . canSort || column . canFilter ? (
180
+ < ColumnHeaderModal openBy = { openBy } column = { column } style = { innerStyle } onSort = { onSort } onGroupBy = { onGroupBy } />
194
181
) : (
195
182
< div style = { { ...innerStyle , display : 'inline-block' , cursor : 'auto' } } > { openBy } </ div >
196
183
) }
0 commit comments