From a04a8142d63f44aee34526014171d7b3311f8f59 Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Wed, 24 Aug 2022 12:28:26 +0800 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20AutoClose=20=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=89=80=E6=9C=89=20ViewMode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DateTimePicker/DatePickerBody.razor.cs | 18 ++++++++++++------ .../DateTimePicker/DatePickerCell.razor.cs | 2 +- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/BootstrapBlazor/Components/DateTimePicker/DatePickerBody.razor.cs b/src/BootstrapBlazor/Components/DateTimePicker/DatePickerBody.razor.cs index 910cd5973..401cdb00f 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 85f79386b..ad0e6e7ff 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; } } -- Gitee From b268e34052f8d73cbfd1db6c2664b00bf6a5e9f2 Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Wed, 24 Aug 2022 12:28:35 +0800 Subject: [PATCH 2/4] =?UTF-8?q?doc:=20=E6=9B=B4=E6=96=B0=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor.Shared/Samples/DateTimePickers.razor | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/BootstrapBlazor.Shared/Samples/DateTimePickers.razor b/src/BootstrapBlazor.Shared/Samples/DateTimePickers.razor index 2518d41d2..8bee2a2c7 100644 --- a/src/BootstrapBlazor.Shared/Samples/DateTimePickers.razor +++ b/src/BootstrapBlazor.Shared/Samples/DateTimePickers.razor @@ -72,16 +72,16 @@

@((MarkupString)Localizer["P1"].Value)

- +
- +
- +
- +
-- Gitee From 5b0a1403eb7a35dd4cff9ef253a8bbecb130b787 Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Wed, 24 Aug 2022 12:30:56 +0800 Subject: [PATCH 3/4] =?UTF-8?q?refactor:=20=E6=A0=BC=E5=BC=8F=E5=8C=96?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=B6=88=E9=99=A4=E6=8F=90=E7=A4=BA=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoComplete/AutoComplete.razor.cs | 6 +----- .../Components/Modal/ModalDialog.razor.cs | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.cs b/src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.cs index bc18d031a..65c54f917 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/Modal/ModalDialog.razor.cs b/src/BootstrapBlazor/Components/Modal/ModalDialog.razor.cs index f0c67b75c..064a93782 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(); } /// -- Gitee From 6c40005c7cbb67e6de3701ff252270bf5fcdd47e Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Wed, 24 Aug 2022 12:32:47 +0800 Subject: [PATCH 4/4] chore: bump version 6.9.9 --- src/BootstrapBlazor/BootstrapBlazor.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/BootstrapBlazor.csproj b/src/BootstrapBlazor/BootstrapBlazor.csproj index a89f4ee8a..b2a0fc514 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@ - 6.9.8 + 6.9.9 -- Gitee