Skip to content

Commit 2e4d93f

Browse files
authored
doc(AttributeTable): support base type parameter (#7554)
* chore: 调整样式 * doc: 更新注释 * feat: 增加基类参数支持 * chore: 精简逻辑
1 parent 0ee1538 commit 2e4d93f

5 files changed

Lines changed: 24 additions & 24 deletions

File tree

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88
}
99

1010
.table-attr-mark {
11-
font-size: 90%;
11+
font-size: 85%;
12+
color: var(--bs-success);
1213
}

src/BootstrapBlazor.Server/Directory.Build.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<XmlDocsToCopy Include="%(Reference.RelativeDir)BootstrapBlazor*.xml" />
2020
</ItemGroup>
2121
<Message Text="Copying XML docs to output path: $(OutputPath)" Importance="High" />
22-
<Copy SourceFiles="@(XmlDocsToCopy)" DestinationFolder="$(OutputPath)" SkipUnchangedFiles="true" Condition="Exists('%(RootDir)%(Directory)%(Filename)%(Extension)')" />
22+
<Copy SourceFiles="@(XmlDocsToCopy)" DestinationFolder="$(OutputPath)" />
2323
</Target>
2424

2525
</Project>

src/BootstrapBlazor.Server/Services/ComponentAttributeCacheService.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ private static List<AttributeItem> GetAttributeCore(Type type)
6060
{
6161
if (xmlDoc == null) return null;
6262

63-
var memberName = $"P:{property.DeclaringType?.FullName}.{property.Name}";
63+
var type = property.DeclaringType ?? property.PropertyType;
64+
var typeName = type.FullName ?? $"BootstrapBlazor.Components.{type.Name}";
65+
var memberName = $"P:{typeName}.{property.Name}";
6466
var summaryElement = FindSummaryElement(xmlDoc, memberName);
6567
return summaryElement == null ? null : GetLocalizedSummary(summaryElement);
6668
}

