2020-06-02 14:25:44 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
2020-06-23 15:19:44 +08:00
|
|
|
|
using System.Threading.Tasks;
|
2020-06-02 14:25:44 +08:00
|
|
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
|
using Microsoft.AspNetCore.Components.Web;
|
|
|
|
|
using OneOf;
|
|
|
|
|
|
|
|
|
|
namespace AntDesign
|
|
|
|
|
{
|
|
|
|
|
public class DialogOptions
|
|
|
|
|
{
|
|
|
|
|
internal const string PrefixCls = "ant-modal";
|
|
|
|
|
|
2020-06-23 15:19:44 +08:00
|
|
|
|
public Func<Task> OnClosed { get; set; }
|
2020-06-02 14:25:44 +08:00
|
|
|
|
|
|
|
|
|
public string BodyStyle { get; set; }
|
|
|
|
|
|
|
|
|
|
public OneOf<string, RenderFragment> CancelText { get; set; } = "Cancel";
|
|
|
|
|
|
|
|
|
|
public bool Centered { get; set; }
|
|
|
|
|
|
|
|
|
|
public bool Closable { get; set; } = true;
|
|
|
|
|
|
|
|
|
|
private static readonly RenderFragment _defaultCloseIcon = (builder) =>
|
|
|
|
|
{
|
2020-06-07 19:41:00 +08:00
|
|
|
|
builder.OpenComponent<Icon>(0);
|
2020-06-11 23:17:26 +08:00
|
|
|
|
builder.AddAttribute(1, "Type", "close");
|
|
|
|
|
builder.AddAttribute(2, "Theme", "outline");
|
2020-06-02 14:25:44 +08:00
|
|
|
|
builder.CloseComponent();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public RenderFragment? CloseIcon { get; set; } = _defaultCloseIcon;
|
|
|
|
|
|
|
|
|
|
public bool ConfirmLoading { get; set; }
|
|
|
|
|
|
|
|
|
|
public bool DestroyOnClose { get; set; }
|
|
|
|
|
|
2020-06-11 23:17:26 +08:00
|
|
|
|
private static readonly RenderFragment _defaultFooter = (builder) =>
|
2020-06-02 14:25:44 +08:00
|
|
|
|
{
|
|
|
|
|
builder.OpenComponent<ModalFooter>(0);
|
|
|
|
|
builder.CloseComponent();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public OneOf<string, RenderFragment>? Footer { get; set; } = _defaultFooter;
|
|
|
|
|
|
|
|
|
|
public bool ForceRender { get; set; }
|
|
|
|
|
|
|
|
|
|
public ElementReference? GetContainer { get; set; } = null;
|
|
|
|
|
|
|
|
|
|
public bool Keyboard { get; set; } = true;
|
|
|
|
|
public bool Mask { get; set; } = true;
|
|
|
|
|
public bool MaskClosable { get; set; } = true;
|
|
|
|
|
|
|
|
|
|
public string MaskStyle { get; set; }
|
|
|
|
|
|
|
|
|
|
public OneOf<string, RenderFragment> OkText { get; set; } = "OK";
|
|
|
|
|
|
|
|
|
|
public string OkType { get; set; } = ButtonType.Primary;
|
|
|
|
|
|
2020-06-11 23:17:26 +08:00
|
|
|
|
public OneOf<string, RenderFragment>? Title { get; set; } = null;
|
2020-06-02 14:25:44 +08:00
|
|
|
|
|
|
|
|
|
public OneOf<string, double> Width { get; set; } = 520;
|
|
|
|
|
|
|
|
|
|
internal string GetWidth()
|
|
|
|
|
{
|
|
|
|
|
if (Width.IsT0)
|
|
|
|
|
{
|
|
|
|
|
return $"width:{Width.AsT0};";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return $"width:{Width.AsT1}px;";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string WrapClassName { get; set; }
|
|
|
|
|
|
|
|
|
|
public int ZIndex { get; set; } = 1000;
|
|
|
|
|
|
2020-06-23 15:19:44 +08:00
|
|
|
|
public Func<MouseEventArgs, Task> OnCancel { get; set; }
|
2020-06-02 14:25:44 +08:00
|
|
|
|
|
2020-06-23 15:19:44 +08:00
|
|
|
|
public Func<MouseEventArgs, Task> OnOk { get; set; }
|
2020-06-02 14:25:44 +08:00
|
|
|
|
|
|
|
|
|
public ButtonProps OkButtonProps { get; set; }
|
|
|
|
|
|
|
|
|
|
public ButtonProps CancelButtonProps { get; set; }
|
|
|
|
|
|
|
|
|
|
public RenderFragment ChildContent { get; set; }
|
|
|
|
|
|
|
|
|
|
public bool Rtl { get; set; } = false;
|
|
|
|
|
|
|
|
|
|
internal string GetWrapClassNameExtended()
|
|
|
|
|
{
|
|
|
|
|
var classNameArray = new List<string>();
|
|
|
|
|
if (Centered)
|
|
|
|
|
{
|
|
|
|
|
classNameArray.Add($"{PrefixCls}-centered");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Rtl)
|
|
|
|
|
{
|
|
|
|
|
classNameArray.Add($"{PrefixCls}-wrap-rtl");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return string.Join(' ', classNameArray);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string TransitionName { get; set; }
|
|
|
|
|
public string MaskTransitionName { get; set; }
|
|
|
|
|
|
|
|
|
|
public string ClassName { get; set; }
|
|
|
|
|
}
|
|
|
|
|
}
|