mirror of
https://gitee.com/LongbowEnterprise/BootstrapBlazor.git
synced 2024-12-05 05:29:47 +08:00
!3595 feat(#I64VRE): update fixed column logic for table component
* chore: bump version 7.1.4-beta02 * feat: 增加固定列缓存 * chore: bump version 7.1.4-beta01
This commit is contained in:
parent
60dd3523f2
commit
dd7a917ee0
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
|
||||
<PropertyGroup>
|
||||
<Version>7.1.3</Version>
|
||||
<Version>7.1.4-beta02</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">
|
||||
|
@ -2,6 +2,8 @@
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
// Website: https://www.blazor.zone or https://argozhang.github.io/
|
||||
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
namespace BootstrapBlazor.Components;
|
||||
|
||||
/// <summary>
|
||||
@ -159,7 +161,9 @@ public partial class Table<TItem>
|
||||
|
||||
private bool IsLastMultiColumn() => FixedMultipleColumn && (!FixedExtendButtonsColumn || !IsExtendButtonsInRowHeader) && !GetColumns().Any(i => i.Fixed);
|
||||
|
||||
private bool IsLastColumn(ITableColumn col)
|
||||
private ConcurrentDictionary<ITableColumn, bool> LastFixedColumnCache { get; } = new();
|
||||
|
||||
private bool IsLastColumn(ITableColumn col) => LastFixedColumnCache.GetOrAdd(col, col =>
|
||||
{
|
||||
var ret = false;
|
||||
if (col.Fixed && !IsTail(col))
|
||||
@ -168,11 +172,13 @@ public partial class Table<TItem>
|
||||
ret = index < Columns.Count && Columns[index].Fixed == false;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
});
|
||||
|
||||
private bool IsLastExtendButtonColumn() => IsExtendButtonsInRowHeader && !GetColumns().Any(i => i.Fixed);
|
||||
|
||||
private bool IsFirstColumn(ITableColumn col)
|
||||
private ConcurrentDictionary<ITableColumn, bool> FirstFixedColumnCache { get; } = new();
|
||||
|
||||
private bool IsFirstColumn(ITableColumn col) => FirstFixedColumnCache.GetOrAdd(col, col =>
|
||||
{
|
||||
var ret = false;
|
||||
if (col.Fixed && IsTail(col))
|
||||
@ -181,7 +187,7 @@ public partial class Table<TItem>
|
||||
ret = index > 0 && Columns[index].Fixed == false;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
});
|
||||
|
||||
private bool IsFirstExtendButtonColumn() => !IsExtendButtonsInRowHeader && !GetColumns().Any(i => i.Fixed);
|
||||
|
||||
|
@ -773,6 +773,10 @@ public partial class Table<TItem>
|
||||
Columns.Clear();
|
||||
Columns.AddRange(cols);
|
||||
|
||||
// Columns 重构 清空缓存
|
||||
FirstFixedColumnCache.Clear();
|
||||
LastFixedColumnCache.Clear();
|
||||
|
||||
InternalResetVisibleColumns(Columns.Select(i => new ColumnVisibleItem(i.GetFieldName(), i.Visible)));
|
||||
|
||||
QueryDynamicItems(DynamicContext);
|
||||
|
Loading…
Reference in New Issue
Block a user