File tree Expand file tree Collapse file tree 2 files changed +16
-20
lines changed
packages/components/src/components/hds/advanced-table
showcase/app/components/mock/app/main Expand file tree Collapse file tree 2 files changed +16
-20
lines changed Original file line number Diff line number Diff line change @@ -196,23 +196,6 @@ export default class HdsAdvancedTable extends Component<HdsAdvancedTableSignatur
196
196
onColumnResize,
197
197
} ) ;
198
198
199
- const resizableColumns = columns . filter ( ( column ) => column . isResizable ) ;
200
- const resizableColumnLabels = resizableColumns . map (
201
- ( column ) => column . label
202
- ) ;
203
-
204
- if ( resizableColumns . length > 0 ) {
205
- assert (
206
- 'Cannot have a sticky first column if there are resizable columns.' ,
207
- ! hasStickyFirstColumn
208
- ) ;
209
-
210
- assert (
211
- `Cannot have resizable columns if there are nested rows. Resizable columns are ${ resizableColumnLabels . toString ( ) } ` ,
212
- ! this . _tableModel . hasRowsWithChildren
213
- ) ;
214
- }
215
-
216
199
if ( this . _tableModel . hasRowsWithChildren ) {
217
200
const sortableColumns = columns . filter ( ( column ) => column . isSortable ) ;
218
201
const sortableColumnLabels = sortableColumns . map (
@@ -228,6 +211,16 @@ export default class HdsAdvancedTable extends Component<HdsAdvancedTableSignatur
228
211
'Cannot have a sticky first column if there are nested rows.' ,
229
212
! hasStickyFirstColumn
230
213
) ;
214
+
215
+ const resizableColumns = columns . filter ( ( column ) => column . isResizable ) ;
216
+ const resizableColumnLabels = resizableColumns . map (
217
+ ( column ) => column . label
218
+ ) ;
219
+
220
+ assert (
221
+ `Cannot have resizable columns if there are nested rows. Resizable columns are ${ resizableColumnLabels . toString ( ) } ` ,
222
+ resizableColumns . length === 0
223
+ ) ;
231
224
}
232
225
}
233
226
Original file line number Diff line number Diff line change @@ -33,19 +33,22 @@ const SAMPLE_COLUMNS = [
33
33
label: ' Project name' ,
34
34
key: ' project-name' ,
35
35
isSortable: true ,
36
- width: ' max-content' ,
36
+ isResizable: true ,
37
+ width: ' 300px' ,
37
38
},
38
39
{
39
40
label: ' Current run ID' ,
40
41
key: ' current-run-id' ,
41
42
isSortable: true ,
42
- width: ' max-content' ,
43
+ isResizable: true ,
44
+ width: ' 300px' ,
43
45
},
44
46
{
45
47
label: ' Run status' ,
46
48
key: ' run-status' ,
47
49
isSortable: true ,
48
- width: ' max-content' ,
50
+ isResizable: true ,
51
+ width: ' 200px' ,
49
52
},
50
53
{
51
54
label: ' Current run applied' ,
You can’t perform that action at this time.
0 commit comments