Use the ResizableTableContainer only if a column has a width property, and don't set the table-layout CSS property, but leave it to the user
Signed-off-by: Gustaf Räntilä <g.rantila@gmail.com>
This commit is contained in:
committed by
Johan Persson
parent
a8b3395a55
commit
7eda810329
@@ -1700,7 +1700,6 @@ export function Table<T extends TableItem>({
|
||||
selection,
|
||||
emptyState,
|
||||
className,
|
||||
columnSizing,
|
||||
style,
|
||||
}: TableProps<T>): JSX_2.Element;
|
||||
|
||||
@@ -1813,8 +1812,6 @@ export interface TableProps<T extends TableItem> {
|
||||
// (undocumented)
|
||||
columnConfig: readonly ColumnConfig<T>[];
|
||||
// (undocumented)
|
||||
columnSizing?: 'content' | 'manual';
|
||||
// (undocumented)
|
||||
data: T[] | undefined;
|
||||
// (undocumented)
|
||||
emptyState?: ReactNode;
|
||||
|
||||
@@ -29,7 +29,7 @@ import type {
|
||||
RowRenderFn,
|
||||
TablePaginationType,
|
||||
} from '../types';
|
||||
import { CSSProperties, useMemo } from 'react';
|
||||
import { useMemo } from 'react';
|
||||
import { VisuallyHidden } from '../../VisuallyHidden';
|
||||
import { Flex } from '../../Flex';
|
||||
|
||||
@@ -98,7 +98,6 @@ export function Table<T extends TableItem>({
|
||||
selection,
|
||||
emptyState,
|
||||
className,
|
||||
columnSizing,
|
||||
style,
|
||||
}: TableProps<T>) {
|
||||
const liveRegionId = useId();
|
||||
@@ -138,15 +137,13 @@ export function Table<T extends TableItem>({
|
||||
data !== undefined,
|
||||
);
|
||||
|
||||
const manualColumnSizing =
|
||||
columnSizing === 'manual' ||
|
||||
columnConfig.some(
|
||||
col =>
|
||||
col.width != null ||
|
||||
col.minWidth != null ||
|
||||
col.maxWidth != null ||
|
||||
col.defaultWidth != null,
|
||||
);
|
||||
const manualColumnSizing = columnConfig.some(
|
||||
col =>
|
||||
col.width != null ||
|
||||
col.minWidth != null ||
|
||||
col.maxWidth != null ||
|
||||
col.defaultWidth != null,
|
||||
);
|
||||
|
||||
const wrapResizable = manualColumnSizing
|
||||
? (elem: React.ReactNode) => (
|
||||
@@ -154,10 +151,6 @@ export function Table<T extends TableItem>({
|
||||
)
|
||||
: (elem: React.ReactNode) => <>{elem}</>;
|
||||
|
||||
const tableRootStyle: CSSProperties = manualColumnSizing
|
||||
? {}
|
||||
: { tableLayout: 'auto' };
|
||||
|
||||
return (
|
||||
<div className={className} style={style}>
|
||||
<VisuallyHidden aria-live="polite" id={liveRegionId}>
|
||||
@@ -174,7 +167,6 @@ export function Table<T extends TableItem>({
|
||||
disabledKeys={disabledRows}
|
||||
stale={isStale}
|
||||
aria-describedby={liveRegionId}
|
||||
style={tableRootStyle}
|
||||
>
|
||||
<TableHeader columns={visibleColumns}>
|
||||
{column =>
|
||||
|
||||
@@ -134,6 +134,5 @@ export interface TableProps<T extends TableItem> {
|
||||
selection?: TableSelection;
|
||||
emptyState?: ReactNode;
|
||||
className?: string;
|
||||
columnSizing?: 'content' | 'manual';
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user