ant-design-blazor/components/modal/core/Dialog.razor
zxyao 234dcc93e7 feat(module: image): add animation for image preview (#1042)
* feat(module image): add animation for image preview

* feat(module image): add mask closeable

* fix(module dialog): cannot close dialog by clicking mask

if content is clicked, mask click cannot close dialog
2021-01-27 13:23:15 +08:00

70 lines
3.3 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="@OnMaskClick"
@onmouseup="@OnMaskMouseUp"
@onkeydown="@OnKeyDown"
style="@_wrapStyle">
<div @ref="@_modal" role="document" class=@($"{Config.PrefixCls} {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=@($"{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>