Skip to content

Commit 4b2f98c

Browse files
feat(ITableEditDialogOption): add LabelWidth parameter (#7621)
* table编辑弹窗中增加控制label宽度参数 table编辑弹窗中增加控制label宽度参数,另label对齐参数看组件内的那个名称有但是好像对应另一种编辑模式,没敢动 * doc: 更新注释文档 * doc: 更新注释文档 * doc: 更新注释 * chore: 移除默认值 * refactor: 增加 LabelWidth 赋值 * test: 增加单元测试 * test: 增加单元测试 * chore: bump 10.3.1-beta05 --------- Co-Authored-By: Tony-ST0754 <244411587+tony-st0754@users.noreply.github.com> Co-authored-by: Argo Zhang <argo@live.ca>
1 parent 1189cf0 commit 4b2f98c

File tree

12 files changed

+129
-130
lines changed

12 files changed

+129
-130
lines changed

src/BootstrapBlazor/BootstrapBlazor.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<Version>10.3.1-beta04</Version>
4+
<Version>10.3.1-beta05</Version>
55
</PropertyGroup>
66

77
<ItemGroup>

src/BootstrapBlazor/Components/Dialog/DialogOption.cs

Lines changed: 44 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -6,244 +6,242 @@
66
namespace BootstrapBlazor.Components;
77

88
/// <summary>
9-
/// <para lang="zh">Configuration class for the Dialog component</para>
10-
/// <para lang="en">Configuration class for the Dialog component</para>
9+
/// <para lang="zh">Dialog 对话框组件</para>
10+
/// <para lang="en">Dialog component</para>
1111
/// </summary>
1212
public class DialogOption
1313
{
1414
/// <summary>
15-
/// <para lang="zh">获得/设置 the related modal 实例</para>
15+
/// <para lang="zh">获得/设置 关联的 Modal 实例</para>
1616
/// <para lang="en">Gets or sets the related modal instance</para>
1717
/// </summary>
1818
internal Modal? Modal { get; set; }
1919

2020
/// <summary>
21-
/// <para lang="zh">获得/设置 the dialog title</para>
21+
/// <para lang="zh">获得/设置 对话框标题</para>
2222
/// <para lang="en">Gets or sets the dialog title</para>
2323
/// </summary>
2424
public string? Title { get; set; }
2525

2626
/// <summary>
27-
/// <para lang="zh">获得/设置 the custom 样式 of the dialog</para>
27+
/// <para lang="zh">获得/设置 对话框自定义样式</para>
2828
/// <para lang="en">Gets or sets the custom style of the dialog</para>
2929
/// </summary>
3030
public string? Class { get; set; }
3131

3232
/// <summary>
33-
/// <para lang="zh">获得/设置 the size of the dialog</para>
33+
/// <para lang="zh">获得/设置 对话框尺寸</para>
3434
/// <para lang="en">Gets or sets the size of the dialog</para>
3535
/// </summary>
3636
public Size Size { get; set; } = Size.ExtraExtraLarge;
3737

3838
/// <summary>
39-
/// <para lang="zh">获得/设置 the full screen size of the dialog, default is None</para>
39+
/// <para lang="zh">获得/设置 对话框全屏尺寸 默认值为 None</para>
4040
/// <para lang="en">Gets or sets the full screen size of the dialog, default is None</para>
4141
/// </summary>
42-
/// <remarks>To ensure functionality, when this value is set, <see cref="ShowMaximizeButton"/>, <seealso cref="ShowResize"/>, and <seealso cref="IsDraggable"/> are not available</remarks>
4342
public FullScreenSize FullScreenSize { get; set; } = FullScreenSize.None;
4443

4544
/// <summary>
46-
/// <para lang="zh">获得/设置 是否 to show the maximize 按钮, default is false</para>
45+
/// <para lang="zh">获得/设置 是否显示最大化按钮 默认值为 false</para>
4746
/// <para lang="en">Gets or sets whether to show the maximize button, default is false</para>
4847
/// </summary>
49-
/// <remarks>To ensure functionality, when this value is set to true, <seealso cref="ShowResize"/> and <seealso cref="IsDraggable"/> are not available</remarks>
5048
public bool ShowMaximizeButton { get; set; }
5149

5250
/// <summary>
53-
/// <para lang="zh">获得/设置 是否 the dialog is vertically centered, default is true</para>
51+
/// <para lang="zh">获得/设置 是否垂直居中 默认值为 true</para>
5452
/// <para lang="en">Gets or sets whether the dialog is vertically centered, default is true</para>
5553
/// </summary>
5654
public bool IsCentered { get; set; } = true;
5755

5856
/// <summary>
59-
/// <para lang="zh">获得/设置 是否 the dialog 内容 scrolls when it is too long, default is false</para>
57+
/// <para lang="zh">获得/设置 内容过长时是否滚动 默认值为 false</para>
6058
/// <para lang="en">Gets or sets whether the dialog content scrolls when it is too long, default is false</para>
6159
/// </summary>
6260
public bool IsScrolling { get; set; } = false;
6361

6462
/// <summary>
65-
/// <para lang="zh">获得/设置 是否 to show the resize 按钮, default is false</para>
63+
/// <para lang="zh">获得/设置 是否显示调整大小按钮 默认值为 false</para>
6664
/// <para lang="en">Gets or sets whether to show the resize button, default is false</para>
6765
/// </summary>
6866
public bool ShowResize { get; set; }
6967

7068
/// <summary>
71-
/// <para lang="zh">获得/设置 是否 to show the close 按钮, default is true</para>
69+
/// <para lang="zh">获得/设置 是否显示关闭按钮 默认值为 true</para>
7270
/// <para lang="en">Gets or sets whether to show the close button, default is true</para>
7371
/// </summary>
7472
public bool ShowCloseButton { get; set; } = true;
7573

7674
/// <summary>
77-
/// <para lang="zh">获得/设置 是否 to show the header close 按钮, default is true</para>
75+
/// <para lang="zh">获得/设置 是否显示标题栏关闭按钮 默认值为 true</para>
7876
/// <para lang="en">Gets or sets whether to show the header close button, default is true</para>
7977
/// </summary>
8078
public bool ShowHeaderCloseButton { get; set; } = true;
8179

8280
/// <summary>
83-
/// <para lang="zh">获得/设置 是否 to enable fade animation, default is null</para>
81+
/// <para lang="zh">获得/设置 是否启用渐显动画 默认值为 null</para>
8482
/// <para lang="en">Gets or sets whether to enable fade animation, default is null</para>
8583
/// </summary>
8684
public bool? IsFade { get; set; }
8785

8886
/// <summary>
89-
/// <para lang="zh">获得/设置 是否 to support closing the dialog with the ESC key, default is true</para>
87+
/// <para lang="zh">获得/设置 是否支持通过 ESC 关闭对话框 默认值为 true</para>
9088
/// <para lang="en">Gets or sets whether to support closing the dialog with the ESC key, default is true</para>
9189
/// </summary>
9290
public bool IsKeyboard { get; set; } = true;
9391

9492
/// <summary>
95-
/// <para lang="zh">获得/设置 是否 to support closing the dialog by clicking the backdrop, default is false</para>
93+
/// <para lang="zh">获得/设置 是否支持点击背景关闭对话框 默认值为 false</para>
9694
/// <para lang="en">Gets or sets whether to support closing the dialog by clicking the backdrop, default is false</para>
9795
/// </summary>
9896
public bool IsBackdrop { get; set; }
9997

10098
/// <summary>
101-
/// <para lang="zh">获得/设置 是否 to show the footer, default is true</para>
99+
/// <para lang="zh">获得/设置 是否显示页脚 默认值为 true</para>
102100
/// <para lang="en">Gets or sets whether to show the footer, default is true</para>
103101
/// </summary>
104102
public bool ShowFooter { get; set; } = true;
105103

106104
/// <summary>
107-
/// <para lang="zh">获得/设置 是否 to show the print 按钮, default is false</para>
105+
/// <para lang="zh">获得/设置 是否显示打印按钮 默认值为 false</para>
108106
/// <para lang="en">Gets or sets whether to show the print button, default is false</para>
109107
/// </summary>
110108
public bool ShowPrintButton { get; set; }
111109

112110
/// <summary>
113-
/// <para lang="zh">获得/设置 是否 to show the save 按钮, default is false</para>
111+
/// <para lang="zh">获得/设置 是否显示保存按钮 默认值为 false</para>
114112
/// <para lang="en">Gets or sets whether to show the save button, default is false</para>
115113
/// </summary>
116114
public bool ShowSaveButton { get; set; }
117115

118116
/// <summary>
119-
/// <para lang="zh">获得/设置 是否 to show the print 按钮 in the header, default is false</para>
117+
/// <para lang="zh">获得/设置 是否在标题栏显示打印按钮 默认值为 false</para>
120118
/// <para lang="en">Gets or sets whether to show the print button in the header, default is false</para>
121119
/// </summary>
122120
public bool ShowPrintButtonInHeader { get; set; }
123121

124122
/// <summary>
125-
/// <para lang="zh">获得/设置 the text of the print 按钮 in the header, default is "Print" from the resource file</para>
123+
/// <para lang="zh">获得/设置 标题栏打印按钮文本 默认值为资源文件中的 "Print"</para>
126124
/// <para lang="en">Gets or sets the text of the print button in the header, default is "Print" from the resource file</para>
127125
/// </summary>
128126
public string? PrintButtonText { get; set; }
129127

130128
/// <summary>
131-
/// <para lang="zh">获得/设置 the related 数据, mostly used for passing values</para>
129+
/// <para lang="zh">获得/设置 关联数据多用于传值</para>
132130
/// <para lang="en">Gets or sets the related data, mostly used for passing values</para>
133131
/// </summary>
134132
public object? BodyContext { get; set; }
135133

136134
/// <summary>
137-
/// <para lang="zh">获得/设置 the ModalBody component</para>
135+
/// <para lang="zh">获得/设置 ModalBody 组件</para>
138136
/// <para lang="en">Gets or sets the ModalBody component</para>
139137
/// </summary>
140138
public RenderFragment? BodyTemplate { get; set; }
141139

142140
/// <summary>
143-
/// <para lang="zh">获得/设置 the ModalFooter component</para>
141+
/// <para lang="zh">获得/设置 ModalFooter 组件</para>
144142
/// <para lang="en">Gets or sets the ModalFooter component</para>
145143
/// </summary>
146144
public RenderFragment? FooterTemplate { get; set; }
147145

148146
/// <summary>
149-
/// <para lang="zh">获得/设置 the ModalHeader component 模板</para>
147+
/// <para lang="zh">获得/设置 ModalHeader 组件模板</para>
150148
/// <para lang="en">Gets or sets the ModalHeader component template</para>
151149
/// </summary>
152150
public RenderFragment? HeaderTemplate { get; set; }
153151

154152
/// <summary>
155-
/// <para lang="zh">获得/设置 the custom 按钮s in the ModalHeader component</para>
153+
/// <para lang="zh">获得/设置 ModalHeader 组件自定义按钮</para>
156154
/// <para lang="en">Gets or sets the custom buttons in the ModalHeader component</para>
157155
/// </summary>
158156
public RenderFragment? HeaderToolbarTemplate { get; set; }
159157

160158
/// <summary>
161-
/// <para lang="zh">获得/设置 the custom component</para>
159+
/// <para lang="zh">获得/设置 自定义组件</para>
162160
/// <para lang="en">Gets or sets the custom component</para>
163161
/// </summary>
164162
public BootstrapDynamicComponent? Component { get; set; }
165163

166164
/// <summary>
167-
/// <para lang="zh">获得/设置 the 图标 of the save 按钮, default is null and uses the current theme 图标</para>
165+
/// <para lang="zh">获得/设置 保存按钮图标 默认值为 null 且使用当前主题图标</para>
168166
/// <para lang="en">Gets or sets the icon of the save button, default is null and uses the current theme icon</para>
169167
/// </summary>
170168
public string? SaveButtonIcon { get; set; }
171169

172170
/// <summary>
173-
/// <para lang="zh">获得/设置 the text of the save 按钮</para>
171+
/// <para lang="zh">获得/设置 保存按钮文本</para>
174172
/// <para lang="en">Gets or sets the text of the save button</para>
175173
/// </summary>
176174
public string? SaveButtonText { get; set; }
177175

178176
/// <summary>
179-
/// <para lang="zh">获得/设置 the 回调方法 for the save 按钮</para>
177+
/// <para lang="zh">获得/设置 保存按钮回调方法</para>
180178
/// <para lang="en">Gets or sets the callback method for the save button</para>
181179
/// </summary>
182180
public Func<Task<bool>>? OnSaveAsync { get; set; }
183181

184182
/// <summary>
185-
/// <para lang="zh">获得/设置 the 图标 of the close 按钮, default is null and uses the current theme 图标</para>
183+
/// <para lang="zh">获得/设置 关闭按钮图标 默认值为 null 且使用当前主题图标</para>
186184
/// <para lang="en">Gets or sets the icon of the close button, default is null and uses the current theme icon</para>
187185
/// </summary>
188186
public string? CloseButtonIcon { get; set; }
189187

190188
/// <summary>
191-
/// <para lang="zh">获得/设置 the text of the close 按钮</para>
189+
/// <para lang="zh">获得/设置 关闭按钮文本</para>
192190
/// <para lang="en">Gets or sets the text of the close button</para>
193191
/// </summary>
194192
public string? CloseButtonText { get; set; }
195193

196194
/// <summary>
197-
/// <para lang="zh">获得/设置 the 回调方法 for closing the dialog</para>
195+
/// <para lang="zh">获得/设置 关闭对话框回调方法</para>
198196
/// <para lang="en">Gets or sets the callback method for closing the dialog</para>
199197
/// </summary>
200198
public Func<Task>? OnCloseAsync { get; set; }
201199

202200
/// <summary>
203-
/// <para lang="zh">获得/设置 是否 to automatically close the dialog after saving successfully, default is true</para>
201+
/// <para lang="zh">获得/设置 是否自动关闭对话框(保存成功后) 默认值为 true</para>
204202
/// <para lang="en">Gets or sets whether to automatically close the dialog after saving successfully, default is true</para>
205203
/// </summary>
206204
public bool IsAutoCloseAfterSave { get; set; } = true;
207205

208206
/// <summary>
209-
/// <para lang="zh">获得/设置 是否 the dialog can be dragged, default is false</para>
207+
/// <para lang="zh">获得/设置 是否允许拖拽对话框 默认值为 false</para>
210208
/// <para lang="en">Gets or sets whether the dialog can be dragged, default is false</para>
211209
/// </summary>
212210
public bool IsDraggable { get; set; }
213211

214212
/// <summary>
215-
/// <para lang="zh">获得/设置 the 回调方法 when the dialog is shown</para>
213+
/// <para lang="zh">获得/设置 对话框显示回调方法</para>
216214
/// <para lang="en">Gets or sets the callback method when the dialog is shown</para>
217215
/// </summary>
218216
public Func<Task>? OnShownAsync { get; set; }
219217

220218
/// <summary>
221-
/// <para lang="zh">获得/设置 是否 to show the export PDF 按钮, default is false</para>
219+
/// <para lang="zh">获得/设置 是否显示导出 PDF 按钮 默认值为 false</para>
222220
/// <para lang="en">Gets or sets whether to show the export PDF button, default is false</para>
223221
/// </summary>
224222
public bool ShowExportPdfButton { get; set; }
225223

226224
/// <summary>
227-
/// <para lang="zh">获得/设置 是否 to show the export PDF 按钮 in the header, default is false</para>
225+
/// <para lang="zh">获得/设置 是否在标题栏显示导出 PDF 按钮 默认值为 false</para>
228226
/// <para lang="en">Gets or sets whether to show the export PDF button in the header, default is false</para>
229227
/// </summary>
230228
public bool ShowExportPdfButtonInHeader { get; set; }
231229

232230
/// <summary>
233-
/// <para lang="zh">获得/设置 the configuration options for the export PDF 按钮</para>
231+
/// <para lang="zh">获得/设置 导出 PDF 按钮配置</para>
234232
/// <para lang="en">Gets or sets the configuration options for the export PDF button</para>
235233
/// </summary>
236234
public ExportPdfButtonOptions? ExportPdfButtonOptions { get; set; }
237235

238236
/// <summary>
239-
/// <para lang="zh">获得/设置 是否 to hide the previous dialog when opening a new one, default is false</para>
237+
/// <para lang="zh">获得/设置 是否隐藏上一个对话框 默认值为 false</para>
240238
/// <para lang="en">Gets or sets whether to hide the previous dialog when opening a new one, default is false</para>
241239
/// </summary>
242240
public bool IsHidePreviousDialog { get; set; }
243241

244242
/// <summary>
245-
/// <para lang="zh">Method to close the dialog</para>
246-
/// <para lang="en">Method to close the dialog</para>
243+
/// <para lang="zh">关闭对话框方法</para>
244+
/// <para lang="en">Closes the dialog</para>
247245
/// </summary>
248246
public async Task CloseDialogAsync()
249247
{
@@ -254,8 +252,8 @@ public async Task CloseDialogAsync()
254252
}
255253

256254
/// <summary>
257-
/// <para lang="zh">Method to convert parameters to component attributes</para>
258-
/// <para lang="en">Method to convert parameters to component attributes</para>
255+
/// <para lang="zh">将参数转换为组件特性</para>
256+
/// <para lang="en">Converts parameters to component attributes</para>
259257
/// </summary>
260258
public Dictionary<string, object> ToAttributes()
261259
{

src/BootstrapBlazor/Components/Dialog/EditDialog.razor

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
@inherits DialogBase<TModel>
44
@attribute [BootstrapModuleAutoLoader("Dialog/EditDialog.razor.js", AutoInvokeInit = false, AutoInvokeDispose = false)]
55

6-
<ValidateForm Model="@Model" OnValidSubmit="@OnValidSubmitAsync" DisableAutoSubmitFormByEnter="@DisableAutoSubmitFormByEnter">
6+
<ValidateForm Model="@Model" OnValidSubmit="@OnValidSubmitAsync" LabelWidth="@LabelWidth"
7+
DisableAutoSubmitFormByEnter="@DisableAutoSubmitFormByEnter">
78
<CascadingValue Value="ItemChangedType" IsFixed="true">
89
@if (BodyTemplate != null)
910
{
@@ -16,9 +17,10 @@
1617
}
1718
else
1819
{
19-
<EditorForm TModel="TModel" Items="Items" ItemChangedType="ItemChangedType" ItemsPerRow="ItemsPerRow" RowType="RowType"
20-
LabelAlign="LabelAlign" ShowLabel="ShowLabel" ShowUnsetGroupItemsOnTop="ShowUnsetGroupItemsOnTop"
21-
IsRenderWhenValueChanged="true">
20+
<EditorForm TModel="TModel" Items="Items" ItemChangedType="ItemChangedType"
21+
ItemsPerRow="ItemsPerRow" RowType="RowType"
22+
LabelAlign="LabelAlign" ShowLabel="ShowLabel"
23+
ShowUnsetGroupItemsOnTop="ShowUnsetGroupItemsOnTop" IsRenderWhenValueChanged="true">
2224
<Buttons>
2325
@RenderFooter
2426
</Buttons>

src/BootstrapBlazor/Components/Dialog/EditDialog.razor.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ public partial class EditDialog<TModel>
5454
/// <para lang="en">Gets or sets Save Callback Delegate. Return false to keep edit dialog, true to close it</para>
5555
/// </summary>
5656
[Parameter]
57-
#if NET6_0_OR_GREATER
5857
[EditorRequired]
59-
#endif
6058
public Func<EditContext, Task<bool>>? OnSaveAsync { get; set; }
6159

6260
/// <summary>
@@ -87,6 +85,13 @@ public partial class EditDialog<TModel>
8785
[Parameter]
8886
public bool? DisableAutoSubmitFormByEnter { get; set; }
8987

88+
/// <summary>
89+
/// <para lang="zh">获得/设置 标签宽度 默认为 120 </para>
90+
/// <para lang="en">Gets or sets Label Width. Default is 120</para>
91+
/// </summary>
92+
[Parameter]
93+
public int? LabelWidth { get; set; }
94+
9095
/// <summary>
9196
/// <para lang="zh">获得/设置 DialogFooterTemplate 实例</para>
9297
/// <para lang="en">Gets or sets DialogFooterTemplate Instance</para>

0 commit comments

Comments
 (0)