File tree Expand file tree Collapse file tree 7 files changed +28
-19
lines changed
BootstrapBlazor.Server/Components/Samples Expand file tree Collapse file tree 7 files changed +28
-19
lines changed Original file line number Diff line number Diff line change 184184
185185<DemoBlock Title =" @Localizer[" TreeViewVirtualizeTitle " ]"
186186 Introduction =" @Localizer[" TreeViewVirtualizeIntro " ]"
187- Name =" DefaultExpand" >
188- <section ignore >
189- @( (MarkupString )Localizer [" TreeViewVirtualizeDescription" ].Value )
187+ Name =" IsVirtualize" >
188+ <section ignore class =" row g-3" >
189+ <div class =" col-12" >
190+ @( (MarkupString )Localizer [" TreeViewVirtualizeDescription" ].Value )
191+ </div >
192+ <div class =" col-12" >
193+ <BootstrapInputGroup >
194+ <BootstrapInputGroupLabel DisplayText =" ShowSearch" ></BootstrapInputGroupLabel >
195+ <Switch @bind-Value =" _showSearch" ></Switch >
196+ </BootstrapInputGroup >
197+ </div >
190198 </section >
191199 <div style =" height : 400px " >
192- <TreeView Items =" @VirtualizeItems" ShowCheckbox =" true" IsVirtualize =" true"
200+ <TreeView Items =" @VirtualizeItems" ShowCheckbox =" true" ShowSearch = " _showSearch " IsVirtualize =" true"
193201 AutoCheckChildren =" true" AutoCheckParent =" true"
194202 OnExpandNodeAsync =" OnExpandVirtualNodeAsync" ></TreeView >
195203 </div >
Original file line number Diff line number Diff line change @@ -74,6 +74,8 @@ public sealed partial class TreeViews
7474
7575 private Foo Model => Foo . Generate ( LocalizerFoo ) ;
7676
77+ private bool _showSearch ;
78+
7779 private string ? _selectedValue ;
7880
7981 private Task OnTreeItemClick ( TreeViewItem < TreeFoo > item )
Original file line number Diff line number Diff line change 11<Project Sdk =" Microsoft.NET.Sdk.Razor" >
22
33 <PropertyGroup >
4- <Version >9.3.1-beta16 </Version >
4+ <Version >9.3.1-beta17 </Version >
55 </PropertyGroup >
66
77 <ItemGroup >
Original file line number Diff line number Diff line change 3939 }
4040 else
4141 {
42- @SearchTemplate
42+ <div class =" tree-search" >
43+ @SearchTemplate
44+ </div >
4345 }
4446 }
4547 @if (IsVirtualize )
4648 {
47- <div class =" tree-root is-virtual" tabindex =" 0" >
49+ <div class =" tree-root scroll is-virtual" tabindex =" 0" >
4850 <Virtualize ItemSize =" RowHeight" OverscanCount =" 10" Items =" @Rows" >
4951 <ItemContent >
5052 @RenderTreeRow(context)
5456 }
5557 else
5658 {
57- <div class =" tree-root" tabindex =" 0" >
59+ <div class =" tree-root scroll " tabindex =" 0" >
5860 @foreach ( var item in Rows )
5961 {
6062 @RenderTreeRow(item)
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ public partial class TreeView<TItem> : IModelEqualityComparer<TItem>
1717 /// <summary>
1818 /// 获得 按钮样式集合
1919 /// </summary>
20- private string ? ClassString => CssBuilder . Default ( "tree-view scroll " )
20+ private string ? ClassString => CssBuilder . Default ( "tree-view" )
2121 . AddClass ( "is-fixed-search" , ShowSearch && IsFixedSearch )
2222 . AddClassFromAttributes ( AdditionalAttributes )
2323 . Build ( ) ;
Original file line number Diff line number Diff line change 1616 --bb-tree-item-bg-radius : var (--bs-border-radius );
1717 position : relative ;
1818 height : 100% ;
19+ display : flex ;
20+ flex-direction : column ;
1921
2022 .tree-search {
21- padding : var (--bb-tree-padding );
2223 padding-bottom : .5rem ;
23- background-color : var (--bs-body-bg );
24- }
25-
26- & .is-fixed-search .tree-search {
27- position : sticky ;
28- top : 0 ;
29- z-index : 5 ;
3024 }
3125
3226 .tree-root {
3327 padding : var (--bb-tree-padding );
3428 margin : var (--bb-tree-margin );
3529 position : relative ;
30+ flex : 1 ;
31+ min-height : 0 ;
32+ height : 1% ;
3633 }
3734
3835 .tree-content {
Original file line number Diff line number Diff line change @@ -590,7 +590,7 @@ public async Task IsVirtualize_Ok()
590590 pb . Add ( a => a . IsVirtualize , false ) ;
591591 pb . Add ( a => a . Items , items ) ;
592592 } ) ;
593- cut . Contains ( "tree-root" ) ;
593+ cut . Contains ( "tree-root scroll " ) ;
594594
595595 cut . SetParametersAndRender ( pb =>
596596 {
@@ -611,7 +611,7 @@ public async Task IsVirtualize_Ok()
611611 return [ node1 , node2 ] ;
612612 } ) ;
613613 } ) ;
614- cut . Contains ( "tree-root is-virtual" ) ;
614+ cut . Contains ( "tree-root scroll is-virtual" ) ;
615615
616616 // 触发第一个节点展开
617617 await cut . InvokeAsync ( ( ) => cut . Find ( ".node-icon.visible" ) . Click ( ) ) ;
You can’t perform that action at this time.
0 commit comments