|
|
@ -1,5 +1,5 @@
|
|
|
|
using Connected.Models.Modal;
|
|
|
|
using Connected.Models.Modal;
|
|
|
|
using Connected.Services.Modal;
|
|
|
|
using Connected.Services;
|
|
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
using Microsoft.AspNetCore.Components.Web;
|
|
|
|
using Microsoft.AspNetCore.Components.Web;
|
|
|
|
|
|
|
|
|
|
|
@ -19,7 +19,6 @@ public partial class ModalDialog : IDisposable
|
|
|
|
protected ModalOptions? ModalOptions { get; set; }
|
|
|
|
protected ModalOptions? ModalOptions { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected override void OnInitialized()
|
|
|
|
protected override void OnInitialized()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ModalService.OnShow += ShowModal;
|
|
|
|
ModalService.OnShow += ShowModal;
|
|
|
@ -51,15 +50,23 @@ public partial class ModalDialog : IDisposable
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (button.CloseDialogOnClick)
|
|
|
|
if (button.CloseDialogOnClick)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
IsVisible = false;
|
|
|
|
CloseModal();
|
|
|
|
Title = "";
|
|
|
|
|
|
|
|
Content = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
button.OnClickEvent.Delegate.DynamicInvoke(button.OnClickEvent.args);
|
|
|
|
button.OnClickEvent.Delegate.DynamicInvoke(button.OnClickEvent.args);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
StateHasChanged();
|
|
|
|
StateHasChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void CloseModal()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
IsVisible = false;
|
|
|
|
|
|
|
|
Title = "";
|
|
|
|
|
|
|
|
Content = null;
|
|
|
|
|
|
|
|
StateHasChanged();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
public void Dispose()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (ModalService is not null)
|
|
|
|
if (ModalService is not null)
|
|
|
@ -71,12 +78,12 @@ public partial class ModalDialog : IDisposable
|
|
|
|
|
|
|
|
|
|
|
|
public void CheckEscape(KeyboardEventArgs args)
|
|
|
|
public void CheckEscape(KeyboardEventArgs args)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (ModalOptions.CloseOnEscKey)
|
|
|
|
if (!ModalOptions.DisableEscKey)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var key = args.Key.ToLower();
|
|
|
|
var key = args.Key.ToLower();
|
|
|
|
if (key.Equals("escape"))
|
|
|
|
if (key.Equals("escape"))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CloseModal(null);
|
|
|
|
CloseModal();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -87,7 +94,7 @@ public partial class ModalDialog : IDisposable
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (OverlayClickToClose)
|
|
|
|
if (OverlayClickToClose)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CloseModal(null);
|
|
|
|
CloseModal();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
OverlayClickToClose = true;
|
|
|
|
OverlayClickToClose = true;
|
|
|
|