From e3b7bc1a79fc2911a76deb5d6213ed3567f1319e Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Thu, 26 Dec 2024 16:02:03 +0800 Subject: [PATCH 1/6] chore: bump version 9.1.9-beat11 Co-Authored-By: vickyhcq <16112316+vickyhcq@users.noreply.github.com> --- 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 66397a672d5..73e9fcb74cb 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@ - 8.8.4 + 9.1.9-beta11 From 0f2656ddfa1b471b7a06577daa0f3148442fa5e0 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Thu, 26 Dec 2024 16:02:56 +0800 Subject: [PATCH 2/6] =?UTF-8?q?doc:=20=E6=9B=B4=E6=96=B0=E7=A4=BA=E4=BE=8B?= =?UTF-8?q?=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Samples/ExportPdfButtons.razor | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/BootstrapBlazor.Server/Components/Samples/ExportPdfButtons.razor b/src/BootstrapBlazor.Server/Components/Samples/ExportPdfButtons.razor index 965345913f9..315124c4b54 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/ExportPdfButtons.razor +++ b/src/BootstrapBlazor.Server/Components/Samples/ExportPdfButtons.razor @@ -25,13 +25,20 @@
- - - - - - - +
+
+ +
+
+ +
+
+ +
+
+ +
+
From 7ffb16cd71707120b9d4b51edb9b8acc836c9364 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Thu, 26 Dec 2024 16:24:04 +0800 Subject: [PATCH 3/6] =?UTF-8?q?refactor:=20=E7=A7=BB=E9=99=A4=E5=86=85?= =?UTF-8?q?=E7=BD=AE=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Button/ExportPdfButton.cs | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/BootstrapBlazor/Components/Button/ExportPdfButton.cs b/src/BootstrapBlazor/Components/Button/ExportPdfButton.cs index a858e550158..dff9753a0e9 100644 --- a/src/BootstrapBlazor/Components/Button/ExportPdfButton.cs +++ b/src/BootstrapBlazor/Components/Button/ExportPdfButton.cs @@ -67,9 +67,6 @@ public class ExportPdfButton : Button [Inject, NotNull] private IHtml2Pdf? Html2PdfService { get; set; } - [Inject, NotNull] - private NavigationManager? NavigationManager { get; set; } - [Inject, NotNull] private DownloadService? DownloadService { get; set; } @@ -117,21 +114,8 @@ protected override async Task HandlerClick() """; - // 增加网页所需样式表文件 - List styles = [ - $"{NavigationManager.BaseUri}_content/BootstrapBlazor.FontAwesome/css/font-awesome.min.css", - $"{NavigationManager.BaseUri}_content/BootstrapBlazor/css/bootstrap.blazor.bundle.min.css" - ]; - if (StyleTags != null) - { - styles.AddRange(StyleTags); - } - - // 增加网页所需脚本文件 - var scripts = ScriptTags ?? []; - // 生成 Pdf 流 - using var stream = await Html2PdfService.PdfStreamFromHtmlAsync(htmlString, styles, scripts); + using var stream = await Html2PdfService.PdfStreamFromHtmlAsync(htmlString, StyleTags, ScriptTags); if (OnBeforeDownload != null) { From a719fcfb80e640da717c75a8e265f9c8f5f41418 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Thu, 26 Dec 2024 16:24:25 +0800 Subject: [PATCH 4/6] =?UTF-8?q?doc:=20=E5=A2=9E=E5=8A=A0=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Samples/ExportPdfButtons.razor | 4 ++-- .../Components/Samples/ExportPdfButtons.razor.cs | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/BootstrapBlazor.Server/Components/Samples/ExportPdfButtons.razor b/src/BootstrapBlazor.Server/Components/Samples/ExportPdfButtons.razor index 315124c4b54..de0fbc3a763 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/ExportPdfButtons.razor +++ b/src/BootstrapBlazor.Server/Components/Samples/ExportPdfButtons.razor @@ -19,7 +19,7 @@ - +
@@ -41,7 +41,7 @@ - + diff --git a/src/BootstrapBlazor.Server/Components/Samples/ExportPdfButtons.razor.cs b/src/BootstrapBlazor.Server/Components/Samples/ExportPdfButtons.razor.cs index fbad4619f87..1ba738a127d 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/ExportPdfButtons.razor.cs +++ b/src/BootstrapBlazor.Server/Components/Samples/ExportPdfButtons.razor.cs @@ -32,12 +32,17 @@ public partial class ExportPdfButtons [NotNull] private ToastService? ToastService { get; set; } + [Inject, NotNull] + private NavigationManager? NavigationManager { get; set; } + private Task OnBeforeExport() => ToastService.Information(Localizer["ToastTitle"], Localizer["ToastContent"]); private static string PdfFileName => $"Pdf-{DateTime.Now:HHmmss}.pdf"; private Task OnAfterDownload(string fileName) => ToastService.Success(Localizer["ToastDownloadTitle"], Localizer["ToastDownloadContent", fileName]); + private List _styleTags = []; + /// /// /// @@ -46,6 +51,11 @@ protected override void OnInitialized() Items = Foo.GenerateFoo(FooLocalizer); Hobbies = Foo.GenerateHobbies(FooLocalizer); Model = Foo.Generate(FooLocalizer); + + _styleTags.AddRange([ + $"{NavigationManager.BaseUri}_content/BootstrapBlazor.FontAwesome/css/font-awesome.min.css", + $"{NavigationManager.BaseUri}_content/BootstrapBlazor/css/bootstrap.blazor.bundle.min.css" + ]); } private AttributeItem[] GetAttributes() => From 7e582b2750a63c17dd952532664f21d3b8bc46ca Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Thu, 26 Dec 2024 16:27:04 +0800 Subject: [PATCH 5/6] =?UTF-8?q?revert:=20=E6=92=A4=E9=94=80=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Samples/ExportPdfButtons.razor | 4 ++-- .../Samples/ExportPdfButtons.razor.cs | 10 ---------- .../Components/Button/ExportPdfButton.cs | 18 +++++++++++++++++- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/BootstrapBlazor.Server/Components/Samples/ExportPdfButtons.razor b/src/BootstrapBlazor.Server/Components/Samples/ExportPdfButtons.razor index de0fbc3a763..315124c4b54 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/ExportPdfButtons.razor +++ b/src/BootstrapBlazor.Server/Components/Samples/ExportPdfButtons.razor @@ -19,7 +19,7 @@ - + @@ -41,7 +41,7 @@ - + diff --git a/src/BootstrapBlazor.Server/Components/Samples/ExportPdfButtons.razor.cs b/src/BootstrapBlazor.Server/Components/Samples/ExportPdfButtons.razor.cs index 1ba738a127d..fbad4619f87 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/ExportPdfButtons.razor.cs +++ b/src/BootstrapBlazor.Server/Components/Samples/ExportPdfButtons.razor.cs @@ -32,17 +32,12 @@ public partial class ExportPdfButtons [NotNull] private ToastService? ToastService { get; set; } - [Inject, NotNull] - private NavigationManager? NavigationManager { get; set; } - private Task OnBeforeExport() => ToastService.Information(Localizer["ToastTitle"], Localizer["ToastContent"]); private static string PdfFileName => $"Pdf-{DateTime.Now:HHmmss}.pdf"; private Task OnAfterDownload(string fileName) => ToastService.Success(Localizer["ToastDownloadTitle"], Localizer["ToastDownloadContent", fileName]); - private List _styleTags = []; - /// /// /// @@ -51,11 +46,6 @@ protected override void OnInitialized() Items = Foo.GenerateFoo(FooLocalizer); Hobbies = Foo.GenerateHobbies(FooLocalizer); Model = Foo.Generate(FooLocalizer); - - _styleTags.AddRange([ - $"{NavigationManager.BaseUri}_content/BootstrapBlazor.FontAwesome/css/font-awesome.min.css", - $"{NavigationManager.BaseUri}_content/BootstrapBlazor/css/bootstrap.blazor.bundle.min.css" - ]); } private AttributeItem[] GetAttributes() => diff --git a/src/BootstrapBlazor/Components/Button/ExportPdfButton.cs b/src/BootstrapBlazor/Components/Button/ExportPdfButton.cs index dff9753a0e9..a858e550158 100644 --- a/src/BootstrapBlazor/Components/Button/ExportPdfButton.cs +++ b/src/BootstrapBlazor/Components/Button/ExportPdfButton.cs @@ -67,6 +67,9 @@ public class ExportPdfButton : Button [Inject, NotNull] private IHtml2Pdf? Html2PdfService { get; set; } + [Inject, NotNull] + private NavigationManager? NavigationManager { get; set; } + [Inject, NotNull] private DownloadService? DownloadService { get; set; } @@ -114,8 +117,21 @@ protected override async Task HandlerClick() """; + // 增加网页所需样式表文件 + List styles = [ + $"{NavigationManager.BaseUri}_content/BootstrapBlazor.FontAwesome/css/font-awesome.min.css", + $"{NavigationManager.BaseUri}_content/BootstrapBlazor/css/bootstrap.blazor.bundle.min.css" + ]; + if (StyleTags != null) + { + styles.AddRange(StyleTags); + } + + // 增加网页所需脚本文件 + var scripts = ScriptTags ?? []; + // 生成 Pdf 流 - using var stream = await Html2PdfService.PdfStreamFromHtmlAsync(htmlString, StyleTags, ScriptTags); + using var stream = await Html2PdfService.PdfStreamFromHtmlAsync(htmlString, styles, scripts); if (OnBeforeDownload != null) { From 3c9b7dda3deb456e07d8b0a41b50392ef5963d80 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Thu, 26 Dec 2024 16:28:53 +0800 Subject: [PATCH 6/6] chore: bump version 9.1.9-beta10 --- 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 e1e709b00b0..f5b3e208cab 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@ - 9.1.9-beta11 + 9.1.9-beta10