Skip to content

Commit a97bd38

Browse files
authored
doc(Table): update parameter docs (#7537)
* doc: 增加 version 信息 * refactor: 补充 version 信息 * doc: 完善注释信息 * doc: 更新示例 * doc: 更新资源文件 * Revert "doc: 更新资源文件" This reverts commit a47f151. * doc: 增加自动生成标签 * doc: 增加默认值 * doc: 增加表格参数
1 parent 8de47f9 commit a97bd38

14 files changed

Lines changed: 40 additions & 1517 deletions

File tree

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
<div class="table-attr">
2-
<h4>@Title</h4>
2+
<p class="table-attr-desc">
3+
<span class="code-label">@Title</span>
4+
@if (Type != null)
5+
{
6+
<span class="table-attr-mark">Automatically generated</span>
7+
}
8+
</p>
39

4-
<Table TItem="AttributeItem" Items="Items" ShowFooter="@ShowFooter">
10+
<Table TItem="AttributeItem" Items="Items" IsBordered="true" IsStriped="true" ShowFooter="@ShowFooter">
511
<TableColumns>
612
<TableColumn @bind-Field="@context.Name" />
713
<TableColumn @bind-Field="@context.Description" TextWrap="true" />
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.table-attr {
2+
margin-top: 1rem;
3+
}
4+
5+
.table-attr-desc {
6+
display: flex;
7+
justify-content: space-between;
8+
}
9+
10+
.table-attr-mark {
11+
font-size: 90%;
12+
}

src/BootstrapBlazor.Server/Components/Samples/Charts/Index.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@page "/chart/index"
1+
@page "/chart/index"
22
@layout MainLayout
33
@inject IStringLocalizer<Index> Localizer
44

@@ -9,6 +9,6 @@
99

1010
<p class="mt-2">@((MarkupString)Localizer["ChartIntro2"].Value)</p>
1111

12-
<AttributeTable Items="@GetAttributes()" />
12+
<AttributeTable Type="typeof(Chart)" />
1313

1414
<MethodTable Items="@GetMethodAttributes()" />

src/BootstrapBlazor.Server/Components/Samples/Charts/Index.razor.cs

Lines changed: 1 addition & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Licensed to the .NET Foundation under one or more agreements.
1+
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the Apache 2.0 License
33
// See the LICENSE file in the project root for more information.
44
// Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone
@@ -10,146 +10,6 @@ namespace BootstrapBlazor.Server.Components.Samples.Charts;
1010
/// </summary>
1111
public sealed partial class Index
1212
{
13-
/// <summary>
14-
/// 获得属性列表
15-
/// </summary>
16-
/// <returns></returns>
17-
private static AttributeItem[] GetAttributes() =>
18-
[
19-
new() {
20-
Name = "Title",
21-
Description = "图表标题",
22-
Type = "string",
23-
ValueList = " — ",
24-
DefaultValue = " — "
25-
},
26-
new() {
27-
Name = "Height",
28-
Description = "组件高度支持单位, 如: 30% , 30px , 30em , calc(30%)",
29-
Type = "string",
30-
ValueList = " — ",
31-
DefaultValue = " — "
32-
},
33-
new() {
34-
Name = "Width",
35-
Description = "组件宽度支持单位, 如: 30% , 30px , 30em , calc(30%)",
36-
Type = "string",
37-
ValueList = " — ",
38-
DefaultValue = " — "
39-
},
40-
new() {
41-
Name = "Responsive",
42-
Description = "设置图表所在canvas是否随其容器大小变化而变化",
43-
Type = "bool",
44-
ValueList = "true|false",
45-
DefaultValue = "true"
46-
},
47-
new() {
48-
Name = "MaintainAspectRatio",
49-
Description = "设置是否约束图表比例",
50-
Type = "bool",
51-
ValueList = "true|false",
52-
DefaultValue = "true"
53-
},
54-
new() {
55-
Name = "AspectRatio",
56-
Description = "设置canvas的宽高比(值为1表示canvas是正方形),如果显示定义了canvas的高度,则此属性无效",
57-
Type = "int",
58-
ValueList = " - ",
59-
DefaultValue = "2"
60-
},
61-
new() {
62-
Name = "ResizeDelay",
63-
Description = "设置 图表尺寸延迟变化时间",
64-
Type = "int",
65-
ValueList = " - ",
66-
DefaultValue = "0"
67-
},
68-
new() {
69-
Name = "Angle",
70-
Description = "设置 Bubble 模式下显示角度 180 为 半圆 360 为正圆",
71-
Type = "int",
72-
ValueList = " - ",
73-
DefaultValue = " - "
74-
},
75-
new() {
76-
Name = "LoadingText",
77-
Description = "设置正在加载文本",
78-
Type = "string",
79-
ValueList = " - ",
80-
DefaultValue = " - "
81-
},
82-
new() {
83-
Name = "ChartType",
84-
Description = "图表组件渲染类型",
85-
Type = "ChartType",
86-
ValueList = "Line|Bar|Pie|Doughnut|Bubble",
87-
DefaultValue = "Line"
88-
},
89-
new() {
90-
Name = "ChartAction",
91-
Description = "图表组件组件方法",
92-
Type = "ChartAction",
93-
ValueList = "Update|AddDataset|RemoveDataset|AddData|RemoveData|SetAngle|Reload",
94-
DefaultValue = "Update"
95-
},
96-
new() {
97-
Name = "DisplayLegend",
98-
Description = "是否显示图例",
99-
Type = "bool",
100-
ValueList = "true|false",
101-
DefaultValue = "true"
102-
},
103-
new() {
104-
Name = "LegendPosition",
105-
Description = "图例显示位置",
106-
Type = "ChartLegendPosition",
107-
ValueList = "Top|Bottom|Left|Right",
108-
DefaultValue = "Top"
109-
},
110-
new()
111-
{
112-
Name = "OnInitAsync",
113-
Description="组件数据初始化委托方法",
114-
Type ="Func<Task<ChartDataSource>>",
115-
ValueList = " - ",
116-
DefaultValue = " - "
117-
},
118-
new()
119-
{
120-
Name = "OnAfterInitAsync",
121-
Description="客户端绘制图表完毕后回调此委托方法",
122-
Type ="Func<Task>",
123-
ValueList = " - ",
124-
DefaultValue = " - "
125-
},
126-
new()
127-
{
128-
Name = "OnAfterUpdateAsync",
129-
Description="客户端更新图表完毕后回调此委托方法",
130-
Type ="Func<ChartAction, Task>",
131-
ValueList = " - ",
132-
DefaultValue = " - "
133-
},
134-
new()
135-
{
136-
Name = "Update",
137-
Description="更新图表方法",
138-
Type ="Task",
139-
ValueList = " - ",
140-
DefaultValue = " - "
141-
},
142-
new()
143-
{
144-
Name = "Reload",
145-
Description="重新加载,强制重新渲染图表",
146-
Type ="Task",
147-
ValueList = " - ",
148-
DefaultValue = " - "
149-
}
150-
151-
];
152-
15313
/// <summary>
15414
/// 获得方法列表
15515
/// </summary>

src/BootstrapBlazor.Server/Components/Samples/Table/Tables.razor

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,4 @@
111111
</Table>
112112
</DemoBlock>
113113

114-
<AttributeTable Items="GetAttributes()" />
115-
116-
<MethodTable Items="GetMethods()" />
117-
118-
<AttributeTable Items="GetTableColumnAttributes()" Title="@Localizer["AttributeTitle"]" />
114+
<AttributeTable Type="typeof(Table<>)" ShowFooter="true" />

0 commit comments

Comments
 (0)