de7e742731
- aggiunta nuova path e rename
119 lines
3.0 KiB
C#
119 lines
3.0 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
|
|
namespace EgwCoreLib.Razor
|
|
{
|
|
/// <summary>
|
|
/// Gestione display Toast con Bootstrap 5+
|
|
///
|
|
/// https://getbootstrap.com/docs/5.2/components/toasts/
|
|
/// </summary>
|
|
public partial class ToastDisplay
|
|
{
|
|
#region Public Enums
|
|
|
|
public enum DispPosition
|
|
{
|
|
none = 0,
|
|
topLeft,
|
|
topCenter,
|
|
topRight,
|
|
midLeft,
|
|
midCenter,
|
|
midRight,
|
|
bottomLeft,
|
|
bottomCenter,
|
|
bottomRight
|
|
}
|
|
|
|
#endregion Public Enums
|
|
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public RenderFragment? ChildContent { get; set; }
|
|
|
|
[Parameter]
|
|
public DispPosition currPosition { get; set; } = DispPosition.none;
|
|
|
|
[Parameter]
|
|
public bool DoShow { get; set; } = false;
|
|
|
|
[Parameter]
|
|
public EventCallback<bool> ReportClose { get; set; }
|
|
|
|
[Parameter]
|
|
public string TitleDx { get; set; } = "";
|
|
|
|
[Parameter]
|
|
public string TitleSx { get; set; } = "";
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected async Task doClose()
|
|
{
|
|
await ReportClose.InvokeAsync(true);
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Properties
|
|
|
|
private string cssPosition
|
|
{
|
|
get
|
|
{
|
|
string answ = "";
|
|
switch (currPosition)
|
|
{
|
|
case DispPosition.topLeft:
|
|
answ = "top-0 start-0";
|
|
break;
|
|
|
|
case DispPosition.topCenter:
|
|
answ = "top-0 start-50 translate-middle-x";
|
|
break;
|
|
|
|
case DispPosition.topRight:
|
|
answ = "top-0 end-0";
|
|
break;
|
|
|
|
case DispPosition.midLeft:
|
|
answ = "top-50 start-0 translate-middle-y";
|
|
break;
|
|
|
|
case DispPosition.midCenter:
|
|
answ = "top-50 start-50 translate-middle";
|
|
break;
|
|
|
|
case DispPosition.midRight:
|
|
answ = "top-50 end-0 translate-middle-y";
|
|
break;
|
|
|
|
case DispPosition.bottomLeft:
|
|
answ = "bottom-0 start-0";
|
|
break;
|
|
|
|
case DispPosition.bottomCenter:
|
|
answ = "bottom-0 start-50 translate-middle-x";
|
|
break;
|
|
|
|
case DispPosition.bottomRight:
|
|
answ = "bottom-0 end-0";
|
|
break;
|
|
|
|
case DispPosition.none:
|
|
default:
|
|
break;
|
|
}
|
|
|
|
return answ;
|
|
}
|
|
}
|
|
|
|
private string toastCss { get => DoShow ? "show" : ""; }
|
|
|
|
#endregion Private Properties
|
|
}
|
|
} |