!1923 feat(#I4CSI9): add OnAfterRenderCallback parameter on Table

* chore: bump version to 5.13.2
* doc: 增加 OnAfterRenderCallback 回调说明文档
* feat: 增加参数
* chore: 重命名项目文件夹
* chore: 更新项目文件夹
* feat: 增加 OnAfterRenderCallback 回调
This commit is contained in:
Argo 2021-10-06 14:19:10 +00:00
parent 1a21cf1513
commit 2e3f0cba0a
4 changed files with 27 additions and 2 deletions

View File

@ -109,7 +109,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "config", "config", "{8AB9DB
NuGet.Config = NuGet.Config
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Middleware", "Middleware", "{4A7F4513-C515-40DD-A217-169E1CBB2827}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "middleware", "middleware", "{4A7F4513-C515-40DD-A217-169E1CBB2827}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BootstrapBlazor.Middleware", "src\Middleware\BootstrapBlazor.Middleware\BootstrapBlazor.Middleware.csproj", "{59B49D4C-05FB-4E51-AB40-9498ADC71DD0}"
EndProject

View File

@ -579,6 +579,13 @@ namespace BootstrapBlazor.Shared.Pages.Table
ValueList = " — ",
DefaultValue = " — "
},
new AttributeItem() {
Name = nameof(BootstrapBlazor.Components.Table<Foo>.OnAfterRenderCallback),
Description = "表格渲染完毕后回调方法",
Type = "Func<Table<TItem>, Task>",
ValueList = " — ",
DefaultValue = " — "
},
new AttributeItem() {
Name = "OnTreeExpand",
Description = "树形数据节点展开式回调委托方法",

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<Version>5.13.1</Version>
<Version>5.13.2</Version>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">

View File

@ -216,6 +216,12 @@ namespace BootstrapBlazor.Components
[Parameter]
public int LineNoColumnWidth { get; set; }
/// <summary>
/// 获得/设置 Table 组件渲染完毕回调
/// </summary>
[Parameter]
public Func<Table<TItem>, Task>? OnAfterRenderCallback { get; set; }
[Inject]
[NotNull]
private IOptions<BootstrapBlazorOptions>? Options { get; set; }
@ -593,6 +599,12 @@ namespace BootstrapBlazor.Components
[NotNull]
public string? SortDescText { get; set; }
/// <summary>
/// 获得/设置 OnAfterRenderCallback 是否已经触发 默认 false
/// </summary>
/// <remarks>与 <see cref="OnAfterRenderCallback"/> 回调配合</remarks>
private bool OnAfterRenderIsTriggered { get; set; }
/// <summary>
/// OnInitialized 方法
/// </summary>
@ -765,6 +777,12 @@ namespace BootstrapBlazor.Components
methodName = null;
}
if (!OnAfterRenderIsTriggered && OnAfterRenderCallback != null)
{
OnAfterRenderIsTriggered = true;
await OnAfterRenderCallback(this);
}
// 增加去重保护 _loop 为 false 时执行
if (!_loop && IsAutoRefresh && AutoRefreshInterval > 500)
{