ant-design-blazor/components/dropdown/Dropdown.razor.cs
Andrzej Bakun 4cac27f887 fix(module: dropdown): dropdown button missing properties & docs fix for Dropdown & Button (#1609)
* fix:fix(module:dropdownbutton): add regular button behaviors and properties

* fix(module:button): add text type & docs

* docs(module:dropdown): version correction

* fix(module:overlay): re-add IsButton parameter

* fix: add xml comment to public methods

* fix(module:overlay): add xml documentation

* fix(module:dropdown): chrome block button force

* fix(module:button): remove Search parameter

Co-authored-by: James Yeung <shunjiey@hotmail.com>
2021-06-09 17:51:24 +08:00

79 lines
2.0 KiB
C#

using System;
using System.Threading.Tasks;
using AntDesign.Internal;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
namespace AntDesign
{
public partial class Dropdown : OverlayTrigger
{
internal Func<RenderFragment, RenderFragment, RenderFragment> ButtonsRender { get; set; }
internal bool Block { get; set; }
private string _rightButtonIcon = "ellipsis";
private string _buttonSize = AntSizeLDSType.Default;
private bool _danger;
private bool _ghost;
private bool _isLoading;
private string _buttonTypeRight = ButtonType.Default;
private string _buttonTypeLeft = ButtonType.Default;
protected void ChangeRightButtonIcon(string icon)
{
_rightButtonIcon = icon;
StateHasChanged();
}
protected void ChangeButtonSize(string size)
{
_buttonSize = size;
StateHasChanged();
}
protected void ChangeButtonDanger(bool danger)
{
_danger = danger;
StateHasChanged();
}
protected void ChangeButtonGhost(bool ghost)
{
_ghost = ghost;
StateHasChanged();
}
protected void ChangeButtonLoading(bool isLoading)
{
_isLoading = isLoading;
StateHasChanged();
}
protected void ChangeButtonType((string LeftButton, string RightButton) type)
{
(_buttonTypeLeft, _buttonTypeRight) = type;
StateHasChanged();
}
/// <summary>
/// Handle the trigger click.
/// </summary>
/// <param name="args">MouseEventArgs</param>
/// <returns></returns>
public override async Task OnClickDiv(MouseEventArgs args)
{
if (!IsButton)
{
await OnTriggerClick();
await OnClick.InvokeAsync(args);
}
}
}
}