Skip to content

Commit 1fc4ae6

Browse files
authored
feat(Upload): update IsMultiple default value to true (#7735)
* refactor: 更改 IsMultiple 默认值为 true * chore: bump version 10.4.0-beta02 * doc: 更新文档说明
1 parent 49a5ddf commit 1fc4ae6

File tree

3 files changed

+19
-30
lines changed

3 files changed

+19
-30
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.4.0-beta01</Version>
4+
<Version>10.4.0-beta02</Version>
55
</PropertyGroup>
66

77
<ItemGroup>

src/BootstrapBlazor/Components/Upload/AvatarUpload.razor.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,6 @@ public partial class AvatarUpload<TValue>
109109
.AddClass("disabled", IsDisabled)
110110
.Build();
111111

112-
/// <summary>
113-
/// <para lang="zh">获得 预览框样式字符串</para>
114-
/// <para lang="en">Gets the preview item style string</para>
115-
/// </summary>
116112
private string? ItemStyleString => CssBuilder.Default()
117113
.AddClass($"width: {Width}px;", Width > 0)
118114
.AddClass($"height: {Height}px;", Height > 0 && !IsCircle)
@@ -164,7 +160,7 @@ protected override async Task TriggerOnChanged(UploadFile file)
164160

165161
/// <summary>
166162
/// <para lang="zh">预览当前头像方法</para>
167-
/// <para lang="en">预览当前头像方法</para>
163+
/// <para lang="en">Previews the current avatar</para>
168164
/// </summary>
169165
public async Task Preview()
170166
{

src/BootstrapBlazor/Components/Upload/UploadBase.cs

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ public abstract class UploadBase<TValue> : ValidateBase<TValue>, IUpload
8282
public bool IsDirectory { get; set; }
8383

8484
/// <summary>
85-
/// <para lang="zh">获得/设置 是否允许多文件上传,默认 false</para>
86-
/// <para lang="en">Gets or sets whether to allow multiple file uploads. Default is false</para>
85+
/// <para lang="zh">获得/设置 是否允许多文件上传,默认 true</para>
86+
/// <para lang="en">Gets or sets whether to allow multiple file uploads. Default is true</para>
8787
/// </summary>
8888
[Parameter]
89-
public bool IsMultiple { get; set; }
89+
public bool IsMultiple { get; set; } = true;
9090

9191
/// <summary>
9292
/// <para lang="zh">获得/设置 点击删除按钮时回调此方法,默认 null</para>
@@ -103,13 +103,13 @@ public abstract class UploadBase<TValue> : ValidateBase<TValue>, IUpload
103103
public Func<UploadFile, Task>? OnChange { get; set; }
104104

105105
/// <summary>
106-
/// <para lang="zh">获得/设置 已上传文件集合,此集合中数据是用户上传文件集合</para>
107-
/// <para lang="en">Gets or sets the uploaded file collection. This collection contains the files uploaded by the user</para>
106+
/// <para lang="zh">获得 已上传文件集合,此集合中数据是用户上传文件集合</para>
107+
/// <para lang="en">Gets the uploaded file collection. This collection contains the files uploaded by the user</para>
108108
/// </summary>
109109
public List<UploadFile> UploadFiles { get; } = [];
110110

111111
/// <summary>
112-
/// <para lang="zh">获得 the 集合 of files to be uploaded</para>
112+
/// <para lang="zh">获得待上传文件集合</para>
113113
/// <para lang="en">Gets the collection of files to be uploaded</para>
114114
/// </summary>
115115
protected List<UploadFile> Files => GetUploadFiles();
@@ -296,11 +296,10 @@ protected void Update(UploadFile file)
296296
}
297297

298298
private List<UploadFile>? _filesCache;
299+
299300
/// <summary>
300-
/// <para lang="zh">获得当前文件集合 <para>Get the files collection</para>
301-
///</para>
302-
/// <para lang="en">Gets当前文件collection <para>Get the files collection</para>
303-
///</para>
301+
/// <para lang="zh">获得当前文件集合</para>
302+
/// <para lang="en">Gets the current files collection</para>
304303
/// </summary>
305304
protected List<UploadFile> GetUploadFiles()
306305
{
@@ -323,32 +322,28 @@ protected List<UploadFile> GetUploadFiles()
323322
}
324323

325324
/// <summary>
326-
/// <para lang="zh">检查是否可以继续上传文件 <para>Check whether can upload file</para>
327-
///</para>
328-
/// <para lang="en">检查whether可以继续上传文件 <para>Check whether can upload file</para>
329-
///</para>
325+
/// <para lang="zh">检查是否可以继续上传文件</para>
326+
/// <para lang="en">Checks whether more files can be uploaded</para>
330327
/// </summary>
331328
protected bool CanUpload()
332329
{
333-
// 允许多上传
334330
if (IsMultiple)
335331
{
336332
return !MaxFileCount.HasValue || Files.Count < MaxFileCount;
337333
}
338334

339-
// 只允许单个上传
340335
return Files.Count == 0;
341336
}
342337

343338
/// <summary>
344339
/// <para lang="zh">检查上传按钮是否可用方法 不可用时返回 true</para>
345-
/// <para lang="en">检查上传buttonwhether可用方法 不可用时返回 true</para>
340+
/// <para lang="en">Checks whether the upload button is disabled. Returns true when disabled</para>
346341
/// </summary>
347342
protected bool CheckStatus() => IsDisabled || !CanUpload();
348343

349344
/// <summary>
350345
/// <para lang="zh">判断是否显示新建按钮</para>
351-
/// <para lang="en">判断whetherdisplay新建button</para>
346+
/// <para lang="en">Determines whether to show the add button</para>
352347
/// </summary>
353348
protected bool ShowAddButton()
354349
{
@@ -361,10 +356,8 @@ protected bool ShowAddButton()
361356
}
362357

363358
/// <summary>
364-
/// <para lang="zh">清空上传列表方法 <para>Clear the upload files collection</para>
365-
///</para>
366-
/// <para lang="en">清空上传列表方法 <para>Clear the upload files collection</para>
367-
///</para>
359+
/// <para lang="zh">清空上传列表方法</para>
360+
/// <para lang="en">Clears the upload files collection</para>
368361
/// </summary>
369362
public virtual void Reset()
370363
{
@@ -376,8 +369,8 @@ public virtual void Reset()
376369
}
377370

378371
/// <summary>
379-
/// <para lang="zh">append html attribute method</para>
380-
/// <para lang="en">append html attribute method</para>
372+
/// <para lang="zh">获得上传组件附加 HTML 属性集合</para>
373+
/// <para lang="en">Gets the additional HTML attributes for the upload component</para>
381374
/// </summary>
382375
protected IDictionary<string, object> GetUploadAdditionalAttributes()
383376
{

0 commit comments

Comments
 (0)