ant-design-blazor/components/modal/modalDialog/ModalContainer.razor
zxyao ef4701b6ed refactor(module: modal): refactor the code of Modal, Confirm (#914)
* 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
2020-12-26 21:39:04 +08:00

114 lines
4.3 KiB
C#

@*@namespace AntDesign
@inherits AntDomComponentBase
@foreach (ModalRef modalRef in _modalRefs)
{
var options = modalRef.Config;
<Modal @key="@options"
AfterClose="@options.AfterClose"
BodyStyle="@options.BodyStyle"
CancelText="@options.CancelText"
Centered="@options.Centered"
Closable="@options.Closable"
Draggable="@options.Draggable"
DragInViewport="@options.DragInViewport"
CloseIcon="@options.CloseIcon"
ConfirmLoading="@options.ConfirmLoading"
DestroyOnClose="@options.DestroyOnClose"
Footer="@options.Footer"
Keyboard="@options.Keyboard"
Mask="@options.Mask"
MaskClosable="@options.MaskClosable"
MaskStyle="@options.MaskStyle"
OkText="@options.OkText"
OkType="@options.OkType"
Title="@options.Title"
TitleTemplate="@options.TitleTemplate"
Visible="@options.Visible"
Width="@options.Width"
WrapClassName="@options.WrapClassName"
ZIndex="@options.ZIndex"
OnCancel="@options.OnCancel"
OnOk="@options.OnOk"
OkButtonProps="@options.OkButtonProps"
CancelButtonProps="@options.CancelButtonProps"
>
@options.Content
</Modal>
}*@
@namespace AntDesign
@inherits AntDomComponentBase
@foreach (ModalRef modalRef in _modalRefs)
{
var options = modalRef.Config;
if (options.TitleTemplate != null)
{
<Modal @key="@options"
AfterClose="@options.AfterClose"
BodyStyle="@options.BodyStyle"
CancelText="@options.CancelText"
Centered="@options.Centered"
Closable="@options.Closable"
Draggable="@options.Draggable"
DragInViewport="@options.DragInViewport"
CloseIcon="@options.CloseIcon"
ConfirmLoading="@options.ConfirmLoading"
DestroyOnClose="@options.DestroyOnClose"
Footer="@options.Footer"
GetContainer="@options.GetContainer"
Keyboard="@options.Keyboard"
Mask="@options.Mask"
MaskClosable="@options.MaskClosable"
MaskStyle="@options.MaskStyle"
OkText="@options.OkText"
OkType="@options.OkType"
TitleTemplate="@options.TitleTemplate"
Visible="@options.Visible"
Width="@options.Width"
WrapClassName="@options.WrapClassName"
ZIndex="@options.ZIndex"
OnCancel="@options.OnCancel"
OnOk="@options.OnOk"
OkButtonProps="@options.OkButtonProps"
CancelButtonProps="@options.CancelButtonProps">
@options.Content
</Modal>
}
else
{
<Modal @key="@options"
AfterClose="@options.AfterClose"
BodyStyle="@options.BodyStyle"
CancelText="@options.CancelText"
Centered="@options.Centered"
Closable="@options.Closable"
Draggable="@options.Draggable"
DragInViewport="@options.DragInViewport"
CloseIcon="@options.CloseIcon"
ConfirmLoading="@options.ConfirmLoading"
DestroyOnClose="@options.DestroyOnClose"
Footer="@options.Footer"
GetContainer="@options.GetContainer"
Keyboard="@options.Keyboard"
Mask="@options.Mask"
MaskClosable="@options.MaskClosable"
MaskStyle="@options.MaskStyle"
OkText="@options.OkText"
OkType="@options.OkType"
Title="@options.Title"
Visible="@options.Visible"
Width="@options.Width"
WrapClassName="@options.WrapClassName"
ZIndex="@options.ZIndex"
OnCancel="@options.OnCancel"
OnOk="@options.OnOk"
OkButtonProps="@options.OkButtonProps"
CancelButtonProps="@options.CancelButtonProps">
@options.Content
</Modal>
}
}