From b588f2c53a8df45f0446b3d7a34e42678601e1af Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Thu, 22 Aug 2024 17:39:12 +0800 Subject: [PATCH 01/11] =?UTF-8?q?chore:=20=E5=A2=9E=E5=8A=A0=20new=20?= =?UTF-8?q?=E6=A0=87=E8=AF=86=E7=AC=A6=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Extensions/MenusLocalizerExtensions.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/BootstrapBlazor.Server/Extensions/MenusLocalizerExtensions.cs b/src/BootstrapBlazor.Server/Extensions/MenusLocalizerExtensions.cs index a0ba1065bed..edfb69cddca 100644 --- a/src/BootstrapBlazor.Server/Extensions/MenusLocalizerExtensions.cs +++ b/src/BootstrapBlazor.Server/Extensions/MenusLocalizerExtensions.cs @@ -1233,6 +1233,7 @@ void AddNotice(DemoMenuItem item) }, new() { + IsNew = true, Text = Localizer["WinBox"], Url = "win-box" } From 644fd6ff5004667ef848033d9cc932b26fd221f6 Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Thu, 22 Aug 2024 19:37:16 +0800 Subject: [PATCH 02/11] =?UTF-8?q?refactor:=20=E5=A2=9E=E5=8A=A0=E6=9A=97?= =?UTF-8?q?=E9=BB=91=E6=A8=A1=E5=BC=8F=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wwwroot/css/winbox.bundle.css | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Extensions/Components/BootstrapBlazor.WinBox/wwwroot/css/winbox.bundle.css b/src/Extensions/Components/BootstrapBlazor.WinBox/wwwroot/css/winbox.bundle.css index 5b886c42267..21e38ffec4e 100644 --- a/src/Extensions/Components/BootstrapBlazor.WinBox/wwwroot/css/winbox.bundle.css +++ b/src/Extensions/Components/BootstrapBlazor.WinBox/wwwroot/css/winbox.bundle.css @@ -1,6 +1,17 @@ @import url('./winbox.min.css'); .winbox { - --bb-winbox-bg: #0050ff; + --bb-winbox-body-padding: .5rem; + --bb-winbox-bg: #b5b5c3; + --bb-window-border-radius: var(--bs-border-radius) var(--bs-border-radius) 0 0; background: var(--bb-winbox-bg); + border-radius: var(--bb-window-border-radius); +} + + .winbox .bb-win-box-content { + padding: var(--bb-winbox-body-padding); + } + +[data-bs-theme='dark'] .winbox { + --bb-winbox-bg: #383b3f; } From 69b0b76009895f0105bfd238e881509dac1a482f Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Thu, 22 Aug 2024 19:37:30 +0800 Subject: [PATCH 03/11] =?UTF-8?q?refactor:=20=E5=A2=9E=E5=8A=A0=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Samples/WinBoxes.razor | 39 +++++++++++++++++++ .../Components/Samples/WinBoxes.razor.cs | 4 +- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/src/BootstrapBlazor.Server/Components/Samples/WinBoxes.razor b/src/BootstrapBlazor.Server/Components/Samples/WinBoxes.razor index 9742bcdf75f..5c1f9120bf0 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/WinBoxes.razor +++ b/src/BootstrapBlazor.Server/Components/Samples/WinBoxes.razor @@ -9,6 +9,21 @@

WinBox 组件封装的是 WinBox.js

+

组件使用介绍:

+ +

1. 引用包 BootstrapBlazor.WinBox

+ +

2. 注入服务

+
services.AddBootstrapBlazorWinBoxService();
+ +

3. 页面中使用服务

+
[Inject]
+[NotNull]
+private WinBoxService? WinBoxService { get; set; }
+ +

4. 调用弹窗

+
await WinBoxService.Show<Counter>("Test", option: option);
+ @@ -16,6 +31,30 @@ +

常见问题

+ + +

通过 WinBoxOption 参数 Background 设置

+
new WinBoxOption() { Background = "#000" }
+ +

通过 WinBoxOption 参数 Class 设置

+
new WinBoxOption() { Class = ".bb-win-box" }
+
.bb-win-box {
+    background: #000;
+}
+ +

通过样式变量实现

+
.winbox {
+    --bb-winbox-bg: var(--bb-primary-color) !important;
+}
+
+ + +

通过 WinBoxOption 参数 Border 设置

+
new WinBoxOption() { Border = 3 }
+
+ + diff --git a/src/BootstrapBlazor.Server/Components/Samples/WinBoxes.razor.cs b/src/BootstrapBlazor.Server/Components/Samples/WinBoxes.razor.cs index b9518225aff..f79b0025b46 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/WinBoxes.razor.cs +++ b/src/BootstrapBlazor.Server/Components/Samples/WinBoxes.razor.cs @@ -17,7 +17,9 @@ public partial class WinBoxes private static WinBoxOption DefaultOptions => new() { Top = "50px", - Left = "50px" + Class = "bb-win-box", + Border = 2, + Background = "var(--bb-primary-color)" }; private async Task OpenWinBox() From 0439d145245513d4d028cb5540e71bde55e7ae4c Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Thu, 22 Aug 2024 20:01:39 +0800 Subject: [PATCH 04/11] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=20IRootCompone?= =?UTF-8?q?ntGenerator=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BaseComponents/BootstrapBlazorRoot.razor | 5 +++++ .../BaseComponents/BootstrapBlazorRoot.razor.cs | 3 +++ .../Services/IRootComponentGenerator.cs | 17 +++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 src/BootstrapBlazor/Services/IRootComponentGenerator.cs diff --git a/src/BootstrapBlazor/Components/BaseComponents/BootstrapBlazorRoot.razor b/src/BootstrapBlazor/Components/BaseComponents/BootstrapBlazorRoot.razor index 8ebdfdac9db..71240638706 100644 --- a/src/BootstrapBlazor/Components/BaseComponents/BootstrapBlazorRoot.razor +++ b/src/BootstrapBlazor/Components/BaseComponents/BootstrapBlazorRoot.razor @@ -17,6 +17,11 @@ +@foreach(var com in Generators) +{ + @com.Generator() +} + @code { RenderFragment RenderChildContent => @ diff --git a/src/BootstrapBlazor/Components/BaseComponents/BootstrapBlazorRoot.razor.cs b/src/BootstrapBlazor/Components/BaseComponents/BootstrapBlazorRoot.razor.cs index 90f919f8f57..7aff0546775 100644 --- a/src/BootstrapBlazor/Components/BaseComponents/BootstrapBlazorRoot.razor.cs +++ b/src/BootstrapBlazor/Components/BaseComponents/BootstrapBlazorRoot.razor.cs @@ -19,6 +19,9 @@ public partial class BootstrapBlazorRoot [NotNull] private IOptionsMonitor? Options { get; set; } + [Inject, NotNull] + private IEnumerable? Generators { get; set; } + /// /// 获得/设置 子组件 /// diff --git a/src/BootstrapBlazor/Services/IRootComponentGenerator.cs b/src/BootstrapBlazor/Services/IRootComponentGenerator.cs new file mode 100644 index 00000000000..4fe99966aa9 --- /dev/null +++ b/src/BootstrapBlazor/Services/IRootComponentGenerator.cs @@ -0,0 +1,17 @@ +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Website: https://www.blazor.zone or https://argozhang.github.io/ + +namespace BootstrapBlazor.Components; + +/// +/// 根组件接口 +/// +public interface IRootComponentGenerator +{ + /// + /// 生成组件方法 + /// + /// + RenderFragment Generator(); +} From c6d626d4e47b43c7b3a31cd44aa2af4c8010fc2c Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Thu, 22 Aug 2024 20:02:00 +0800 Subject: [PATCH 05/11] =?UTF-8?q?doc:=20=E6=9B=B4=E6=96=B0=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj | 3 ++- .../Components/Samples/WinBoxes.razor | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj b/src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj index 02bdb28a5d0..1cba3876209 100644 --- a/src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj +++ b/src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj @@ -69,7 +69,7 @@ - + @@ -78,6 +78,7 @@ + diff --git a/src/BootstrapBlazor.Server/Components/Samples/WinBoxes.razor b/src/BootstrapBlazor.Server/Components/Samples/WinBoxes.razor index 5c1f9120bf0..125aa830a91 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/WinBoxes.razor +++ b/src/BootstrapBlazor.Server/Components/Samples/WinBoxes.razor @@ -54,7 +54,11 @@ private WinBoxService? WinBoxService { get; set; }
new WinBoxOption() { Border = 3 }
+ +

通过 WinBoxOption 参数 Modal 设置

+
new WinBoxOption() { Modal = true }
+
- +

更多参数信息可参考 WinBoxOption 注释

From baf88a25fad719f486965a4f5de497bd15ee7801 Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Thu, 22 Aug 2024 20:02:52 +0800 Subject: [PATCH 06/11] =?UTF-8?q?refactor:=20=E5=A2=9E=E5=8A=A0=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E7=94=9F=E6=88=90=E6=A0=B9=E8=8A=82=E7=82=B9=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BootstrapBlazor.WinBox.csproj | 6 +++++- .../Extensions/ComponentGenerator.cs | 12 ++++++++++++ .../Extensions/ServiceCollectionExtensions.cs | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 src/Extensions/Components/BootstrapBlazor.WinBox/Extensions/ComponentGenerator.cs diff --git a/src/Extensions/Components/BootstrapBlazor.WinBox/BootstrapBlazor.WinBox.csproj b/src/Extensions/Components/BootstrapBlazor.WinBox/BootstrapBlazor.WinBox.csproj index eba3965b489..1ca869a45ff 100644 --- a/src/Extensions/Components/BootstrapBlazor.WinBox/BootstrapBlazor.WinBox.csproj +++ b/src/Extensions/Components/BootstrapBlazor.WinBox/BootstrapBlazor.WinBox.csproj @@ -10,7 +10,11 @@ - + + + + + diff --git a/src/Extensions/Components/BootstrapBlazor.WinBox/Extensions/ComponentGenerator.cs b/src/Extensions/Components/BootstrapBlazor.WinBox/Extensions/ComponentGenerator.cs new file mode 100644 index 00000000000..2df9730d3ce --- /dev/null +++ b/src/Extensions/Components/BootstrapBlazor.WinBox/Extensions/ComponentGenerator.cs @@ -0,0 +1,12 @@ +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Website: https://www.blazor.zone or https://argozhang.github.io/ + +using Microsoft.AspNetCore.Components; + +namespace BootstrapBlazor.Components; + +class ComponentGenerator : IRootComponentGenerator +{ + public RenderFragment Generator() => BootstrapDynamicComponent.CreateComponent().Render(); +} diff --git a/src/Extensions/Components/BootstrapBlazor.WinBox/Extensions/ServiceCollectionExtensions.cs b/src/Extensions/Components/BootstrapBlazor.WinBox/Extensions/ServiceCollectionExtensions.cs index df222ff89da..5314fd6636a 100644 --- a/src/Extensions/Components/BootstrapBlazor.WinBox/Extensions/ServiceCollectionExtensions.cs +++ b/src/Extensions/Components/BootstrapBlazor.WinBox/Extensions/ServiceCollectionExtensions.cs @@ -19,6 +19,7 @@ public static class ServiceCollectionExtensions public static IServiceCollection AddBootstrapBlazorWinBoxService(this IServiceCollection services) { services.AddScoped(); + services.AddScoped(); return services; } } From 3a4e56cb1f0efd1af31e586bd03e4c5d1960342f Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Thu, 22 Aug 2024 20:12:43 +0800 Subject: [PATCH 07/11] chore: bump version 8.0.0-beta03 --- .../BootstrapBlazor.WinBox/BootstrapBlazor.WinBox.csproj | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Extensions/Components/BootstrapBlazor.WinBox/BootstrapBlazor.WinBox.csproj b/src/Extensions/Components/BootstrapBlazor.WinBox/BootstrapBlazor.WinBox.csproj index 1ca869a45ff..5c5534b73a9 100644 --- a/src/Extensions/Components/BootstrapBlazor.WinBox/BootstrapBlazor.WinBox.csproj +++ b/src/Extensions/Components/BootstrapBlazor.WinBox/BootstrapBlazor.WinBox.csproj @@ -1,7 +1,7 @@ - 8.0.0-beta02 + 8.0.0-beta03 @@ -10,11 +10,7 @@ - - - - - + From 0f95014045411aa0d9399d2ac3f2ce62c83c2ae8 Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Thu, 22 Aug 2024 20:13:21 +0800 Subject: [PATCH 08/11] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj b/src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj index 1cba3876209..2882e41c0a2 100644 --- a/src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj +++ b/src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj @@ -69,7 +69,7 @@ - + @@ -78,7 +78,6 @@ - From 11d78b4de1b5650aceb541de660bbbff6b8d3df4 Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Thu, 22 Aug 2024 20:18:19 +0800 Subject: [PATCH 09/11] =?UTF-8?q?doc:=20=E6=9B=B4=E6=96=B0=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor.Server/Components/Samples/WinBoxes.razor | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BootstrapBlazor.Server/Components/Samples/WinBoxes.razor b/src/BootstrapBlazor.Server/Components/Samples/WinBoxes.razor index 125aa830a91..733ca032cd2 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/WinBoxes.razor +++ b/src/BootstrapBlazor.Server/Components/Samples/WinBoxes.razor @@ -27,7 +27,7 @@ private WinBoxService? WinBoxService { get; set; } - + @@ -59,6 +59,6 @@ private WinBoxService? WinBoxService { get; set; }
new WinBoxOption() { Modal = true }
-

更多参数信息可参考 WinBoxOption 注释

+

更多参数信息可参考 WinBoxOption 注释

From 77dba1751ed91cc9de5a86f82cc8cee48763f906 Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Thu, 22 Aug 2024 20:21:41 +0800 Subject: [PATCH 10/11] =?UTF-8?q?doc:=20=E6=9B=B4=E6=96=B0=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor.Server/Components/Samples/WinBoxes.razor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BootstrapBlazor.Server/Components/Samples/WinBoxes.razor b/src/BootstrapBlazor.Server/Components/Samples/WinBoxes.razor index 733ca032cd2..8fbf249dc97 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/WinBoxes.razor +++ b/src/BootstrapBlazor.Server/Components/Samples/WinBoxes.razor @@ -59,6 +59,6 @@ private WinBoxService? WinBoxService { get; set; }
new WinBoxOption() { Modal = true }
-

更多参数信息可参考 WinBoxOption 注释

+

更多参数信息可参考 WinBoxOption 注释

From e923e9c85dff8ebf04fbb0f2b3a832a082c62c56 Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Thu, 22 Aug 2024 20:29:35 +0800 Subject: [PATCH 11/11] =?UTF-8?q?chore:=20=E6=A0=BC=E5=BC=8F=E5=8C=96?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj b/src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj index 2882e41c0a2..8bb7f4303a1 100644 --- a/src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj +++ b/src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj @@ -18,9 +18,6 @@ -
- -