feat: Blazor LgbTableHeader 支持扩展属性

This commit is contained in:
Argo Zhang 2020-02-03 18:08:39 +08:00
parent b2b4192d55
commit 364c718cd2
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
3 changed files with 15 additions and 2 deletions

View File

@ -1,3 +1,4 @@
using System.Collections.Generic;
using Microsoft.AspNetCore.Components.Forms;
namespace Bootstrap.Admin.Pages.Components
@ -7,6 +8,11 @@ namespace Bootstrap.Admin.Pages.Components
/// </summary>
public interface ITableHeader
{
/// <summary>
/// 获取绑定字段显示名称方法
/// </summary>
IReadOnlyDictionary<string, object> AdditionalAttributes { get; set; }
/// <summary>
/// 获取绑定字段显示名称方法
/// </summary>

View File

@ -1,7 +1,7 @@
using Bootstrap.Admin.Pages.Extensions;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Forms;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
namespace Bootstrap.Admin.Pages.Components
@ -12,6 +12,12 @@ namespace Bootstrap.Admin.Pages.Components
public class LgbTableHeader<TItem> : ComponentBase, ITableHeader
{
#nullable disable
/// <summary>
/// 获得/设置 数据绑定 Value
/// </summary>
[Parameter(CaptureUnmatchedValues = true)]
public IReadOnlyDictionary<string, object> AdditionalAttributes { get; set; }
/// <summary>
/// 获得/设置 数据绑定 Value
/// </summary>

View File

@ -50,6 +50,7 @@ namespace Bootstrap.Admin.Pages.Components
var fieldName = header.GetFieldName();
var displayName = header.GetDisplayName();
builder.OpenElement(index++, "th");
builder.AddMultipleAttributes(index++, header.AdditionalAttributes);
// 如果允许排序
if (header.Sort)