ant-design-blazor/components/modal/core/Dialog.razor
zxyao 4818d8b27b
feat(module: modal): support Maximizable (#2573)
* add maximizable button for Modal

* fix: patch.less

* export MaximizeBtnIcon and RestoreBtnIcon paramter

* refactor: fixed footer
2022-07-23 14:58:04 +08:00

89 lines
4.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" 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()}")
@onclick:stopPropagation
@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") id=@($"{Config.PrefixCls}-wrap_{DialogWrapperId}")>
@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.Maximizable)
{
<button type="button" aria-label="Max" class=@($"{Config.PrefixCls}-max-btn") @onclick="@OnMaxBtnClick">
<span class=@($"{Config.PrefixCls}-max-btn-x")>
<span role="img" aria-label="close" class=@($"anticon anticon-max {Config.PrefixCls}-max-btn-icon")>
@if(_modalStatus == ModalStatus.Default)
{
@(Config.MaximizeBtnIcon)
}
else
{
@(Config.RestoreBtnIcon)
}
</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="@GetBodyStyle()">
@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>