ant-design-blazor/components/modal/core/Dialog.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

71 lines
2.9 KiB
C#

@namespace AntDesign
@inherits AntDomComponentBase
<div @ref="@_element">
<div class="ant-modal-root">
@if (Config.Mask)
{
<div class="ant-modal-mask @GetMaskClsName()" style="@Config.MaskStyle"></div>
}
<div tabindex="-1" class="ant-modal-wrap @Config.GetWrapClassNameExtended()" role="dialog" aria-labelledby="rcDialogTitle0"
@onclick="@OnMaskClick"
@onkeydown="@OnKeyDown"
style="@_wrapStyle">
<div @ref="@_modal" role="document" class="ant-modal @GetModalClsName()"
@onmousedown="@OnDialogMouseDown"
style="@GetStyle()">
<div id="@_sentinelStart" tabindex="0" aria-hidden="true" style="width: 0px; height: 0px; overflow: hidden; outline: none;"></div>
<div class="ant-modal-content">
@if (Config.Closable)
{
<button type="button" aria-label="Close" class="ant-modal-close" @onclick="@OnCloserClick">
<span class="ant-modal-close-x">
<span role="img" aria-label="close" class="anticon anticon-close ant-modal-close-icon">
@Config.CloseIcon
</span>
</span>
</button>
}
@if (Config.TitleTemplate != null)
{
<div @ref="@_dialogHeader" class="ant-modal-header" style="@Config.GetHeaderStyle()">
<div class="ant-modal-title" id="rcDialogTitle0">
@Config.TitleTemplate
</div>
</div>
}
else if (!string.IsNullOrWhiteSpace(Config.Title))
{
<div @ref="@_dialogHeader" class="ant-modal-header" style="@Config.GetHeaderStyle()">
<div class="ant-modal-title" id="rcDialogTitle0">
@Config.Title
</div>
</div>
}
<div class="ant-modal-body" style="@Config.BodyStyle">
@ChildContent
</div>
@if (Config.Footer != null)
{
<div class="ant-modal-footer">
<CascadingValue Value="@Config">
@if (Config.Footer.Value.IsT0)
{
@(Config.Footer.Value.AsT0)
}
else
{
@(Config.Footer.Value.AsT1)
}
</CascadingValue>
</div>
}
</div>
<div id="@_sentinelEnd" tabindex="0" aria-hidden="true" style="width: 0px; height: 0px; overflow: hidden; outline: none;"></div>
</div>
</div>
</div>
</div>