ant-design-blazor/components/modal/core/Dialog.razor

70 lines
3.4 KiB
C#
Raw Normal View History

@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>