diff --git a/src/BootstrapBlazor/BootstrapBlazor.csproj b/src/BootstrapBlazor/BootstrapBlazor.csproj index ed6980a6efb..3dbb728cb92 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@  - 9.2.7-beta03 + 9.2.7-beta05 diff --git a/src/BootstrapBlazor/Components/Transfer/Transfer.razor b/src/BootstrapBlazor/Components/Transfer/Transfer.razor index 5b6d6547c75..31385aa2b50 100644 --- a/src/BootstrapBlazor/Components/Transfer/Transfer.razor +++ b/src/BootstrapBlazor/Components/Transfer/Transfer.razor @@ -6,7 +6,7 @@ { } -
+
/// [Parameter] [NotNull] -#if NET6_0_OR_GREATER [EditorRequired] -#endif public IEnumerable? Items { get; set; } /// @@ -188,10 +185,26 @@ public partial class Transfer [Parameter] public RenderFragment? RightItemTemplate { get; set; } + /// + /// 获得/设置 组件高度 默认值 null 未设置 + /// + [Parameter] + public string? Height { get; set; } + [Inject] [NotNull] private IIconTheme? IconTheme { get; set; } + private string? ClassString => CssBuilder.Default("transfer") + .AddClass("has-height", !string.IsNullOrEmpty(Height)) + .AddClassFromAttributes(AdditionalAttributes) + .Build(); + + private string? StyleString => CssBuilder.Default() + .AddClass($"--bb-transfer-height: {Height};", !string.IsNullOrEmpty(Height)) + .AddStyleFromAttributes(AdditionalAttributes) + .Build(); + /// /// OnInitialized 方法 /// diff --git a/src/BootstrapBlazor/Components/Transfer/Transfer.razor.scss b/src/BootstrapBlazor/Components/Transfer/Transfer.razor.scss index 86fbed83070..2aaa3cb2c5c 100644 --- a/src/BootstrapBlazor/Components/Transfer/Transfer.razor.scss +++ b/src/BootstrapBlazor/Components/Transfer/Transfer.razor.scss @@ -13,6 +13,18 @@ display: flex; flex-direction: row; flex-wrap: nowrap; + + &.has-height { + height: var(--bb-transfer-height); + + .transfer-panel { + height: 100%; + + .transfer-panel-body { + height: calc(100% - var(--bb-transfer-panel-header-height)); + } + } + } } .transfer-panel { diff --git a/test/UnitTest/Components/TransferTest.cs b/test/UnitTest/Components/TransferTest.cs index 4271443a32a..a7982c9afcc 100644 --- a/test/UnitTest/Components/TransferTest.cs +++ b/test/UnitTest/Components/TransferTest.cs @@ -28,6 +28,16 @@ public void Items_Ok() cut.Contains("transfer-panel"); } + [Fact] + public void Height_Ok() + { + var cut = Context.RenderComponent>(pb => + { + pb.Add(a => a.Height, "200px"); + }); + cut.Contains("--bb-transfer-height: 200px;"); + } + [Fact] public async Task EnumerableString_Value() {