diff --git a/src/BootstrapBlazor.Shared/wwwroot/css/site.css b/src/BootstrapBlazor.Shared/wwwroot/css/site.css
index 4c147cdb90b467ddbc90efd0de0eacd3d71e5567..aca339ffec9d3997085e6d8f10ea3c0a45f2c239 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 {
diff --git a/src/BootstrapBlazor/Attributes/JSModuleAutoLoaderAttribute.cs b/src/BootstrapBlazor/Attributes/JSModuleAutoLoaderAttribute.cs
index 85977d0b1d62938db7118666a57ca32a5ce9a871..9eaa9bbb3cb02b2821b3726ec895f3ab1445fdda 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/BootstrapBlazor.csproj b/src/BootstrapBlazor/BootstrapBlazor.csproj
index bf9c8e2025151fc8e6b6b665d85a18a49a060b92..353a1504551192b1c550271c8a90ffcacc12a73d 100644
--- a/src/BootstrapBlazor/BootstrapBlazor.csproj
+++ b/src/BootstrapBlazor/BootstrapBlazor.csproj
@@ -1,7 +1,7 @@
- 6.11.7
+ 6.11.8-beta01
diff --git a/src/BootstrapBlazor/Components/BaseComponents/BootstrapModuleComponentBase.cs b/src/BootstrapBlazor/Components/BaseComponents/BootstrapModuleComponentBase.cs
index 35b1d551e6f6277fae3a0d9b51df921bf06fc79e..42382221c51dc6858c2f3ff37cf0f3f8df40f533 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);
diff --git a/src/BootstrapBlazor/Components/Select/Select.razor.cs b/src/BootstrapBlazor/Components/Select/Select.razor.cs
index 0124d689be205c26dce6941c6c5b17d5cd0dea5c..2a1c8b7100388850c65fcbee3d567ef3c7df0203 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]
diff --git a/src/BootstrapBlazor/Components/Upload/UploadFile.cs b/src/BootstrapBlazor/Components/Upload/UploadFile.cs
index 9112eef61f862c396a8fdacf9af197f9e2e79525..8129d950d24c2e6e4738959f29c3122090fdf535 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)
diff --git a/src/BootstrapBlazor/wwwroot/modules/tooltip.js b/src/BootstrapBlazor/wwwroot/modules/tooltip.js
index 0597c5ed34117470de72aac6dd5ef05adeea3ef6..14e12f6f35f56b780560ba26531b772d660b3696 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()
}
diff --git a/src/BootstrapBlazor/wwwroot/modules/upload.js b/src/BootstrapBlazor/wwwroot/modules/upload.js
index 509553716c6ab165937d128626aeb7bfe03871d0..a391ab4f672408526875eb37f03dde8a61875fb8 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');
diff --git a/test/UnitTest/Components/TooltipTest.cs b/test/UnitTest/Components/TooltipTest.cs
index 0dac8ad2577a4a10073607c2559982f05e58b670..8856e3a3c298191716bb350310ba7275b6c057bf 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]