Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/BootstrapBlazor/BootstrapBlazor.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<Version>9.3.1-beta21</Version>
<Version>9.3.1-beta22</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
9 changes: 8 additions & 1 deletion src/BootstrapBlazor/Components/Drawer/Drawer.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public partial class Drawer

private string? StyleString => CssBuilder.Default()
.AddStyle("--bb-drawer-position", Position)
.AddClass($"--bb-drawer-zindex: {ZIndex};", ZIndex.HasValue)
.AddStyleFromAttributes(AdditionalAttributes)
.Build();

Expand Down Expand Up @@ -107,6 +108,12 @@ public partial class Drawer
[Parameter]
public bool AllowResize { get; set; }

/// <summary>
/// 获得/设置 z-index 参数值 默认 null 未设置
/// </summary>
[Parameter]
public int? ZIndex { get; set; }

/// <summary>
/// 获得/设置 关闭抽屉回调委托 默认 null
/// </summary>
Expand All @@ -133,7 +140,7 @@ public partial class Drawer

private string? KeyboardString => IsKeyboard ? "true" : null;

private string? BodyScrollString => BodyScroll ? "true" : null;
private string? BodyScrollString => BodyScroll ? "true" : null;

/// <summary>
/// <inheritdoc/>
Expand Down
4 changes: 4 additions & 0 deletions src/BootstrapBlazor/Components/Drawer/DrawerContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@
{
parameters.Add(nameof(Drawer.Height), option.Height);
}
if (option.ZIndex.HasValue)
{
parameters.Add(nameof(Drawer.ZIndex), option.ZIndex);
}

Check warning on line 87 in src/BootstrapBlazor/Components/Drawer/DrawerContainer.cs

View check run for this annotation

Codecov / codecov/patch

src/BootstrapBlazor/Components/Drawer/DrawerContainer.cs#L85-L87

Added lines #L85 - L87 were not covered by tests
var content = option.GetContent();
if (content != null)
{
Expand Down
5 changes: 5 additions & 0 deletions src/BootstrapBlazor/Components/Drawer/DrawerOption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,9 @@ public class DrawerOption
/// 获得/设置 相关连数据,多用于传值使用
/// </summary>
public object? BodyContext { get; set; }

/// <summary>
/// 获得/设置 z-index 参数值 默认 null 未设置
/// </summary>
public int? ZIndex { get; set; }
}
10 changes: 10 additions & 0 deletions test/UnitTest/Components/DrawerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,16 @@ public void Position_Ok()
cut.Contains("--bb-drawer-position: absolute;");
}

[Fact]
public void ZIndex_Ok()
{
var cut = Context.RenderComponent<Drawer>(builder =>
{
builder.Add(a => a.ZIndex, 1055);
});
cut.Contains("--bb-drawer-zindex: 1055;");
}

[Fact]
public void IsKeyboard_Ok()
{
Expand Down