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
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,14 @@ private AttributeItem[] GetAttributes() =>
Type = "string",
ValueList = " — ",
DefaultValue = " — "
},
new()
{
Name = nameof(Select<string>.ShowSwal),
Description = Localizer["SelectsShowSwal"],
Type = "bool",
ValueList = "true|false",
DefaultValue = "true"
}
];
}
3 changes: 2 additions & 1 deletion src/BootstrapBlazor.Server/Locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -3267,7 +3267,8 @@
"TextConvertToValueCallback": "Callback method when input text changes in edit mode",
"SelectsIsEditable": "Whether editable",
"SelectsIsVirtualize": "Wether to enable virtualize",
"SelectsDefaultVirtualizeItemText": "The text string corresponding to the first load value when virtual scrolling is turned on is separated by commas"
"SelectsDefaultVirtualizeItemText": "The text string corresponding to the first load value when virtual scrolling is turned on is separated by commas",
"SelectsShowSwal": "Whether show the swal confirm popup"
},
"BootstrapBlazor.Server.Components.Samples.Sliders": {
"SlidersTitle": "Slider",
Expand Down
3 changes: 2 additions & 1 deletion src/BootstrapBlazor.Server/Locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -3267,7 +3267,8 @@
"TextConvertToValueCallback": "编辑模式下输入文本变化时回调方法",
"SelectsIsEditable": "是否可编辑",
"SelectsIsVirtualize": "是否开启虚拟滚动",
"SelectsDefaultVirtualizeItemText": "开启虚拟滚动时首次加载 Value 对应的文本字符串用逗号分割"
"SelectsDefaultVirtualizeItemText": "开启虚拟滚动时首次加载 Value 对应的文本字符串用逗号分割",
"SelectsShowSwal": "是否显示 Swal 确认弹窗"
},
"BootstrapBlazor.Server.Components.Samples.Sliders": {
"SlidersTitle": "Slider 滑块",
Expand Down
2 changes: 1 addition & 1 deletion src/BootstrapBlazor/BootstrapBlazor.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<Version>9.6.4-beta02</Version>
<Version>9.6.4-beta03</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
13 changes: 8 additions & 5 deletions src/BootstrapBlazor/Components/Select/Select.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ public partial class Select<TValue> : ISelect, ILookup
[Parameter]
public Func<SelectedItem, Task<bool>>? OnBeforeSelectedItemChange { get; set; }

/// <summary>
/// Gets or sets whether to show the Swal confirmation popup when <see cref="OnBeforeSelectedItemChange"/> returns true. Default is true.
/// 获得/设置 是否显示 Swal 确认弹窗
/// </summary>
[Parameter]
public bool ShowSwal { get; set; } = true;

/// <summary>
/// Gets or sets the callback method when the selected item changes.
/// </summary>
Expand Down Expand Up @@ -338,7 +345,7 @@ private async Task OnClickItem(SelectedItem item)
if (OnBeforeSelectedItemChange != null)
{
ret = await OnBeforeSelectedItemChange(item);
if (ret)
if (ret && ShowSwal)
{
// Return true to show modal
var option = new SwalOption()
Expand All @@ -354,10 +361,6 @@ private async Task OnClickItem(SelectedItem item)
}
ret = await SwalService.ShowModal(option);
}
else
{
return;
}
}
if (ret)
{
Expand Down