Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/BootstrapBlazor/Components/Message/MessageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public async Task Show(MessageOption option, Message? message = null)
{
if (!option.ForceDelay)
{
if (Options.MessageDelay != 0)
if (Options.MessageDelay > 0)
{
option.Delay = Options.MessageDelay;
}
Expand Down
2 changes: 1 addition & 1 deletion src/BootstrapBlazor/Components/SweetAlert/SwalService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class SwalService(IOptionsMonitor<BootstrapBlazorOptions> options) : Boot
/// <param name="swal">指定弹窗组件 默认为 null 使用 <see cref="BootstrapBlazorRoot"/> 组件内置弹窗组件</param>
public async Task Show(SwalOption option, SweetAlert? swal = null)
{
if (!option.ForceDelay && options.CurrentValue.SwalDelay != 0)
if (!option.ForceDelay && options.CurrentValue.SwalDelay > 0)
{
option.Delay = options.CurrentValue.SwalDelay;
}
Expand Down
15 changes: 11 additions & 4 deletions src/BootstrapBlazor/Components/Table/Table.razor.Toolbar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1153,11 +1153,18 @@ private async Task ExecuteExportAsync(Func<Task<bool>> callback)
}
}

private ToastOption GetToastOption(string title) => new()
private ToastOption GetToastOption(string title)
{
Title = title,
Delay = Options.CurrentValue.ToastDelay
};
var option = new ToastOption()
{
Title = title,
};
if (Options.CurrentValue.ToastDelay > 0)
{
option.Delay = Options.CurrentValue.ToastDelay;
}
return option;
}

private Task ExportAsync() => ExecuteExportAsync(() => OnExportAsync != null
? OnExportAsync(new TableExportDataContext<TItem>(TableExportType.Unknown, Rows, GetVisibleColumns(), BuildQueryPageOptions()))
Expand Down
3 changes: 3 additions & 0 deletions test/UnitTest/Components/TableDialogTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using AngleSharp.Dom;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Options;
using System.Reflection;

namespace UnitTest.Components;
Expand All @@ -15,6 +16,8 @@ public class TableDialogTest : TableDialogTestBase
[Fact]
public async Task EditAsync_Ok()
{
var options = Context.Services.GetRequiredService<IOptionsMonitor<BootstrapBlazorOptions>>();
options.CurrentValue.ToastDelay = 0;
var localizer = Context.Services.GetRequiredService<IStringLocalizer<Foo>>();
var items = Foo.GenerateFoo(localizer, 2);
var cut = Context.RenderComponent<BootstrapBlazorRoot>(pb =>
Expand Down