mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-05 05:27:37 +08:00
fix(module: table): fix the scroll position calc method (#1063)
This commit is contained in:
parent
a84382f64b
commit
82031e0a66
@ -93,10 +93,10 @@ namespace AntDesign
|
||||
|
||||
[Parameter]
|
||||
public int ExpandIconColumnIndex { get; set; }
|
||||
|
||||
|
||||
[Parameter]
|
||||
public Func<RowData<TItem>, string> RowClassName { get; set; } = _ => "";
|
||||
|
||||
|
||||
[Parameter]
|
||||
public Func<RowData<TItem>, string> ExpandedRowClassName { get; set; } = _ => "";
|
||||
|
||||
@ -344,8 +344,9 @@ namespace AntDesign
|
||||
|
||||
private async Task SetScrollPositionClassName(bool clear = false)
|
||||
{
|
||||
if (!_isReloading)
|
||||
if (_isReloading)
|
||||
return;
|
||||
|
||||
var element = await JsInvokeAsync<Element>(JSInteropConstants.GetDomInfo, _tableBodyRef);
|
||||
var scrollWidth = element.scrollWidth;
|
||||
var scrollLeft = element.scrollLeft;
|
||||
@ -364,7 +365,8 @@ namespace AntDesign
|
||||
_pingLeft = false;
|
||||
_pingRight = true;
|
||||
}
|
||||
else if (scrollWidth == scrollLeft + clientWidth)
|
||||
// allow the gap between 1 px, it's magic ✨
|
||||
else if (Math.Abs(scrollWidth - (scrollLeft + clientWidth)) < 1)
|
||||
{
|
||||
_pingRight = false;
|
||||
_pingLeft = true;
|
||||
@ -386,7 +388,7 @@ namespace AntDesign
|
||||
{
|
||||
DomEventService.RemoveEventListerner<JsonElement>("window", "resize", OnResize);
|
||||
DomEventService.RemoveEventListerner<JsonElement>(_tableBodyRef, "scroll", OnScroll);
|
||||
DomEventService.RemoveEventListerner<JsonElement>("window", "beforeunload", Reloading);
|
||||
DomEventService.RemoveEventListerner<JsonElement>("window", "beforeunload", Reloading);
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
@ -409,9 +411,10 @@ namespace AntDesign
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that a page is being refreshed
|
||||
/// Indicates that a page is being refreshed
|
||||
/// </summary>
|
||||
private bool _isReloading;
|
||||
|
||||
private void Reloading(JsonElement jsonElement)
|
||||
{
|
||||
_isReloading = true;
|
||||
|
Loading…
Reference in New Issue
Block a user