From 369f2b9a120ebca716a188ac9ce9a340c5c579b9 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Thu, 13 Mar 2025 12:29:04 +0800 Subject: [PATCH 1/6] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=20ModalSetings?= =?UTF-8?q?=20=E9=85=8D=E7=BD=AE=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Options/BootstrapBlazorOptions.cs | 5 +++++ src/BootstrapBlazor/Options/ModalSettings.cs | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/BootstrapBlazor/Options/ModalSettings.cs diff --git a/src/BootstrapBlazor/Options/BootstrapBlazorOptions.cs b/src/BootstrapBlazor/Options/BootstrapBlazorOptions.cs index 5e736586aa4..fff8dee334e 100644 --- a/src/BootstrapBlazor/Options/BootstrapBlazorOptions.cs +++ b/src/BootstrapBlazor/Options/BootstrapBlazorOptions.cs @@ -90,6 +90,11 @@ public class BootstrapBlazorOptions : IOptions /// public TableSettings TableSettings { get; set; } = new(); + /// + /// Gets or sets the configuration instance + /// + public ModalSettings ModalSettings { get; set; } = new(); + /// /// Gets or sets the configuration instance /// diff --git a/src/BootstrapBlazor/Options/ModalSettings.cs b/src/BootstrapBlazor/Options/ModalSettings.cs new file mode 100644 index 00000000000..7666b45f79a --- /dev/null +++ b/src/BootstrapBlazor/Options/ModalSettings.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the Apache 2.0 License +// See the LICENSE file in the project root for more information. +// Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone + +namespace BootstrapBlazor.Components; + +/// +/// Modal component settings +/// +public class ModalSettings +{ + /// + /// Gets or sets whether to enable fade animation, default is null + /// + public bool? IsFade { get; set; } +} From 5a9eb8544407ea97e18ff6ab4a241b6dad76e590 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Thu, 13 Mar 2025 12:29:12 +0800 Subject: [PATCH 2/6] =?UTF-8?q?doc:=20=E6=9B=B4=E6=96=B0=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Options/BootstrapBlazorOptions.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/BootstrapBlazor/Options/BootstrapBlazorOptions.cs b/src/BootstrapBlazor/Options/BootstrapBlazorOptions.cs index fff8dee334e..9983d3491f2 100644 --- a/src/BootstrapBlazor/Options/BootstrapBlazorOptions.cs +++ b/src/BootstrapBlazor/Options/BootstrapBlazorOptions.cs @@ -86,7 +86,7 @@ public class BootstrapBlazorOptions : IOptions public string? JSModuleVersion { get; set; } /// - /// Gets or sets the table settings instance + /// Gets or sets the configuration instance /// public TableSettings TableSettings { get; set; } = new(); @@ -101,32 +101,32 @@ public class BootstrapBlazorOptions : IOptions public StepSettings StepSettings { get; set; } = new(); /// - /// Gets or sets the configuration, default is not null + /// Gets or sets the configuration /// public ConnectionHubOptions ConnectionHubOptions { get; set; } = new(); /// - /// Gets or sets the configuration, default is not null + /// Gets or sets the configuration /// public WebClientOptions WebClientOptions { get; set; } = new(); /// - /// Gets or sets the configuration, default is not null + /// Gets or sets the configuration /// public IpLocatorOptions IpLocatorOptions { get; set; } = new(); /// - /// Gets or sets the configuration, default is not null + /// Gets or sets the configuration /// public ScrollOptions ScrollOptions { get; set; } = new(); /// - /// Gets or sets the configuration, default is not null + /// Gets or sets the configuration /// public ContextMenuOptions ContextMenuOptions { get; set; } = new(); /// - /// Gets or sets the CacheManagerOptions configuration, default is not null + /// Gets or sets the CacheManagerOptions configuration /// public CacheManagerOptions CacheManagerOptions { get; set; } = new(); From 99bf6ce6d6084f5373521329515d03e2172c48ea Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Thu, 13 Mar 2025 12:43:34 +0800 Subject: [PATCH 3/6] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=20IsFade=20?= =?UTF-8?q?=E5=8F=96=E5=80=BC=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Dialog/Dialog.razor.cs | 2 +- .../Components/Dialog/DialogOption.cs | 4 +-- .../Components/Modal/Modal.razor.cs | 10 ++++--- .../BootstrapBlazorOptionsExtensions.cs | 26 ++++++++++++------- 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/src/BootstrapBlazor/Components/Dialog/Dialog.razor.cs b/src/BootstrapBlazor/Components/Dialog/Dialog.razor.cs index 434b85e1942..aa19153d6ce 100644 --- a/src/BootstrapBlazor/Components/Dialog/Dialog.razor.cs +++ b/src/BootstrapBlazor/Components/Dialog/Dialog.razor.cs @@ -27,7 +27,7 @@ public partial class Dialog : IDisposable private Dictionary? _currentParameter; private bool _isKeyboard = false; private bool _isBackdrop = false; - private bool _isFade = true; + private bool? _isFade = null; /// /// diff --git a/src/BootstrapBlazor/Components/Dialog/DialogOption.cs b/src/BootstrapBlazor/Components/Dialog/DialogOption.cs index 3ebbc45547d..ac271149044 100644 --- a/src/BootstrapBlazor/Components/Dialog/DialogOption.cs +++ b/src/BootstrapBlazor/Components/Dialog/DialogOption.cs @@ -68,9 +68,9 @@ public class DialogOption public bool ShowHeaderCloseButton { get; set; } = true; /// - /// Gets or sets whether to enable fade animation, default is true + /// Gets or sets whether to enable fade animation, default is null /// - public bool IsFade { get; set; } = true; + public bool? IsFade { get; set; } /// /// Gets or sets whether to support closing the dialog with the ESC key, default is true diff --git a/src/BootstrapBlazor/Components/Modal/Modal.razor.cs b/src/BootstrapBlazor/Components/Modal/Modal.razor.cs index c19ecb9adf1..ddd35097035 100644 --- a/src/BootstrapBlazor/Components/Modal/Modal.razor.cs +++ b/src/BootstrapBlazor/Components/Modal/Modal.razor.cs @@ -12,11 +12,15 @@ namespace BootstrapBlazor.Components; /// public partial class Modal { + [Inject] + [NotNull] + private IOptionsMonitor? Options { get; set; } + /// /// Gets the style string /// private string? ClassString => CssBuilder.Default("modal") - .AddClass("fade", IsFade) + .AddClass("fade", Options.CurrentValue.GetIsFadeValue(IsFade)) .AddClassFromAttributes(AdditionalAttributes) .Build(); @@ -40,10 +44,10 @@ public partial class Modal public bool IsKeyboard { get; set; } = true; /// - /// Gets or sets whether to enable fade in and out animation, default is true to enable animation + /// Gets or sets whether to enable fade in and out animation, default is null /// [Parameter] - public bool IsFade { get; set; } = true; + public bool? IsFade { get; set; } /// /// Gets or sets the child component diff --git a/src/BootstrapBlazor/Extensions/BootstrapBlazorOptionsExtensions.cs b/src/BootstrapBlazor/Extensions/BootstrapBlazorOptionsExtensions.cs index b6548811774..4008e7fb6b9 100644 --- a/src/BootstrapBlazor/Extensions/BootstrapBlazorOptionsExtensions.cs +++ b/src/BootstrapBlazor/Extensions/BootstrapBlazorOptionsExtensions.cs @@ -6,27 +6,35 @@ namespace BootstrapBlazor.Components; /// -/// BootstrapBlazorOptions 配置类扩展方法 +/// BootstrapBlazorOptions configuration class extension methods /// public static class BootstrapBlazorOptionsExtensions { /// - /// 获取步长泛型方法 + /// Get step size generic method /// - /// - /// - /// + /// The type parameter + /// The BootstrapBlazorOptions instance + /// The step size as a string public static string? GetStep(this BootstrapBlazorOptions options) => options.GetStep(typeof(TType)); /// - /// 获取步长方法 + /// Get step size method /// - /// 配置实体类实例 - /// 数据类型 - /// + /// The BootstrapBlazorOptions instance + /// The data type + /// The step size as a string public static string? GetStep(this BootstrapBlazorOptions options, Type type) { var t = Nullable.GetUnderlyingType(type) ?? type; return options.StepSettings.GetStep(t); } + + /// + /// Get Modal IsFade value + /// + /// The BootstrapBlazorOptions instance + /// The default value + /// The IsFade value as a boolean + public static bool GetIsFadeValue(this BootstrapBlazorOptions options, bool? value) => options.ModalSettings.IsFade ?? value ?? true; } From 5f6e7f995f8d9f62cdbc91510376616f4f3c0704 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Thu, 13 Mar 2025 12:49:19 +0800 Subject: [PATCH 4/6] =?UTF-8?q?refactor:=20=E5=A2=9E=E5=8A=A0=20IsFade=20?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Components/SweetAlert/SweetAlert.razor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/Components/SweetAlert/SweetAlert.razor b/src/BootstrapBlazor/Components/SweetAlert/SweetAlert.razor index 38432bdfc31..0951f3b3167 100644 --- a/src/BootstrapBlazor/Components/SweetAlert/SweetAlert.razor +++ b/src/BootstrapBlazor/Components/SweetAlert/SweetAlert.razor @@ -2,6 +2,6 @@ @inherits BootstrapComponentBase @inject SwalService Swal - + @RenderDialog() From 3671d7fe4fb8f615e6f7b00e57db2f30ddfdea36 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Thu, 13 Mar 2025 12:49:34 +0800 Subject: [PATCH 5/6] =?UTF-8?q?refactor:=20=E6=9B=B4=E6=96=B0=20IsFade=20?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Extensions/BootstrapBlazorOptionsExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/Extensions/BootstrapBlazorOptionsExtensions.cs b/src/BootstrapBlazor/Extensions/BootstrapBlazorOptionsExtensions.cs index 4008e7fb6b9..802e9606ba9 100644 --- a/src/BootstrapBlazor/Extensions/BootstrapBlazorOptionsExtensions.cs +++ b/src/BootstrapBlazor/Extensions/BootstrapBlazorOptionsExtensions.cs @@ -36,5 +36,5 @@ public static class BootstrapBlazorOptionsExtensions /// The BootstrapBlazorOptions instance /// The default value /// The IsFade value as a boolean - public static bool GetIsFadeValue(this BootstrapBlazorOptions options, bool? value) => options.ModalSettings.IsFade ?? value ?? true; + public static bool GetIsFadeValue(this BootstrapBlazorOptions options, bool? value) => value ?? options.ModalSettings.IsFade ?? true; } From c48511ab11fcecc7c8995ae48805b7df102a0de9 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Thu, 13 Mar 2025 12:51:05 +0800 Subject: [PATCH 6/6] chore: bump version 9.4.9-beta06 --- 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 0b000d5cc42..a8ebde4532f 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@  - 9.4.9-beta05 + 9.4.9-beta06