From f939080f59c624505600b8c749e5f98a99c63f26 Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Wed, 12 Oct 2022 00:11:55 +0800 Subject: [PATCH 1/8] =?UTF-8?q?test:=20=E4=BF=AE=E5=A4=8D=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E7=9A=84=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/UnitTest/Components/TooltipTest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/UnitTest/Components/TooltipTest.cs b/test/UnitTest/Components/TooltipTest.cs index 0dac8ad25..8856e3a3c 100644 --- a/test/UnitTest/Components/TooltipTest.cs +++ b/test/UnitTest/Components/TooltipTest.cs @@ -40,7 +40,7 @@ public class TooltipTest : BootstrapBlazorTestBase Assert.Equal("title", tooltip.Title); Assert.Contains("data-bs-placement=\"top\"", cut.Markup); Assert.Contains("data-bs-trigger=\"trigger\"", cut.Markup); - Assert.Contains("data-bs-customclass=\"custom-class\"", cut.Markup); + Assert.Contains("data-bs-custom-class=\"custom-class\"", cut.Markup); Assert.Contains("data-bs-html=\"true\"", cut.Markup); Assert.Contains("data-bs-sanitize=\"false\"", cut.Markup); Assert.Contains("data-bs-delay=\"10\"", cut.Markup); @@ -125,7 +125,7 @@ public class TooltipTest : BootstrapBlazorTestBase { pb.Add(a => a.CustomClass, "test-custom-class"); }); - Assert.Contains("data-bs-customclass=\"test-custom-class\"", cut.Markup); + Assert.Contains("data-bs-custom-class=\"test-custom-class\"", cut.Markup); } [Fact] -- Gitee From 44c16db82c27e18e60f824ccd4f9d916054d96de Mon Sep 17 00:00:00 2001 From: Argo-Asicotech Date: Wed, 12 Oct 2022 00:20:12 +0800 Subject: [PATCH 2/8] =?UTF-8?q?test:=20=E6=8E=92=E9=99=A4=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Components/Upload/UploadFile.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/BootstrapBlazor/Components/Upload/UploadFile.cs b/src/BootstrapBlazor/Components/Upload/UploadFile.cs index 9112eef61..8129d950d 100644 --- a/src/BootstrapBlazor/Components/Upload/UploadFile.cs +++ b/src/BootstrapBlazor/Components/Upload/UploadFile.cs @@ -111,6 +111,7 @@ public class UploadFile /// /// /// + [ExcludeFromCodeCoverage] public async Task GetByteArray(string format, int maxWidth, int maxHeight, long maxAllowedSize = 512000, CancellationToken token = default) { if (File != null) -- Gitee From 94c84058a5b91a1758928bdbf1562e9531d75e22 Mon Sep 17 00:00:00 2001 From: Argo-Asicotech Date: Wed, 12 Oct 2022 00:41:54 +0800 Subject: [PATCH 3/8] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=20JSObjectRefere?= =?UTF-8?q?nce=20=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Attributes/JSModuleAutoLoaderAttribute.cs | 5 +++++ .../BaseComponents/BootstrapModuleComponentBase.cs | 14 +++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/BootstrapBlazor/Attributes/JSModuleAutoLoaderAttribute.cs b/src/BootstrapBlazor/Attributes/JSModuleAutoLoaderAttribute.cs index 85977d0b1..9eaa9bbb3 100644 --- a/src/BootstrapBlazor/Attributes/JSModuleAutoLoaderAttribute.cs +++ b/src/BootstrapBlazor/Attributes/JSModuleAutoLoaderAttribute.cs @@ -20,6 +20,11 @@ public class JSModuleAutoLoaderAttribute : Attribute /// public string? ModuleName { get; set; } + /// + /// Represents a reference to a JavaScript object Default value false + /// + public bool JSObjectReference { get; set; } + /// /// 获得/设置 脚本路径是否为相对路径 默认 true /// diff --git a/src/BootstrapBlazor/Components/BaseComponents/BootstrapModuleComponentBase.cs b/src/BootstrapBlazor/Components/BaseComponents/BootstrapModuleComponentBase.cs index 35b1d551e..42382221c 100644 --- a/src/BootstrapBlazor/Components/BaseComponents/BootstrapModuleComponentBase.cs +++ b/src/BootstrapBlazor/Components/BaseComponents/BootstrapModuleComponentBase.cs @@ -27,6 +27,11 @@ public abstract class BootstrapModuleComponentBase : IdComponentBase, IAsyncDisp private bool Relative { get; set; } + /// + /// 获得/设置 是否需要 javascript invoke 默认 false + /// + protected bool JSObjectReference { get; set; } + /// /// /// @@ -38,18 +43,19 @@ public abstract class BootstrapModuleComponentBase : IdComponentBase, IAsyncDisp var attr = type.GetCustomAttribute(); if (attr != null) { - LoadModule(type, attr.Path, attr.ModuleName, attr.Relative); + LoadModule(type, attr.Path, attr.ModuleName, attr.JSObjectReference, attr.Relative); } } /// /// 加载本类模块 /// - protected virtual void LoadModule(Type type, string? path, string? name, bool relative = true) + protected virtual void LoadModule(Type type, string? path, string? name, bool jsRef = false, bool relative = true) { string? typeName = null; ModulePath = path ?? GetTypeName().ToLowerInvariant(); ModuleName = name ?? GetTypeName(); + JSObjectReference = jsRef; Relative = relative; string GetTypeName() @@ -68,7 +74,9 @@ public abstract class BootstrapModuleComponentBase : IdComponentBase, IAsyncDisp { if (firstRender && !string.IsNullOrEmpty(ModulePath)) { - Module ??= await JSRuntime.LoadModule(ModulePath, this, Relative); + Module ??= JSObjectReference + ? await JSRuntime.LoadModule(ModulePath, this, Relative) + : await JSRuntime.LoadModule(ModulePath, Relative); } await ModuleInvokeVoidAsync(firstRender); -- Gitee From 7c07c1b7db01352f1acb9ba2f887f147b0b6778c Mon Sep 17 00:00:00 2001 From: Argo-Asicotech Date: Wed, 12 Oct 2022 00:42:06 +0800 Subject: [PATCH 4/8] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0=E5=AE=BD?= =?UTF-8?q?=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor.Shared/wwwroot/css/site.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/BootstrapBlazor.Shared/wwwroot/css/site.css b/src/BootstrapBlazor.Shared/wwwroot/css/site.css index 4c147cdb9..aca339ffe 100644 --- a/src/BootstrapBlazor.Shared/wwwroot/css/site.css +++ b/src/BootstrapBlazor.Shared/wwwroot/css/site.css @@ -1832,7 +1832,8 @@ header .bb-fs { @media (min-width: 576px) { .popover-demo input, .tooltip-demo input { - width: 100px; + width: 144px; + text-align: center; } .bb-icon { -- Gitee From 5f2a2d3a1dab3394774eb04c92f0dd4622b4b1f2 Mon Sep 17 00:00:00 2001 From: Argo-Asicotech Date: Wed, 12 Oct 2022 00:42:27 +0800 Subject: [PATCH 5/8] =?UTF-8?q?refactor:=20=E5=A2=9E=E5=8A=A0=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E5=8F=82=E6=95=B0=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/wwwroot/modules/upload.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/BootstrapBlazor/wwwroot/modules/upload.js b/src/BootstrapBlazor/wwwroot/modules/upload.js index 509553716..a391ab4f6 100644 --- a/src/BootstrapBlazor/wwwroot/modules/upload.js +++ b/src/BootstrapBlazor/wwwroot/modules/upload.js @@ -2,13 +2,19 @@ import BlazorComponent from "./base/blazor-component.js" export class Upload extends BlazorComponent { + static get Default() { + return { + browserClass: '.btn-browser' + } + } + _init() { this._inputFile = this._element.querySelector('[type="file"]') this._setListeners() } _setListeners() { - EventHandler.on(this._element, 'click', '.btn-browser', () => { + EventHandler.on(this._element, 'click', this._config.browserClass, () => { this._inputFile.click() }) @@ -52,7 +58,7 @@ export class Upload extends BlazorComponent { } _dispose() { - EventHandler.off(this._element, 'click', '.btn-browser') + EventHandler.off(this._element, 'click', this._config.browserClass) EventHandler.off(document, 'dragleave'); EventHandler.off(document, 'drop'); EventHandler.off(document, 'dragenter'); -- Gitee From 3007903705ac152ca4de26df01a9b2d7a86353bb Mon Sep 17 00:00:00 2001 From: Argo-Asicotech Date: Wed, 12 Oct 2022 00:45:54 +0800 Subject: [PATCH 6/8] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/wwwroot/modules/tooltip.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/BootstrapBlazor/wwwroot/modules/tooltip.js b/src/BootstrapBlazor/wwwroot/modules/tooltip.js index 0597c5ed3..14e12f6f3 100644 --- a/src/BootstrapBlazor/wwwroot/modules/tooltip.js +++ b/src/BootstrapBlazor/wwwroot/modules/tooltip.js @@ -3,9 +3,9 @@ import { getTransitionDelayDurationFromElement } from "./base/utility.js" export class Tooltip extends BlazorComponent { _init() { - this._config.title = this._config.arguments[1] - if (this._config.arguments.length > 2) { - const method = this._config.arguments[2] + this._config.title = this._config.arguments[0] + if (this._config.arguments.length > 1) { + const method = this._config.arguments[1] if (method === 'Valid') { this._reset() } -- Gitee From 21793c63ef4c798387d193499888c05ded34bc71 Mon Sep 17 00:00:00 2001 From: Argo-Asicotech Date: Wed, 12 Oct 2022 00:46:15 +0800 Subject: [PATCH 7/8] =?UTF-8?q?refactor:=20=E5=A2=9E=E5=8A=A0=20JSObjectRe?= =?UTF-8?q?ference=20=E5=8F=82=E6=95=B0=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Components/Select/Select.razor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/Components/Select/Select.razor.cs b/src/BootstrapBlazor/Components/Select/Select.razor.cs index 0124d689b..2a1c8b710 100644 --- a/src/BootstrapBlazor/Components/Select/Select.razor.cs +++ b/src/BootstrapBlazor/Components/Select/Select.razor.cs @@ -10,7 +10,7 @@ namespace BootstrapBlazor.Components; /// Select 组件实现类 /// /// -[JSModuleAutoLoader] +[JSModuleAutoLoader(JSObjectReference = true)] public partial class Select : ISelect { [Inject] -- Gitee From 3de3f179b270081dc26ab964ce89e376c7878758 Mon Sep 17 00:00:00 2001 From: Argo-Asicotech Date: Wed, 12 Oct 2022 00:51:12 +0800 Subject: [PATCH 8/8] chore: bump version 6.11.8-beta01 --- 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 bf9c8e202..353a15045 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@ - 6.11.7 + 6.11.8-beta01 -- Gitee