feat(BootstrapInputGroupLabel): add IsGroupLabel parameter (#7257)

* feat(Table): use dropdown-column selector

* feat: 增加 IsGroupLabel 参数

* style: 增加样式

* test: 增加单元测试
This commit is contained in:
Argo Zhang
2025-12-05 14:29:04 +08:00
committed by GitHub
parent 17edba3906
commit fd396e36ea
3 changed files with 32 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
@use "../../wwwroot/scss/variables" as *;
@use "../../wwwroot/scss/variables" as *;
.btn {
--bs-btn-font-size: #{$bs-btn-font-size};
@@ -91,4 +91,14 @@
display: block;
}
}
> .input-group-text:not(:first-child) {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
> .input-group-text:not(:last-child) {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
}

View File

@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// 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
@@ -51,9 +51,15 @@ public sealed class BootstrapInputGroupLabel : DisplayBase<string>
[Parameter]
public RenderFragment? ChildContent { get; set; }
/// <summary>
/// 获得/设置 是否为 InputGroup 或 TableToolbar 内的标签 默认 null 未设置
/// </summary>
[Parameter]
public bool? IsGroupLabel { get; set; }
private string? Required => ShowRequiredMark ? "true" : null;
private bool IsInputGroupLabel => InputGroup != null;
private bool IsInputGroupLabel => IsGroupLabel ?? InputGroup != null;
/// <summary>
/// <inheritdoc/>

View File

@@ -282,6 +282,19 @@ public class InputTest : BootstrapBlazorTestBase
cut.DoesNotContain("DisplayText");
}
[Fact]
public void IsGroupLabel_Ok()
{
var cut = Context.Render<BootstrapInputGroupLabel>();
cut.DoesNotContain("input-group-text");
cut.Render(pb =>
{
pb.Add(a => a.IsGroupLabel, true);
});
cut.Contains("input-group-text");
}
[Fact]
public void ShowRequiredMark_Ok()
{