Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/BootstrapBlazor.Server/Components/Samples/UploadCards.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@page "/upload-card"
@page "/upload-card"
@inject IOptions<WebsiteOptions> WebsiteOption
@inject IStringLocalizer<UploadCards> Localizer
@inject ToastService ToastService
Expand Down Expand Up @@ -52,6 +52,12 @@
<Switch @bind-Value="@_showDeleteButton"></Switch>
</BootstrapInputGroup>
</div>
<div class="col-12 col-sm-6 col-xl-3">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="ShowDeleteConfirmButton"></BootstrapInputGroupLabel>
<Switch @bind-Value="@_showDeleteConfirmButton"></Switch>
</BootstrapInputGroup>
</div>
<div class="col-12 col-sm-6 col-xl-3">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="ShowZoomButton"></BootstrapInputGroupLabel>
Expand All @@ -68,7 +74,7 @@
</section>
<CardUpload TValue="string" IsMultiple="@_isMultiple" IsDirectory="@_isDirectory"
IsDisabled="@_isDisabled" IsUploadButtonAtFirst="@_isUploadButtonAtFirst"
ShowProgress="@_showProgress" ShowDeleteButton="@_showDeleteButton"
ShowProgress="@_showProgress" ShowDeleteButton="@_showDeleteButton" ShowDeleteConfirmButton="@_showDeleteConfirmButton"
ShowDownloadButton="@_showDownloadButton" ShowZoomButton="@_showZoomButton" OnChange="@OnCardUpload"></CardUpload>
</DemoBlock>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the Apache 2.0 License
// See the LICENSE file in the project root for more information.
// Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone
Expand All @@ -17,6 +17,7 @@ public partial class UploadCards : IDisposable
private bool _showProgress = true;
private bool _showZoomButton = true;
private bool _showDeleteButton = true;
private bool _showDeleteConfirmButton = true;
private bool _showDownloadButton = true;

private List<UploadFile> DefaultFormatFileList { get; } =
Expand Down
25 changes: 20 additions & 5 deletions src/BootstrapBlazor/Components/Upload/CardUpload.razor
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,26 @@
</div>
@if (ShowDeleteButton)
{
<button type="button" class="btn btn-sm btn-outline-danger"
disabled="@GetDeleteButtonDisabledString(item)" aria-label="delete"
@onclick="() => OnCardFileDelete(item)">
<i class="@RemoveIcon"></i>
</button>
@if (ShowDeleteConfirmButton)
{
<PopConfirmButton Placement="Placement.Top"
Color="Color.Danger"
ConfirmIcon="fa-solid fa-triangle-exclamation text-danger"
ConfirmButtonColor="Color.Danger"
Content="确定删除数据吗?"
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
Outdated
Icon="fa-regular fa-trash-can"
IsAsync="true"
OnConfirm="@(async()=>await OnCardFileDelete(item))"/>
}
else
{
<button type="button" class="btn btn-sm btn-outline-danger"
disabled="@GetDeleteButtonDisabledString(item)" aria-label="delete"
@onclick="() => OnCardFileDelete(item)">
<i class="@RemoveIcon"></i>
</button>
}

}
</div>
@if (GetShowProgress(item))
Expand Down
6 changes: 6 additions & 0 deletions src/BootstrapBlazor/Components/Upload/FileListUploadBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ public class FileListUploadBase<TValue> : UploadBase<TValue>
[Parameter]
public bool ShowDeleteButton { get; set; }

/// <summary>
/// 获得/设置 删除前是否显示确认对话框,依赖 ShowDeleteButton 属性为true时有效
/// </summary>
[Parameter]
public bool ShowDeleteConfirmButton { get; set; }

/// <summary>
/// 获得/设置 删除按钮图标
/// </summary>
Expand Down