fix(frontend): fill available table height

Ensure short datasets use the DataTable body's calculated viewport height instead of collapsing to their content height.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
rookit
2026-08-03 11:06:45 +08:00
co-authored by Copilot
parent be83c727ec
commit 02c3ab138f
2 changed files with 9 additions and 1 deletions
+5 -1
View File
@@ -1,4 +1,4 @@
import type {Key} from 'react'
import type {CSSProperties, Key} from 'react'
import {useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState} from 'react'
import {Button, Checkbox, Divider, Input, Pagination, Popconfirm, Popover, Select, Space, Table, Tooltip} from 'antd'
import {message} from '../utils/appMessage'
@@ -775,6 +775,9 @@ export default function DataTable<RecordType extends Record<string, unknown> = R
const activeFilterCount = filterState.advanced.filter(isActiveAdvancedFilter).length
const filterSummary = savedFilterName || (activeFilterCount > 0 ? `${activeFilterCount} filter(s)` : '')
const renderedActions = typeof actions === 'function' ? actions({ params: tableParams }) : actions
const tableStyle: CSSProperties & {'--asp-table-body-height': string} = {
'--asp-table-body-height': `${tableBodyHeight}px`,
}
const searchControl = (
<Input.Search
placeholder={searchPlaceholder}
@@ -902,6 +905,7 @@ export default function DataTable<RecordType extends Record<string, unknown> = R
<Table<RecordType>
key={tableResetKey}
className="asp-data-table"
style={tableStyle}
columns={antColumns}
dataSource={data}
rowKey={rowKey}
+4
View File
@@ -113,6 +113,10 @@ input:-webkit-autofill:active,
background: transparent;
}
.asp-data-table .ant-table-body {
min-height: var(--asp-table-body-height);
}
.asp-table-floating-help {
position: absolute;
right: 12px;