mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-09 15:37:37 +08:00
ef4701b6ed
* refactor(module: modal): refactor the code of Modal, Confirm and Dialog refactor details: - Add DialogWrapper compontent to control the logic of dialog removal from DOM - Add the appropriate folders for Dialog, Modal, and Confirm - Remove methods with the same logic but different names in ConfirmService - Split Title into Title (string) and Titletemplate (renderfragment) - Add comments to code - Rename ConfirmDialog to Confirm - Specification of method name in ConfirmService - Adjust the time of throttle function for draggabe modal - Extract the common part of ModalOptions, ConfirmOptions and DialogOptions as DialogOptionsBase * refactor: move DefaultCloseIcon etc. static members to DialogOptionsBase * docs(module: modal): update docs * fix: dialog incorrect waiting * fix: pickup missing pr/7
127 lines
3.6 KiB
C#
127 lines
3.6 KiB
C#
// Licensed to the .NET Foundation under one or more agreements.
|
|
// The .NET Foundation licenses this file to you under the MIT license.
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.AspNetCore.Components.Web;
|
|
using OneOf;
|
|
|
|
namespace AntDesign
|
|
{
|
|
/// <summary>
|
|
/// ModalOptions, ConfirmOptions and DialogOptions base class
|
|
/// </summary>
|
|
public class DialogOptionsBase
|
|
{
|
|
#region static and const
|
|
|
|
internal const string PrefixCls = "ant-modal";
|
|
|
|
/// <summary>
|
|
/// default Dialog close icon
|
|
/// </summary>
|
|
internal static readonly RenderFragment DefaultCloseIcon = (builder) =>
|
|
{
|
|
builder.OpenComponent<Icon>(0);
|
|
builder.AddAttribute(1, "Type", "close");
|
|
builder.AddAttribute(2, "Theme", "outline");
|
|
builder.CloseComponent();
|
|
};
|
|
|
|
/// <summary>
|
|
/// default modal footer
|
|
/// </summary>
|
|
internal static readonly RenderFragment DefaultFooter = (builder) =>
|
|
{
|
|
builder.OpenComponent<ModalFooter>(0);
|
|
builder.CloseComponent();
|
|
};
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// Cancel Button's props
|
|
/// </summary>
|
|
public ButtonProps CancelButtonProps { get; set; }
|
|
|
|
/// <summary>
|
|
/// modal default footer cancel text
|
|
/// </summary>
|
|
public OneOf<string, RenderFragment> CancelText { get; set; } = "Cancel";
|
|
|
|
/// <summary>
|
|
/// whether center display
|
|
/// </summary>
|
|
public bool Centered { get; set; }
|
|
|
|
/// <summary>
|
|
/// get or set the modal parent DOM
|
|
/// </summary>
|
|
public ElementReference? GetContainer { get; set; } = null;
|
|
|
|
/// <summary>
|
|
/// Whether support press esc to close
|
|
/// </summary>
|
|
public bool Keyboard { get; set; } = true;
|
|
|
|
/// <summary>
|
|
/// Whether show mask or not
|
|
/// </summary>
|
|
public bool Mask { get; set; } = true;
|
|
|
|
/// <summary>
|
|
/// Whether to close the modal dialog when the mask (area outside the modal) is clicked
|
|
/// </summary>
|
|
public bool MaskClosable { get; set; }
|
|
|
|
/// <summary>
|
|
/// Style for dialog's mask element
|
|
/// </summary>
|
|
public string MaskStyle { get; set; }
|
|
|
|
/// <summary>
|
|
/// Ok Button's props
|
|
/// </summary>
|
|
public ButtonProps OkButtonProps { get; set; }
|
|
|
|
/// <summary>
|
|
/// Text of the OK button
|
|
/// </summary>
|
|
public OneOf<string, RenderFragment> OkText { get; set; } = "OK";
|
|
|
|
/// <summary>
|
|
/// Button type of the OK button
|
|
/// </summary>
|
|
public string OkType { get; set; } = ButtonType.Primary;
|
|
|
|
/// <summary>
|
|
/// The modal dialog's title of String
|
|
/// </summary>
|
|
public string Title { get; set; } = null;
|
|
|
|
/// <summary>
|
|
/// The modal dialog's title of RenderFragment
|
|
/// </summary>
|
|
public RenderFragment TitleTemplate { get; set; }
|
|
|
|
/// <summary>
|
|
/// Width of the modal dialog
|
|
/// </summary>
|
|
public OneOf<string, double> Width { get; set; }
|
|
|
|
/// <summary>
|
|
/// The z-index of the Modal
|
|
/// </summary>
|
|
public int ZIndex { get; set; } = 1000;
|
|
|
|
/// <summary>
|
|
/// Is RTL
|
|
/// </summary>
|
|
public bool Rtl { get; set; } = false;
|
|
}
|
|
}
|