File tree Expand file tree Collapse file tree 9 files changed +57
-14
lines changed
BootstrapBlazor.Server/Components/Layout Expand file tree Collapse file tree 9 files changed +57
-14
lines changed Original file line number Diff line number Diff line change 1010 <span class =" sidebar-text" >Bootstrap Blazor</span >
1111 </div >
1212 <NavMenu />
13- <LayoutSidebar Min =" 250" Max =" 380" ContainerSelector =" .section" ></LayoutSidebar >
13+ <LayoutSplitebar Min =" 250" Max =" 380" ContainerSelector =" .section" ></LayoutSplitebar >
1414 </aside >
1515
1616 <section class =" main" >
Original file line number Diff line number Diff line change 9090 }
9191 @if (ShowSplitBar )
9292 {
93- < LayoutSidebar >< / LayoutSidebar >
93+ < LayoutSplitebar >< / LayoutSplitebar >
9494 }
9595 @if (Menus != null )
9696 {
Original file line number Diff line number Diff line change 11@namespace BootstrapBlazor.Components
22@inherits BootstrapModuleComponentBase
3- @attribute [BootstrapModuleAutoLoader("Layout/LayoutSidebar .razor.js")]
3+ @attribute [BootstrapModuleAutoLoader("Layout/LayoutSplitebar .razor.js")]
44
5- <div id =" @Id" class =" layout-sidebar "
5+ <div id =" @Id" class =" layout-splitebar "
66 data-bb-min =" @_minWidthString" data-bb-max =" @_maxWidthString" data-bb-selector =" @ContainerSelector" >
7- <div class =" layout-sidebar -body" ></div >
7+ <div class =" layout-splitebar -body" ></div >
88</div >
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ namespace BootstrapBlazor.Components;
88/// <summary>
99/// LayoutSidebar 组件
1010/// </summary>
11- public partial class LayoutSidebar
11+ public partial class LayoutSplitebar
1212{
1313 /// <summary>
1414 /// 获得/设置 容器选择器 默认 null 未设置
Original file line number Diff line number Diff line change 11import Drag from "../../modules/drag.js"
2- import Data from "../../modules/data.js"
32
43export function init ( id ) {
54 const el = document . getElementById ( id ) ;
@@ -9,9 +8,9 @@ export function init(id) {
98
109 const min = parseFloat ( el . getAttribute ( "data-bb-min" ) ?? "0" ) ;
1110 const max = parseFloat ( el . getAttribute ( "data-bb-max" ) ?? "0" ) ;
12- const selector = el . getAttribute ( "data-bb-selector" ) ;
11+ const selector = el . getAttribute ( "data-bb-selector" ) ?? ".layout" ;
1312 const section = document . querySelector ( selector ) ;
14- const bar = el . querySelector ( ".layout-sidebar -body" ) ;
13+ const bar = el . querySelector ( ".layout-splitebar -body" ) ;
1514 let originX = 0 ;
1615 let width = 0 ;
1716 Drag . drag ( bar ,
@@ -37,7 +36,7 @@ export function init(id) {
3736export function dispose ( id ) {
3837 const el = document . getElementById ( id ) ;
3938 if ( el ) {
40- const bar = el . querySelector ( ".layout-sidebar -body" ) ;
39+ const bar = el . querySelector ( ".layout-splitebar -body" ) ;
4140 if ( bar ) {
4241 Drag . dispose ( bar ) ;
4342 }
Original file line number Diff line number Diff line change 1- .layout-sidebar {
1+ .layout-splitebar {
22 width : 1px ;
33 position : absolute ;
44 top : 0 ;
77 background-color : var (--bs-border-color );
88 display : none ;
99
10- .layout-sidebar -body {
10+ .layout-splitebar -body {
1111 position : absolute ;
1212 inset : 0px -2px ;
1313 cursor : col-resize ;
2626}
2727
2828@media (min-width : 768px ) {
29- .layout-sidebar {
29+ .layout-splitebar {
3030 display : block ;
3131 }
3232}
Original file line number Diff line number Diff line change 5757@import " ../../Components/Input/FloatingLabel.razor.scss" ;
5858@import " ../../Components/IpAddress/IpAddress.razor.scss" ;
5959@import " ../../Components/Layout/Layout.razor.scss" ;
60- @import " ../../Components/Layout/LayoutSidebar .razor.scss" ;
60+ @import " ../../Components/Layout/LayoutSplitebar .razor.scss" ;
6161@import " ../../Components/Light/Light.razor.scss" ;
6262@import " ../../Components/ListGroup/ListGroup.razor.scss" ;
6363@import " ../../Components/ListView/ListView.razor.scss" ;
Original file line number Diff line number Diff line change 1+ // Licensed to the .NET Foundation under one or more agreements.
2+ // The .NET Foundation licenses this file to you under the Apache 2.0 License
3+ // See the LICENSE file in the project root for more information.
4+ // Maintainer: Argo Zhang([email protected] ) Website: https://www.blazor.zone 5+
6+ namespace UnitTest . Components ;
7+
8+ public class LayoutSplitebarTest : BootstrapBlazorTestBase
9+ {
10+ [ Fact ]
11+ public void LayoutSplitebar_Ok ( )
12+ {
13+ var cut = Context . RenderComponent < LayoutSplitebar > ( pb =>
14+ {
15+ pb . Add ( a => a . ContainerSelector , ".layout" ) ;
16+ } ) ;
17+ cut . Contains ( "data-bb-selector=\" .layout\" " ) ;
18+
19+ cut . SetParametersAndRender ( pb =>
20+ {
21+ pb . Add ( a => a . Min , 100 ) ;
22+ pb . Add ( a => a . Max , 200 ) ;
23+ } ) ;
24+ cut . Contains ( "data-bb-min=\" 100\" " ) ;
25+ cut . Contains ( "data-bb-max=\" 200\" " ) ;
26+ }
27+ }
Original file line number Diff line number Diff line change @@ -237,6 +237,23 @@ public void UseTabSet_Layout()
237237 cut . WaitForAssertion ( ( ) => cut . Contains ( "<div class=\" tabs-body-content\" >Binder</div>" ) ) ;
238238 }
239239
240+ [ Fact ]
241+ public void ShowLayouSidebar_Ok ( )
242+ {
243+ var cut = Context . RenderComponent < Layout > ( pb =>
244+ {
245+ pb . Add ( a => a . UseTabSet , true ) ;
246+ pb . Add ( a => a . AdditionalAssemblies , new Assembly [ ] { GetType ( ) . Assembly } ) ;
247+ pb . Add ( a => a . IsFullSide , true ) ;
248+ pb . Add ( a => a . ShowSplitBar , true ) ;
249+ pb . Add ( a => a . Side , new RenderFragment ( builder =>
250+ {
251+ builder . AddContent ( 0 , "test" ) ;
252+ } ) ) ;
253+ } ) ;
254+ cut . Contains ( "layout-splitebar" ) ;
255+ }
256+
240257 [ Fact ]
241258 public void UseTabSet_Menus ( )
242259 {
You can’t perform that action at this time.
0 commit comments