src/BootstrapBlazor/Components/Display/DisplayBase.cs

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ namespace BootstrapBlazor.Components;
1515
public abstract class DisplayBase<TValue> : BootstrapModuleComponentBase
1616
{
1717
/// <summary>
18-
/// <para lang="zh">是否显示 标签</para>
18+
/// <para lang="zh">是否显示标签</para>
1919
/// <para lang="en">Whether to Show Label</para>
2020
/// </summary>
2121
protected bool IsShowLabel { get; set; }
2222

2323
/// <summary>
24-
/// <para lang="zh">获得 the <see cref="FieldIdentifier"/> for the bound value.</para>
24+
/// <para lang="zh">获得绑定值的 <see cref="FieldIdentifier"/></para>
2525
/// <para lang="en">Gets the <see cref="FieldIdentifier"/> for the bound value.</para>
2626
/// </summary>
2727
protected FieldIdentifier? FieldIdentifier { get; set; }
@@ -40,7 +40,7 @@ public abstract class DisplayBase<TValue> : BootstrapModuleComponentBase
4040
protected Type? ValueType { get; set; }
4141

4242
/// <summary>
43-
/// <para lang="zh">获得/设置 the value of the input. This should be used with two-way binding.</para>
43+
/// <para lang="zh">获得/设置 输入组件的值,支持双向绑定。</para>
4444
/// <para lang="en">Gets or sets the value of the input. This should be used with two-way binding.</para>
4545
/// </summary>
4646
/// <example>
@@ -51,28 +51,28 @@ public abstract class DisplayBase<TValue> : BootstrapModuleComponentBase
5151
public TValue? Value { get; set; }
5252

5353
/// <summary>
54-
/// <para lang="zh">获得/设置 a 回调 that updates the bound value.</para>
54+
/// <para lang="zh">获得/设置 用于更新绑定值的回调。</para>
5555
/// <para lang="en">Gets or sets a callback that updates the bound value.</para>
5656
/// </summary>
5757
[Parameter]
5858
public EventCallback<TValue?> ValueChanged { get; set; }
5959

6060
/// <summary>
61-
/// <para lang="zh">获得/设置 an expression that identifies the bound value.</para>
61+
/// <para lang="zh">获得/设置 标识绑定值的表达式。</para>
6262
/// <para lang="en">Gets or sets an expression that identifies the bound value.</para>
6363
/// </summary>
6464
[Parameter]
6565
public Expression<Func<TValue?>>? ValueExpression { get; set; }
6666

6767
/// <summary>
68-
/// <para lang="zh">获得/设置 是否显示前置标签 默认值为 null 为空时默认不显示标签</para>
68+
/// <para lang="zh">获得/设置 是否显示前置标签默认值为 null,为空时不显示标签</para>
6969
/// <para lang="en">Gets or sets Whether to Show Label. Default is null, not show label when null</para>
7070
/// </summary>
7171
[Parameter]
7272
public bool? ShowLabel { get; set; }
7373

7474
/// <summary>
75-
/// <para lang="zh">获得/设置 是否显示 Tooltip 多用于文字过长导致裁减时使用 默认 null</para>
75+
/// <para lang="zh">获得/设置 是否显示 Tooltip,多用于文字过长导致裁剪时使用,默认 null</para>
7676
/// <para lang="en">Gets or sets Whether to Show Tooltip. Default is null</para>
7777
/// </summary>
7878
[Parameter]
@@ -93,29 +93,28 @@ public abstract class DisplayBase<TValue> : BootstrapModuleComponentBase
9393
protected ValidateForm? ValidateForm { get; set; }
9494

9595
/// <summary>
96-
/// <para lang="zh">获得 IShowLabel 实例</para>
97-
/// <para lang="en">Get IShowLabel Instance</para>
96+
/// <para lang="zh">获得 <see cref="IShowLabel"/> 实例</para>
97+
/// <para lang="en">Get <see cref="IShowLabel"/> Instance</para>
9898
/// </summary>
9999
[CascadingParameter(Name = "EditorForm")]
100100
protected IShowLabel? EditorForm { get; set; }
101101

102102
/// <summary>
103-
/// <para lang="zh">获得 InputGroup 实例</para>
104-
/// <para lang="en">Get InputGroup Instance</para>
103+
/// <para lang="zh">获得 <see cref="BootstrapInputGroup"/> 实例</para>
104+
/// <para lang="en">Get <see cref="BootstrapInputGroup"/> Instance</para>
105105
/// </summary>
106106
[CascadingParameter]
107107
protected BootstrapInputGroup? InputGroup { get; set; }
108108

109109
/// <summary>
110-
/// <para lang="zh">获得 IFilter 实例</para>
111-
/// <para lang="en">Get IFilter Instance</para>
110+
/// <para lang="zh">获得 <see cref="IFilter"/> 实例</para>
111+
/// <para lang="en">Get <see cref="IFilter"/> Instance</para>
112112
/// </summary>
113113
[CascadingParameter]
114114
protected IFilter? Filter { get; set; }
115115

116116
/// <summary>
117-
/// <para lang="zh">SetParametersAsync 方法</para>
118-
/// <para lang="en">SetParametersAsync Method</para>
117+
/// <inheritdoc/>
119118
/// </summary>
120119
/// <param name="parameters"></param>
121120
public override Task SetParametersAsync(ParameterView parameters)
@@ -135,8 +134,7 @@ public override Task SetParametersAsync(ParameterView parameters)
135134
}
136135

137136
/// <summary>
138-
/// <para lang="zh">OnParametersSet 方法</para>
139-
/// <para lang="en">OnParametersSet Method</para>
137+
/// <inheritdoc/>
140138
/// </summary>
141139
protected override void OnParametersSet()
142140
{
@@ -185,7 +183,6 @@ protected override void OnParametersSet()
185183
/// <para lang="en">Format Value to String Method</para>
186184
/// </summary>
187185
/// <param name="value">The value to format.</param>
188-
/// <returns>A string representation of the value.</returns>
189186
protected virtual string? FormatValueAsString(TValue? value)
190187
{
191188
string? ret;

src/BootstrapBlazor/Components/Validate/ValidateBase.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ public abstract class ValidateBase<TValue> : DisplayBase<TValue>, IValidateCompo
4242
protected string? ErrorMessage { get; set; }
4343

4444
/// <summary>
45-
/// <para lang="zh">获得/设置 数据合规样式</para>
46-
/// <para lang="en">Gets or sets the validation CSS class</para>
45+
/// <para lang="zh">获得 数据合规样式</para>
46+
/// <para lang="en">Gets the validation CSS class</para>
4747
/// </summary>
4848
protected string? ValidCss => IsValid.HasValue ? GetValidString(IsValid.Value) : null;
4949

@@ -62,7 +62,7 @@ public abstract class ValidateBase<TValue> : DisplayBase<TValue>, IValidateCompo
6262
protected string? Disabled => IsDisabled ? "disabled" : null;
6363

6464
/// <summary>
65-
/// <para lang="zh">是否显示 必填项标记</para>
65+
/// <para lang="zh">获得/设置 是否显示 必填项标记</para>
6666
/// <para lang="en">Gets or sets whether to display the required field marker</para>
6767
/// </summary>
6868
protected string? Required { get; set; }

0 commit comments

Comments
 (0)