Skip to content

Commit 3a62946

Browse files
Merge pull request #5 from stavroskasidis/release/1.1
Release/1.1
2 parents 3c8aa27 + c19c0ea commit 3a62946

File tree

7 files changed

+40
-18
lines changed

7 files changed

+40
-18
lines changed

BlazorDialog/BlazorDialog.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<Copyright />
1717
<PackageTags>blazor blazor-component blazor-dialog dialog modal blazor-modal blazordialog blazormodaldialog blazormodal razor razor-components razorcomponents</PackageTags>
1818
<VersionSuffix>$(VersionSuffix)</VersionSuffix>
19-
<Version>1.0.0</Version>
19+
<Version>1.1.0</Version>
2020
<Version Condition=" '$(VersionSuffix)' != '' ">$(Version)-$(VersionSuffix)</Version>
2121
<Product>BlazorDialog</Product>
2222
</PropertyGroup>

BlazorDialog/BlazorDialogStore.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Security.Cryptography.X509Certificates;
34
using System.Text;
5+
using System.Linq;
46

57
namespace BlazorDialog
68
{
@@ -18,6 +20,11 @@ public Dialog GetById(string id)
1820
throw new ArgumentException($"No dialog found for id '{id}'", nameof(id));
1921
}
2022

23+
public int GetVisibleDialogsCount()
24+
{
25+
return registeredDialogs.Count(x => x.Value.GetVisibility());
26+
}
27+
2128
public void Register(Dialog blazorDialog)
2229
{
2330
if (blazorDialog?.Id == null)

BlazorDialog/Components/Dialog.razor

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<CascadingValue Value="this.Input" Name="DialogInput">
99
@if (!IsCustom)
1010
{
11-
<div class="blazor-dialog-container @(Centered ? "blazor-dialog-centered" : "")">
11+
<div class="blazor-dialog-container @(Centered ? "blazor-dialog-centered" : "")" style="z-index:@(1050 + dialogDepth)">
1212
<div class="blazor-dialog-content-wrapper @ContentWrapperCssClass @AnimationCssClass">
1313
<div class="blazor-dialog-content">
1414
@ChildContent
@@ -152,7 +152,7 @@
152152
}
153153

154154
bool isShowingChanged = false;
155-
155+
int dialogDepth = 0;
156156
protected override async Task OnParametersSetAsync()
157157
{
158158
if (isShowingChanged && IsShowing == true && !isShowing)
@@ -163,6 +163,7 @@
163163
await OnBeforeShow.InvokeAsync(args);
164164
}
165165
this.isShowing = true;
166+
dialogDepth = dialogStore.GetVisibleDialogsCount();
166167
if (OnAfterShow.HasDelegate)
167168
{
168169
var args = new DialogAfterShowEventArgs(this);
@@ -225,6 +226,7 @@
225226
await OnBeforeShow.InvokeAsync(args);
226227
}
227228
this.isShowing = true;
229+
dialogDepth = dialogStore.GetVisibleDialogsCount();
228230
await InvokeAsync(() => StateHasChanged());
229231
if (OnAfterShow.HasDelegate)
230232
{
@@ -263,4 +265,9 @@
263265
{
264266
await this.Hide<object>(null);
265267
}
268+
269+
public bool GetVisibility()
270+
{
271+
return this.isShowing;
272+
}
266273
}

BlazorDialog/IBlazorDialogStore.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ public interface IBlazorDialogStore
1010
void Register(Dialog blazorDialog);
1111
void Unregister(Dialog blazorDialog);
1212
Dialog GetById(string id);
13+
int GetVisibleDialogsCount();
1314
}
1415
}

BlazorDialog/wwwroot/styles.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.blazor-dialog-container {
22
position: fixed;
3-
z-index: 1050;
43
left: 0;
54
top: 0;
65
width: 100%; /* Full width */

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,12 @@ Make sure that there is a call to `app.UseStaticFiles();` in your server project
7676
7777
## Release Notes
7878

79-
<details open="open"><summary>1.0</summary>
79+
<details open="open"><summary>1.1</summary>
80+
81+
>- Added support for dialog-in-dialog.
82+
</details>
83+
84+
<details><summary>1.0</summary>
8085

8186
>- Fixed an infinite loop bug with `OnBeforeShow` event.
8287
>- Fixed css bugs.

TestApps/BlazorDialog.TestAppsCommon/IndexCommon.razor

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,6 @@
2020
<option value="@DialogAnimation.Zoom">@DialogAnimation.Zoom</option>
2121
<option value="@DialogAnimation.FadeIn">@DialogAnimation.FadeIn</option>
2222
</select>
23-
24-
<Dialog Id="simple-dialog" Size="size" Centered="isCentered" Animation="animation">
25-
<DialogInputProvider TInput="string">
26-
<DialogBody>
27-
<h4>@context.Input</h4>
28-
</DialogBody>
29-
<DialogFooter>
30-
<button type="button" class="btn btn-primary" @onclick="@(() => context.Dialog.Hide("yes"))">Yes</button>
31-
<button type="button" class="btn btn-secondary" @onclick="@(()=> context.Dialog.Hide("no"))">No</button>
32-
</DialogFooter>
33-
</DialogInputProvider>
34-
</Dialog>
35-
3623
<Dialog Id="simple-large-dialog" Size="size" Centered="isCentered" Animation="animation">
3724
<DialogInputProvider TInput="string">
3825
<DialogHeader ShowClose="true">
@@ -60,6 +47,22 @@
6047
</DialogInputProvider>
6148
</Dialog>
6249

50+
<Dialog Id="simple-dialog" Size="size" Centered="isCentered" Animation="animation">
51+
<DialogInputProvider TInput="string">
52+
<DialogBody>
53+
<h4>@context.Input</h4>
54+
</DialogBody>
55+
<DialogFooter>
56+
<button type="button" class="btn btn-primary" @onclick="@(() => context.Dialog.Hide("yes"))">Yes</button>
57+
<button type="button" class="btn btn-secondary" @onclick="@(()=> context.Dialog.Hide("no"))">No</button>
58+
59+
<button @onclick="SimpleDialogBigOnClick">Simple Dialog Big (dialog in dialog)</button>
60+
</DialogFooter>
61+
</DialogInputProvider>
62+
</Dialog>
63+
64+
65+
6366
<button @onclick="SimpleDialogOnClick">Simple Dialog</button>
6467
<button @onclick="SimpleDialogBigOnClick">Simple Dialog Big</button>
6568

0 commit comments

Comments
 (0)