Skip to content

Commit 1bb211e

Browse files
authored
doc(AttributeTable): add IsObsolete parameter (#7562)
1 parent 87ba5bc commit 1bb211e

3 files changed

Lines changed: 20 additions & 3 deletions

File tree

src/BootstrapBlazor.Server/Components/Components/AttributeTable.razor

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,18 @@
99

1010
<Table TItem="AttributeItem" Items="_items" IsBordered="true" IsStriped="true" ShowFooter="@ShowFooter">
1111
<TableColumns>
12-
<TableColumn @bind-Field="@context.Name" />
12+
<TableColumn @bind-Field="@context.Name">
13+
<Template Context="v">
14+
@if (v.Row.IsObsolete)
15+
{
16+
<span class="text-decoration-line-through text-danger">@v.Value</span>
17+
}
18+
else
19+
{
20+
@v.Value
21+
}
22+
</Template>
23+
</TableColumn>
1324
<TableColumn @bind-Field="@context.Description" TextWrap="true" />
1425
<TableColumn @bind-Field="@context.Type" TextWrap="true" Width="180"></TableColumn>
1526
<TableColumn @bind-Field="@context.Version" />

src/BootstrapBlazor.Server/Data/AttributeItem.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ public class AttributeItem
3636
public string Version { get; set; } = "10.2.2";
3737

3838
/// <summary>
39-
///
39+
/// 获得/设置 默认值
4040
/// </summary>
4141
public string DefaultValue { get; set; } = "";
42+
43+
/// <summary>
44+
/// 获得/设置 是否已弃用
45+
/// </summary>
46+
public bool IsObsolete { get; set; }
4247
}

src/BootstrapBlazor.Server/Services/ComponentAttributeCacheService.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ private static List<AttributeItem> GetAttributeCore(Type type)
4949
Name = property.Name,
5050
Type = GetFriendlyTypeName(property.PropertyType),
5151
Description = GetSummary(xmlDoc, property) ?? "",
52-
Version = GetVersion(xmlDoc, property) ?? "10.0.0"
52+
Version = GetVersion(xmlDoc, property) ?? "10.0.0",
53+
IsObsolete = property.GetCustomAttribute<ObsoleteAttribute>() != null
5354
}).OrderBy(i => i.Name).ToList();
5455
}
5556

0 commit comments

Comments
 (0)