ant-design-blazor/components/modal/core/Dialog.razor
zxyao 8301230bda fix(module: modal): auto focus the ok button and remove the focus of the trigger button (#1838)
* fix: second opening of focus in modal fails if DestroyOnClose is false

* fix: confirm cannot get focus element

* fix: set ConfirmAutoFocusButton is OK

* fix: module ImagePreview cannot close on second click

* fix: blur active element when comfirm focus element is disabled
2021-08-28 15:28:50 +00:00

70 lines
3.4 KiB
C#

@namespace AntDesign
@inherits AntDomComponentBase
<div @ref="@_element">
<div class=@($"{Config.PrefixCls}-root")>
@if (Config.Mask)
{
<div class=@($"{Config.PrefixCls}-mask {GetMaskClsName()}") style="@Config.MaskStyle"></div>
}
<div tabindex="-1" id=@($"{Config.PrefixCls}-wrap_{DialogWrapperId}") class=@($"{Config.PrefixCls}-wrap {Config.GetWrapClassNameExtended()}") role="dialog"
@onclick="@EventUtil.AsNonRenderingEventHandler(OnMaskClick)"
@onmouseup="@EventUtil.AsNonRenderingEventHandler(OnMaskMouseUp)"
@onkeydown="@OnKeyDown"
style="@_wrapStyle">
<div @ref="@_modal" role="document" class=@($"{Config.PrefixCls} {GetModalClsName()}")
@onmousedown="@EventUtil.AsNonRenderingEventHandler(OnDialogMouseDown)"
style="@GetStyle()">
<div id="@_sentinelStart" tabindex="0" aria-hidden="true" style="width: 0px; height: 0px; overflow: hidden; outline: none;"></div>
<div class=@($"{Config.PrefixCls}-content")>
@if (Config.Closable)
{
<button type="button" aria-label="Close" class=@($"{Config.PrefixCls}-close") @onclick="@OnCloserClick">
<span class=@($"{Config.PrefixCls}-close-x")>
<span role="img" aria-label="close" class=@($"anticon anticon-close {Config.PrefixCls}-close-icon")>
@Config.CloseIcon
</span>
</span>
</button>
}
@if (Config.TitleTemplate != null)
{
<div @ref="@_dialogHeader" class=@($"{Config.PrefixCls}-header") style="@Config.GetHeaderStyle()">
<div class=@($"{Config.PrefixCls}-title")>
@Config.TitleTemplate
</div>
</div>
}
else if (!string.IsNullOrWhiteSpace(Config.Title))
{
<div @ref="@_dialogHeader" class=@($"{Config.PrefixCls}-header") style="@Config.GetHeaderStyle()">
<div class=@($"{Config.PrefixCls}-title")>
@Config.Title
</div>
</div>
}
<div class=@($"{Config.PrefixCls}-body") style="@Config.BodyStyle">
@ChildContent
</div>
@if (Config.Footer != null)
{
<div class=@($"{Config.PrefixCls}-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>