|
@@ -38,7 +38,6 @@ function Table<T extends Record<string, any>>(props: Props<T>): ReactElement {
|
|
|
const [isSearching] = useTableSearchState(searchContext);
|
|
|
const colWidth = calcColumnsWidth(columns);
|
|
|
const scrollX = colWidth > 0 ? {x: colWidth} : void 0;
|
|
|
- const {getHeaderGroups, getRowModel} = useTable(columns, data);
|
|
|
|
|
|
const tableColumns = useMemo(
|
|
|
function () {
|
|
@@ -57,16 +56,21 @@ function Table<T extends Record<string, any>>(props: Props<T>): ReactElement {
|
|
|
[columns],
|
|
|
);
|
|
|
|
|
|
+ const {getHeaderGroups, getRowModel, getCenterTotalSize} = useTable(
|
|
|
+ columns,
|
|
|
+ data,
|
|
|
+ );
|
|
|
+
|
|
|
return (
|
|
|
<Spin spinning={isSearching}>
|
|
|
<div className={css.tableWrapper}>
|
|
|
- <table className={css.table}>
|
|
|
+ <table className={css.table} style={{width: getCenterTotalSize()}}>
|
|
|
<thead className={css.tableHead}>
|
|
|
{getHeaderGroups().map(function ({id, headers}) {
|
|
|
return (
|
|
|
<tr key={id}>
|
|
|
{headers.map(header => (
|
|
|
- <th key={header.id}>
|
|
|
+ <th key={header.id} style={{width: header.getSize()}}>
|
|
|
{header.isPlaceholder
|
|
|
? null
|
|
|
: flexRender(
|
|
@@ -85,7 +89,7 @@ function Table<T extends Record<string, any>>(props: Props<T>): ReactElement {
|
|
|
<tr key={id}>
|
|
|
{getVisibleCells().map(function ({id, column, getContext}) {
|
|
|
return (
|
|
|
- <td key={id}>
|
|
|
+ <td key={id} style={{width: column.getSize()}}>
|
|
|
{flexRender(column.columnDef.cell, getContext())}
|
|
|
</td>
|
|
|
);
|