File tree Expand file tree Collapse file tree 5 files changed +40
-5
lines changed Expand file tree Collapse file tree 5 files changed +40
-5
lines changed Original file line number Diff line number Diff line change 11<Project Sdk =" Microsoft.NET.Sdk.Razor" >
22
33 <PropertyGroup >
4- <Version >9.2.7-beta03 </Version >
4+ <Version >9.2.7-beta05 </Version >
55 </PropertyGroup >
66
77 <ItemGroup >
Original file line number Diff line number Diff line change 66{
77 <BootstrapLabel required =" @Required" ShowLabelTooltip =" ShowLabelTooltip" Value =" @DisplayText" />
88}
9- <div @attributes =" @AdditionalAttributes" class =" transfer " >
9+ <div @attributes =" @AdditionalAttributes" class =" @ClassString " style = " @ StyleString " >
1010 <TransferPanel Items =" @LeftItems" Text =" @LeftPanelText" IsDisabled =" @IsDisabled"
1111 ShowSearch =" @ShowSearch" SearchPlaceHolderString =" @LeftPanelSearchPlaceHolderString"
1212 OnSelectedItemsChanged =" @SelectedItemsChanged" OnSetItemClass =" OnSetItemClass"
Original file line number Diff line number Diff line change 44// Maintainer: Argo Zhang([email protected] ) Website: https://www.blazor.zone 55
66using Microsoft . Extensions . Localization ;
7- using System . Reflection ;
87
98namespace BootstrapBlazor . Components ;
109
@@ -50,9 +49,7 @@ public partial class Transfer<TValue>
5049 /// </summary>
5150 [ Parameter ]
5251 [ NotNull ]
53- #if NET6_0_OR_GREATER
5452 [ EditorRequired ]
55- #endif
5653 public IEnumerable < SelectedItem > ? Items { get ; set ; }
5754
5855 /// <summary>
@@ -188,10 +185,26 @@ public partial class Transfer<TValue>
188185 [ Parameter ]
189186 public RenderFragment < SelectedItem > ? RightItemTemplate { get ; set ; }
190187
188+ /// <summary>
189+ /// 获得/设置 组件高度 默认值 null 未设置
190+ /// </summary>
191+ [ Parameter ]
192+ public string ? Height { get ; set ; }
193+
191194 [ Inject ]
192195 [ NotNull ]
193196 private IIconTheme ? IconTheme { get ; set ; }
194197
198+ private string ? ClassString => CssBuilder . Default ( "transfer" )
199+ . AddClass ( "has-height" , ! string . IsNullOrEmpty ( Height ) )
200+ . AddClassFromAttributes ( AdditionalAttributes )
201+ . Build ( ) ;
202+
203+ private string ? StyleString => CssBuilder . Default ( )
204+ . AddClass ( $ "--bb-transfer-height: { Height } ;", ! string . IsNullOrEmpty ( Height ) )
205+ . AddStyleFromAttributes ( AdditionalAttributes )
206+ . Build ( ) ;
207+
195208 /// <summary>
196209 /// OnInitialized 方法
197210 /// </summary>
Original file line number Diff line number Diff line change 1313 display : flex ;
1414 flex-direction : row ;
1515 flex-wrap : nowrap ;
16+
17+ & .has-height {
18+ height : var (--bb-transfer-height );
19+
20+ .transfer-panel {
21+ height : 100% ;
22+
23+ .transfer-panel-body {
24+ height : calc (100% - var (--bb-transfer-panel-header-height ));
25+ }
26+ }
27+ }
1628}
1729
1830.transfer-panel {
Original file line number Diff line number Diff line change @@ -28,6 +28,16 @@ public void Items_Ok()
2828 cut . Contains ( "transfer-panel" ) ;
2929 }
3030
31+ [ Fact ]
32+ public void Height_Ok ( )
33+ {
34+ var cut = Context . RenderComponent < Transfer < string > > ( pb =>
35+ {
36+ pb . Add ( a => a . Height , "200px" ) ;
37+ } ) ;
38+ cut . Contains ( "--bb-transfer-height: 200px;" ) ;
39+ }
40+
3141 [ Fact ]
3242 public async Task EnumerableString_Value ( )
3343 {
You can’t perform that action at this time.
0 commit comments