diff --git a/src/BootstrapBlazor.Server/Components/Samples/Selects.razor.cs b/src/BootstrapBlazor.Server/Components/Samples/Selects.razor.cs index 342b2117f46..f45e5a3ca00 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/Selects.razor.cs +++ b/src/BootstrapBlazor.Server/Components/Samples/Selects.razor.cs @@ -439,6 +439,14 @@ private AttributeItem[] GetAttributes() => Type = "string", ValueList = " — ", DefaultValue = " — " + }, + new() + { + Name = nameof(Select.ShowSwal), + Description = Localizer["SelectsShowSwal"], + Type = "bool", + ValueList = "true|false", + DefaultValue = "true" } ]; } diff --git a/src/BootstrapBlazor.Server/Locales/en-US.json b/src/BootstrapBlazor.Server/Locales/en-US.json index 176c29f09f3..01317eb2370 100644 --- a/src/BootstrapBlazor.Server/Locales/en-US.json +++ b/src/BootstrapBlazor.Server/Locales/en-US.json @@ -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", diff --git a/src/BootstrapBlazor.Server/Locales/zh-CN.json b/src/BootstrapBlazor.Server/Locales/zh-CN.json index 558af50f46e..591ef6a922d 100644 --- a/src/BootstrapBlazor.Server/Locales/zh-CN.json +++ b/src/BootstrapBlazor.Server/Locales/zh-CN.json @@ -3267,7 +3267,8 @@ "TextConvertToValueCallback": "编辑模式下输入文本变化时回调方法", "SelectsIsEditable": "是否可编辑", "SelectsIsVirtualize": "是否开启虚拟滚动", - "SelectsDefaultVirtualizeItemText": "开启虚拟滚动时首次加载 Value 对应的文本字符串用逗号分割" + "SelectsDefaultVirtualizeItemText": "开启虚拟滚动时首次加载 Value 对应的文本字符串用逗号分割", + "SelectsShowSwal": "是否显示 Swal 确认弹窗" }, "BootstrapBlazor.Server.Components.Samples.Sliders": { "SlidersTitle": "Slider 滑块", diff --git a/src/BootstrapBlazor/BootstrapBlazor.csproj b/src/BootstrapBlazor/BootstrapBlazor.csproj index 55dd1b31955..96e37f33b79 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@  - 9.6.4-beta02 + 9.6.4-beta03 diff --git a/src/BootstrapBlazor/Components/Select/Select.razor.cs b/src/BootstrapBlazor/Components/Select/Select.razor.cs index 04e29e2cd4e..5144a13b7ca 100644 --- a/src/BootstrapBlazor/Components/Select/Select.razor.cs +++ b/src/BootstrapBlazor/Components/Select/Select.razor.cs @@ -57,6 +57,13 @@ public partial class Select : ISelect, ILookup [Parameter] public Func>? OnBeforeSelectedItemChange { get; set; } + /// + /// Gets or sets whether to show the Swal confirmation popup when returns true. Default is true. + /// 获得/设置 是否显示 Swal 确认弹窗 + /// + [Parameter] + public bool ShowSwal { get; set; } = true; + /// /// Gets or sets the callback method when the selected item changes. /// @@ -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() @@ -354,10 +361,6 @@ private async Task OnClickItem(SelectedItem item) } ret = await SwalService.ShowModal(option); } - else - { - return; - } } if (ret) {