mirror of
https://github.com/radzenhq/radzen-blazor.git
synced 2026-07-08 18:16:08 +00:00
* accessibility issues fixes Various localizable accessibility related properties added tests updated side dialog close button id fixed more accessibility improvements tests fixed more accessibility fixes missing ARIA attributes added * Add rz-hidden-accessible styles * Update RadzenRating styles * RadzenSwitch fixed * RadzenFabMenu fixed * tests updated * Update expand/collapse button styles in RadzenDataGrid * Fix responsive pager styles --------- Co-authored-by: yordanov <vasil@yordanov.info>
119 lines
3.3 KiB
C#
119 lines
3.3 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.AspNetCore.Components.Web;
|
|
using Radzen.Blazor.Rendering;
|
|
using System;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Radzen.Blazor
|
|
{
|
|
/// <summary>
|
|
/// RadzenSplitButtonItem component.
|
|
/// </summary>
|
|
public partial class RadzenSplitButtonItem : RadzenComponent
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the text.
|
|
/// </summary>
|
|
/// <value>The text.</value>
|
|
[Parameter]
|
|
public string Text { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Gets or sets the icon.
|
|
/// </summary>
|
|
/// <value>The icon.</value>
|
|
[Parameter]
|
|
public string? Icon { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the icon color.
|
|
/// </summary>
|
|
/// <value>The icon color.</value>
|
|
[Parameter]
|
|
public string? IconColor { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the value.
|
|
/// </summary>
|
|
/// <value>The value.</value>
|
|
[Parameter]
|
|
public string? Value { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets a value indicating whether this <see cref="RadzenSplitButtonItem"/> is disabled.
|
|
/// </summary>
|
|
/// <value><c>true</c> if disabled; otherwise, <c>false</c>.</value>
|
|
[Parameter]
|
|
public bool Disabled { get; set; }
|
|
|
|
RadzenSplitButton? _splitButton;
|
|
/// <summary>
|
|
/// Gets or sets the split button.
|
|
/// </summary>
|
|
/// <value>The split button.</value>
|
|
[CascadingParameter]
|
|
public RadzenSplitButton? SplitButton
|
|
{
|
|
get
|
|
{
|
|
return _splitButton;
|
|
}
|
|
set
|
|
{
|
|
if (_splitButton != value)
|
|
{
|
|
_splitButton = value;
|
|
_splitButton?.AddItem(this);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Handles the Click event.
|
|
/// </summary>
|
|
/// <param name="args">The <see cref="MouseEventArgs"/> instance containing the event data.</param>
|
|
public async System.Threading.Tasks.Task OnClick(MouseEventArgs args)
|
|
{
|
|
if (SplitButton != null && !Disabled)
|
|
{
|
|
SplitButton.Close();
|
|
await SplitButton.Click.InvokeAsync(this);
|
|
}
|
|
}
|
|
|
|
async Task OnKeyDown(KeyboardEventArgs args)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(args);
|
|
if (Disabled)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var key = args.Code != null ? args.Code : args.Key;
|
|
if (key == "Enter" || key == "Space")
|
|
{
|
|
await OnClick(new MouseEventArgs());
|
|
}
|
|
}
|
|
|
|
string ItemClass => ClassList.Create("rz-menuitem")
|
|
.AddDisabled(Disabled)
|
|
.Add("rz-state-highlight", SplitButton?.IsFocused(this) == true)
|
|
.ToString();
|
|
|
|
/// <inheritdoc />
|
|
public override void Dispose()
|
|
{
|
|
base.Dispose();
|
|
|
|
if (SplitButton != null)
|
|
{
|
|
SplitButton.RemoveItem(this);
|
|
}
|
|
|
|
GC.SuppressFinalize(this);
|
|
}
|
|
}
|
|
}
|