2021-10-28 11:21:10 +08:00
|
|
|
|
// Licensed to the .NET Foundation under one or more agreements.
|
|
|
|
|
// The .NET Foundation licenses this file to you under the MIT license.
|
|
|
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
|
|
2019-12-16 15:48:31 +08:00
|
|
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
|
|
2020-05-29 00:33:49 +08:00
|
|
|
|
namespace AntDesign
|
2019-12-16 15:48:31 +08:00
|
|
|
|
{
|
2020-05-29 12:55:15 +08:00
|
|
|
|
public partial class ButtonGroup : 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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-24 18:32:50 +08:00
|
|
|
|
private readonly bool _isInDropdown = false;
|
2019-12-16 15:48:31 +08:00
|
|
|
|
|
2020-04-24 18:32:50 +08:00
|
|
|
|
private void SetClassMap()
|
2019-12-16 15:48:31 +08:00
|
|
|
|
{
|
2020-04-24 18:32:50 +08:00
|
|
|
|
string prefixName = "ant-btn-group";
|
2021-03-12 17:02:11 +08:00
|
|
|
|
ClassMapper.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")
|
2021-03-12 17:02:11 +08:00
|
|
|
|
.If($"{prefixName}-sm", () => this._size == "small")
|
|
|
|
|
.If($"{prefixName}-rtl", () => RTL);
|
2019-12-16 15:48:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnInitialized()
|
|
|
|
|
{
|
|
|
|
|
base.OnInitialized();
|
|
|
|
|
SetClassMap();
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-04-23 17:13:56 +08:00
|
|
|
|
}
|