fix(module: table): revert min-height for scroll y (#3269)

* fix(module: table): revert min-height for scroll y

* fix table min-height
This commit is contained in:
James Yeung 2023-05-19 23:58:24 +08:00 committed by GitHub
parent bcf24c0b01
commit 84ffd9bbfe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 9 deletions

View File

@ -47,8 +47,8 @@
@header(this)
</table>
</div>
<div class="ant-table-body" @ref="_tableBodyRef" style="@(ScrollX!=null?" overflow: auto scroll;":"overflow-y: scroll;") max-height: @((CssSizeLength)ScrollY); min-height:@((CssSizeLength)ScrollY); --scrollbar-width: @((CssSizeLength)_scrollBarWidth);">
<table style="@(ScrollX!=null?$" width: {(CssSizeLength)ScrollX}; min-width: 100%;":"") @(_isEmpty?$"min-height:{(CssSizeLength)ScrollY};":"") @TableLayoutStyle">
<div class="ant-table-body" @ref="_tableBodyRef" style="@(ScrollX!=null?" overflow: auto scroll;":"overflow-y: scroll;") max-height: @((CssSizeLength)ScrollY); @(UseItemsProvider?$"min-height:{(CssSizeLength)ScrollY};":"") --scrollbar-width: @((CssSizeLength)_scrollBarWidth);">
<table style="@(ScrollX!=null?$" width: {(CssSizeLength)ScrollX}; min-width: 100%;":"") @TableLayoutStyle">
@colGroup((this, false))
<tbody class="ant-table-tbody">
<tr aria-hidden="true" class="ant-table-measure-row" style="height: 0px; font-size: 0px;">
@ -181,7 +181,7 @@ Func<Table<TItem>, IEnumerable<TItem>, int, Dictionary<TItem, RowData<TItem>>, R
@if (table._hasInitialized)
{
#if NET5_0_OR_GREATER
if (table.UseItemsProvider && !table._isEmpty)
if (table.UseItemsProvider&&!table._isVirtualizeEmpty)
{
<Microsoft.AspNetCore.Components.Web.Virtualization.Virtualize
TItem="(TItem,int)"
@ -202,7 +202,7 @@ Func<Table<TItem>, IEnumerable<TItem>, int, Dictionary<TItem, RowData<TItem>>, R
}
else
#endif
if (table._isEmpty||showItems==null)
if (table._total<=0 || showItems==null)
{
<tr class="ant-table-placeholder">
<td colspan="@(table.ColumnContext.Columns.Count + (table.ExpandTemplate != null? 1 : 0))" class="ant-table-cell">

View File

@ -175,7 +175,6 @@ namespace AntDesign
[Parameter]
public bool EnableVirtualization { get; set; }
private bool UseItemsProvider => EnableVirtualization && ServerSide;
#endif
[Inject]
@ -212,11 +211,23 @@ namespace AntDesign
private decimal _tableWidth;
private bool _isEmpty;
private bool _isVirtualizeEmpty;
private bool ServerSide => _hasRemoteDataSourceAttribute ? RemoteDataSource : Total > _dataSourceCount;
private bool UseResizeObserver => ScrollX != null;
private bool UseItemsProvider
{
get
{
#if NET5_0_OR_GREATER
return EnableVirtualization && ServerSide;
#else
return false;
#endif
}
}
bool ITable.TreeMode => _treeMode;
int ITable.IndentSize => IndentSize;
string ITable.ScrollX => ScrollX;
@ -450,8 +461,6 @@ namespace AntDesign
_shouldRender = true;
}
_isEmpty = _total <= 0 || _showItems == null;
if (!_preventRender)
{
if (_outerSelectedRows != null)
@ -503,7 +512,7 @@ namespace AntDesign
if (_startIndex == 0 && _total == 0)
{
_isEmpty = true;
_isVirtualizeEmpty = true;
}
return new ItemsProviderResult<(TItem, int)>(_dataSource.Select((data, index) => (data, index)), _total);
}