@@ -8,6 +8,7 @@ import { copyAnalyticsMetadataAttribute } from '@cloudscape-design/component-too
8
8
import { useSingleTabStopNavigation } from '../../internal/context/single-tab-stop-navigation-context' ;
9
9
import { useMergeRefs } from '../../internal/hooks/use-merge-refs' ;
10
10
import { useVisualRefresh } from '../../internal/hooks/use-visual-mode' ;
11
+ import { ColumnWidthStyle } from '../column-widths-utils' ;
11
12
import { ExpandToggleButton } from '../expandable-rows/expand-toggle-button' ;
12
13
import { TableProps } from '../interfaces.js' ;
13
14
import { StickyColumnsModel , useStickyCellStyles } from '../sticky-columns' ;
@@ -18,7 +19,6 @@ import tableStyles from '../styles.css.js';
18
19
import styles from './styles.css.js' ;
19
20
20
21
export interface TableTdElementProps {
21
- style ?: React . CSSProperties ;
22
22
wrapLines : boolean | undefined ;
23
23
isRowHeader ?: boolean ;
24
24
isFirstRow : boolean ;
@@ -51,6 +51,7 @@ export interface TableTdElementProps {
51
51
collapseButtonLabel ?: string ;
52
52
verticalAlign ?: TableProps . VerticalAlign ;
53
53
resizableColumns ?: boolean ;
54
+ resizableStyle ?: ColumnWidthStyle ;
54
55
isEditable : boolean ;
55
56
isEditing : boolean ;
56
57
isEditingDisabled ?: boolean ;
@@ -60,7 +61,6 @@ export interface TableTdElementProps {
60
61
export const TableTdElement = React . forwardRef < HTMLTableCellElement , TableTdElementProps > (
61
62
(
62
63
{
63
- style,
64
64
children,
65
65
wrapLines,
66
66
isRowHeader,
@@ -90,6 +90,7 @@ export const TableTdElement = React.forwardRef<HTMLTableCellElement, TableTdElem
90
90
collapseButtonLabel,
91
91
verticalAlign,
92
92
resizableColumns,
93
+ resizableStyle,
93
94
isEditable,
94
95
isEditing,
95
96
isEditingDisabled,
@@ -101,6 +102,8 @@ export const TableTdElement = React.forwardRef<HTMLTableCellElement, TableTdElem
101
102
const Element = isRowHeader ? 'th' : 'td' ;
102
103
const isVisualRefresh = useVisualRefresh ( ) ;
103
104
105
+ resizableStyle = resizableColumns ? { } : resizableStyle ;
106
+
104
107
nativeAttributes = { ...nativeAttributes , ...getTableCellRoleProps ( { tableRole, isRowHeader, colIndex } ) } ;
105
108
106
109
const stickyStyles = useStickyCellStyles ( {
@@ -115,10 +118,9 @@ export const TableTdElement = React.forwardRef<HTMLTableCellElement, TableTdElem
115
118
116
119
return (
117
120
< Element
118
- style = { { ...style , ...stickyStyles . style } }
121
+ style = { { ...resizableStyle , ...stickyStyles . style } }
119
122
className = { clsx (
120
123
styles [ 'body-cell' ] ,
121
- wrapLines && styles [ 'body-cell-wrap' ] ,
122
124
isFirstRow && styles [ 'body-cell-first-row' ] ,
123
125
isLastRow && styles [ 'body-cell-last-row' ] ,
124
126
isSelected && styles [ 'body-cell-selected' ] ,
@@ -137,7 +139,6 @@ export const TableTdElement = React.forwardRef<HTMLTableCellElement, TableTdElem
137
139
hasSuccessIcon && styles [ 'body-cell-has-success' ] ,
138
140
level !== undefined && styles [ 'body-cell-expandable' ] ,
139
141
level !== undefined && styles [ `expandable-level-${ getLevelClassSuffix ( level ) } ` ] ,
140
- verticalAlign === 'top' && styles [ 'body-cell-align-top' ] ,
141
142
stickyStyles . className
142
143
) }
143
144
onClick = { onClick }
@@ -159,7 +160,15 @@ export const TableTdElement = React.forwardRef<HTMLTableCellElement, TableTdElem
159
160
</ div >
160
161
) }
161
162
162
- < div className = { styles [ 'body-cell-content' ] } > { children } </ div >
163
+ < div
164
+ className = { clsx (
165
+ styles [ 'body-cell-content' ] ,
166
+ verticalAlign === 'top' && styles [ 'body-cell-align-top' ] ,
167
+ wrapLines && styles [ 'body-cell-wrap' ]
168
+ ) }
169
+ >
170
+ { children }
171
+ </ div >
163
172
</ Element >
164
173
) ;
165
174
}
0 commit comments