diff --git a/src/BootstrapBlazor.Shared/Samples/DateTimePickers.razor b/src/BootstrapBlazor.Shared/Samples/DateTimePickers.razor
index 2518d41d2248e9bd39785ae5b761c7901562cfe3..8bee2a2c7327f90067936204e8ec138753264511 100644
--- a/src/BootstrapBlazor.Shared/Samples/DateTimePickers.razor
+++ b/src/BootstrapBlazor.Shared/Samples/DateTimePickers.razor
@@ -72,16 +72,16 @@
@((MarkupString)Localizer["P1"].Value)
diff --git a/src/BootstrapBlazor/BootstrapBlazor.csproj b/src/BootstrapBlazor/BootstrapBlazor.csproj
index a89f4ee8a749eaa313c8365206a12d8f8c42b30b..b2a0fc5141265c0fbfbbbfd8daf4701e45c7a762 100644
--- a/src/BootstrapBlazor/BootstrapBlazor.csproj
+++ b/src/BootstrapBlazor/BootstrapBlazor.csproj
@@ -1,7 +1,7 @@
- 6.9.8
+ 6.9.9
diff --git a/src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.cs b/src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.cs
index bc18d031aeb3e91d8d85f1f0467b8dbc1adedc1f..65c54f917c579ad87aa2a708fb838906d6cb974e 100644
--- a/src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.cs
+++ b/src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.cs
@@ -154,11 +154,7 @@ public partial class AutoComplete
// 汉字多次触发问题
if (ValidateForm != null)
{
- if (Interop == null)
- {
- Interop = new JSInterop(JSRuntime);
- }
-
+ Interop ??= new JSInterop(JSRuntime);
await Interop.InvokeVoidAsync(this, FocusElement, "bb_composition", nameof(TriggerOnChange));
}
diff --git a/src/BootstrapBlazor/Components/DateTimePicker/DatePickerBody.razor.cs b/src/BootstrapBlazor/Components/DateTimePicker/DatePickerBody.razor.cs
index 910cd597328da0256a887e175f75cbaefd181257..401cdb00f7b07fe6b06fd20dd05c26001c430d64 100644
--- a/src/BootstrapBlazor/Components/DateTimePicker/DatePickerBody.razor.cs
+++ b/src/BootstrapBlazor/Components/DateTimePicker/DatePickerBody.razor.cs
@@ -469,7 +469,7 @@ public sealed partial class DatePickerBody
{
await OnClickDateTime(d);
- if (ShowFooter)
+ if (ShowFooter || AutoClose)
{
await ClickConfirmButton();
}
@@ -479,15 +479,21 @@ public sealed partial class DatePickerBody
/// 设置组件显示视图方法
///
///
- private Task SwitchView(DatePickerViewMode view)
+ private async Task SwitchView(DatePickerViewMode view)
{
ShowTimePicker = false;
if (AllowSwitchModes[ViewMode].Contains(view))
{
CurrentViewMode = view;
}
- StateHasChanged();
- return Task.CompletedTask;
+ if (AutoClose)
+ {
+ await ClickConfirmButton();
+ }
+ else
+ {
+ StateHasChanged();
+ }
}
///
@@ -495,10 +501,10 @@ public sealed partial class DatePickerBody
///
///
///
- private void SwitchView(DatePickerViewMode view, DateTime d)
+ private async Task SwitchView(DatePickerViewMode view, DateTime d)
{
CurrentDate = d;
- SwitchView(view);
+ await SwitchView(view);
}
///
diff --git a/src/BootstrapBlazor/Components/DateTimePicker/DatePickerCell.razor.cs b/src/BootstrapBlazor/Components/DateTimePicker/DatePickerCell.razor.cs
index 85f79386b9cc1a812bfe8e6439aaf2fa1e0d96a9..ad0e6e7ffd36e206d1bb1725162c718d76689347 100644
--- a/src/BootstrapBlazor/Components/DateTimePicker/DatePickerCell.razor.cs
+++ b/src/BootstrapBlazor/Components/DateTimePicker/DatePickerCell.razor.cs
@@ -27,5 +27,5 @@ public sealed partial class DatePickerCell
///
[Parameter]
[NotNull]
- public Action? OnClick { get; set; }
+ public Func? OnClick { get; set; }
}
diff --git a/src/BootstrapBlazor/Components/Modal/ModalDialog.razor.cs b/src/BootstrapBlazor/Components/Modal/ModalDialog.razor.cs
index f0c67b75c590f2b6a846aad3c637efa9955b2c15..064a937829f9fcfc148142ba56b8babba5eb5cde 100644
--- a/src/BootstrapBlazor/Components/Modal/ModalDialog.razor.cs
+++ b/src/BootstrapBlazor/Components/Modal/ModalDialog.razor.cs
@@ -201,18 +201,23 @@ public partial class ModalDialog : IDisposable
{
base.OnInitialized();
- if (OnClose == null)
- {
- OnClose = async () => await Modal.CloseOrPopDialog();
- }
+ Interop = new JSInterop(JSRuntime);
+
+ Modal.AddDialog(this);
+ }
+
+ ///
+ /// OnParametersSet 方法
+ ///
+ protected override void OnParametersSet()
+ {
+ base.OnParametersSet();
CloseButtonText ??= Localizer[nameof(CloseButtonText)];
SaveButtonText ??= Localizer[nameof(SaveButtonText)];
PrintButtonText ??= Localizer[nameof(PrintButtonText)];
- Interop = new JSInterop(JSRuntime);
-
- Modal.AddDialog(this);
+ OnClose ??= async () => await Modal.CloseOrPopDialog();
}
///