2020-05-29 00:33:49 +08:00
|
|
|
@namespace AntDesign
|
2019-12-18 16:57:00 +08:00
|
|
|
@inherits AntDomComponentBase
|
|
|
|
|
2020-04-23 17:13:56 +08:00
|
|
|
<span class="@ClassMapper.Class" style="@Style" id="@Id" @ref="Ref">
|
|
|
|
@if (Text != null || ChildContent != null)
|
2019-12-18 16:57:00 +08:00
|
|
|
{
|
|
|
|
<span class="ant-divider-inner-text">
|
2020-04-23 17:13:56 +08:00
|
|
|
@if (Text != null)
|
2019-12-18 16:57:00 +08:00
|
|
|
{
|
2020-04-23 17:13:56 +08:00
|
|
|
@Text
|
2019-12-18 16:57:00 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
@ChildContent
|
|
|
|
}
|
|
|
|
</span>
|
|
|
|
}
|
|
|
|
</span>
|
|
|
|
|
|
|
|
@code {
|
|
|
|
|
|
|
|
[Parameter] public RenderFragment ChildContent { get; set; }
|
|
|
|
|
|
|
|
|
2020-04-23 17:13:56 +08:00
|
|
|
[Parameter] public string Text { get; set; }
|
2019-12-18 16:57:00 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 'horizontal' | 'vertical'
|
|
|
|
/// </summary>
|
2020-04-23 17:13:56 +08:00
|
|
|
[Parameter] public string Type { get; set; } = "horizontal";
|
2019-12-18 16:57:00 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 'left' | 'right' | 'center'
|
|
|
|
/// </summary>
|
2020-04-23 17:13:56 +08:00
|
|
|
[Parameter] public string Orientation { get; set; } = "center";
|
2019-12-18 16:57:00 +08:00
|
|
|
|
2020-04-23 17:13:56 +08:00
|
|
|
[Parameter] public bool Dashed { get; set; } = false;
|
2019-12-18 16:57:00 +08:00
|
|
|
|
|
|
|
private void setClass()
|
|
|
|
{
|
|
|
|
ClassMapper.Clear()
|
|
|
|
.Add("ant-divider")
|
2020-04-23 17:13:56 +08:00
|
|
|
.Add($"ant-divider-{this.Type}")
|
|
|
|
.If($"ant-divider-with-text-{this.Orientation}", () => Text != null || ChildContent != null)
|
|
|
|
.If("ant-divider-dashed", () => Dashed)
|
2019-12-18 16:57:00 +08:00
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void OnParametersSet()
|
|
|
|
{
|
|
|
|
setClass();
|
|
|
|
base.OnParametersSet();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void OnInitialized()
|
|
|
|
{
|
|
|
|
setClass();
|
|
|
|
base.OnInitialized();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|