@@ -3,10 +3,12 @@ import * as React from 'react';
3
3
4
4
import { ButtonType } from '@/components/button' ;
5
5
import { ElementOrIcon } from '@/components/elementOrIcon' ;
6
+ import { Text , TextComponentType } from '@/components/text' ;
6
7
7
8
import { useContent } from '../hooks/useContent' ;
8
9
import {
9
10
TableColumnBodyStyled ,
11
+ TableColumnHeaderStyled ,
10
12
TableEmptyExpandedContentRow ,
11
13
TableExpandedButton ,
12
14
TableExpandedCellStyled ,
@@ -22,6 +24,7 @@ export interface ITableRow extends Omit<ITableStandAlone, 'values' | 'headerVari
22
24
indexRow : number ;
23
25
hasSomeDivider : boolean ;
24
26
hasSomeDividerContent : boolean ;
27
+ hasRowHeader : boolean ;
25
28
}
26
29
27
30
/**
@@ -31,6 +34,7 @@ export interface ITableRow extends Omit<ITableStandAlone, 'values' | 'headerVari
31
34
export const TableRow = ( props : ITableRow ) : JSX . Element => {
32
35
const {
33
36
divider,
37
+ rowHeader,
34
38
dividerValue,
35
39
getExpandedAria,
36
40
getValue,
@@ -57,6 +61,17 @@ export const TableRow = (props: ITableRow): JSX.Element => {
57
61
styles = { props . styles . bodyRows ?. [ rowVariant ] }
58
62
>
59
63
< TableDivider divider = { dividerValue ( ) } styles = { props . styles . divider } />
64
+ { rowHeader && (
65
+ < TableColumnHeaderStyled scope = "row" styles = { props . styles . header ?. [ rowHeader . variant ] } >
66
+ < Text
67
+ component = { TextComponentType . SPAN }
68
+ customTypography = { props . styles . header ?. [ rowHeader . variant ] ?. typography }
69
+ dataTestId = { `${ props . dataTestId } RowHeader${ props . indexRow } ` }
70
+ >
71
+ { rowHeader . label }
72
+ </ Text >
73
+ </ TableColumnHeaderStyled >
74
+ ) }
60
75
{ props . headers
61
76
. filter ( headerValue => headerValue . id !== divider ?. id )
62
77
. map ( ( headerValue , indexHeader ) => {
@@ -65,17 +80,17 @@ export const TableRow = (props: ITableRow): JSX.Element => {
65
80
< TableColumnBodyStyled
66
81
key = { indexHeader }
67
82
customAlign = {
68
- headerValue . config ?. alignValue ?. [ props . device ] ||
83
+ headerValue ? .config ?. alignValue ?. [ props . device ] ||
69
84
headerValue ?. config ?. alignValue ||
70
- headerValue . config ?. alignHeader ?. [ props . device ] ||
85
+ headerValue ? .config ?. alignHeader ?. [ props . device ] ||
71
86
headerValue ?. config ?. alignHeader
72
87
}
73
88
customBackgroundColor = {
74
89
getBackgroundColorCellValue ( headerValue ) ?? props . value . backgroundColor
75
90
}
76
- customWidth = { headerValue . config ?. width }
91
+ customWidth = { headerValue ? .config ?. width }
77
92
data-testid = { `${ props . dataTestId } Row${ props . indexRow } Content${ indexHeader } ` }
78
- flexWidth = { headerValue . config ?. flexWidth }
93
+ flexWidth = { headerValue ? .config ?. flexWidth }
79
94
hasSomeExpandedContent = { props . hasSomeExpandedContent && hasExpandedIcon }
80
95
styles = { props . styles . bodyRows ?. [ rowVariant ] }
81
96
>
0 commit comments