2019-12-16 15:48:31 +08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
|
|
|
|
|
|
namespace AntBlazor
|
|
|
|
|
{
|
2020-04-23 17:13:56 +08:00
|
|
|
|
public partial class AntButtonGroup : AntDomComponentBase
|
2019-12-16 15:48:31 +08:00
|
|
|
|
{
|
|
|
|
|
[Parameter] public RenderFragment ChildContent { get; set; }
|
|
|
|
|
|
|
|
|
|
private string _size;
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
2020-04-23 17:13:56 +08:00
|
|
|
|
public string Size
|
2019-12-16 15:48:31 +08:00
|
|
|
|
{
|
|
|
|
|
get => _size;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this._size = value;
|
|
|
|
|
SetClassMap();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-23 17:13:56 +08:00
|
|
|
|
public IList<AntButton> _buttons = new List<AntButton>();
|
2019-12-16 15:48:31 +08:00
|
|
|
|
|
2020-04-23 17:13:56 +08:00
|
|
|
|
internal bool _isInDropdown = false;
|
2019-12-16 15:48:31 +08:00
|
|
|
|
|
|
|
|
|
public void SetClassMap()
|
|
|
|
|
{
|
|
|
|
|
var prefixName = "ant-btn-group";
|
|
|
|
|
ClassMapper.Clear().Add(prefixName)
|
2020-04-23 17:13:56 +08:00
|
|
|
|
.If("ant-dropdown-button", () => _isInDropdown)
|
2019-12-16 15:48:31 +08:00
|
|
|
|
.If($"{prefixName}-lg", () => this._size == "large")
|
|
|
|
|
.If($"{prefixName}-sm", () => this._size == "small");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnInitialized()
|
|
|
|
|
{
|
|
|
|
|
base.OnInitialized();
|
|
|
|
|
SetClassMap();
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-04-23 17:13:56 +08:00
|
|
|
|
}
|