Skip to content

Commit 0b5a163

Browse files
authored
fix(AnalyticalTable): correctly log warning for column width (#7539)
1 parent 6a4073d commit 0b5a163

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

packages/main/src/components/AnalyticalTable/AnalyticalTable.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ const TableComp = () => {
125125
| `hAlign` | `TextAlign` | Horizontal align of the cell |
126126
| `vAlign` | `VerticalAlign` | Vertical align of the cell |
127127
| `scaleWidthModeOptions` | `ScaleWidthModeOptions` | Allows passing a custom string for the internal width calculation of custom cells for `scaleWidthMode` `Grow` and `Smart`. More <a href="./?path=/docs/data-display-analyticaltable-recipes--docs#how-to-scale-custom-cells">here</a> |
128-
| `responsivePopIn` | `boolean` | Enables the pop-in behavior of the column. When the `responsiveMinWidth` is smaller then the width of the table, the content of each cell will move to the first cell in the row, improving usability on small or mobile devices. |
128+
| `responsivePopIn` | `boolean` | Enables the pop-in behavior of the column. When the `responsiveMinWidth` is smaller then the width of the table, the content of each cell will move to the first cell in the row, improving usability on small or mobile devices.<br />**Note:** At least one column must remain visible at all times! |
129129
| `responsiveMinWidth` | `number` | Defines how the table should react when its width falls below the `responsiveMinWidth`. <ul><li>If `responsivePopIn` is `true` the content of this column will be moved to the first column.</li><li>If `responsivePopIn` is not set or `false` the column will be hidden.</li></ul> |
130130
| `PopInHeader` | `string OR ComponentType` | Custom pop-in header renderer. If set, the table will call that component for every column that is "popped-in" and pass the table instance as prop. |
131131
| `popinDisplay` | `AnalyticalTablePopinDisplay` | Defines the display of `AnalyticalTable` pop-ins.<br />**Default:** `AnalyticalTablePopinDisplay.Block` |

packages/main/src/components/AnalyticalTable/hooks/useDynamicColumnWidths.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,9 @@ const columns = (columns: TableInstance['columns'], { instance }: { instance: Ta
390390
return columns.map((column) => {
391391
const calculatedWidth = calculatedWidths[column.id] || calculatedWidths[column.accessor];
392392
if (typeof calculatedWidth !== 'number') {
393-
console.warn('Could not determine column width!');
393+
if (visibleColumns.length === columns.length) {
394+
console.warn('Could not determine column width!');
395+
}
394396
return column;
395397
}
396398
return { ...column, width: calculatedWidth };

packages/main/src/components/AnalyticalTable/types/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,8 @@ export interface AnalyticalTableColumnDefinition {
570570
// usePopIn
571571
/**
572572
* Enables the pop-in behavior of the column. When the `responsiveMinWidth` is smaller than the width of the table, the content of each cell will move to the first cell in the row, improving usability on small or mobile devices.
573+
*
574+
* __Note:__ At least one column must remain visible at all times!
573575
*/
574576
responsivePopIn?: boolean;
575577
/**

0 commit comments

Comments
 (0)