@namespace Connected.Components
@using Connected.Annotations;
@using Connected.Utilities;
@if (Visible)
{
}
@code {
protected string Classname =>
new CssBuilder()
.AddClass("mud-treeview-item-arrow-expand mud-transform", Expanded && !Loading)
.AddClass("mud-treeview-item-arrow-load", Loading)
.Build();
///
/// If true, displays the button.
///
[Parameter] [Category(CategoryTypes.TreeView.Behavior)] public bool Visible { get; set; }
///
/// Determens when to flip the expanded icon.
///
[Parameter] [Category(CategoryTypes.TreeView.Behavior)] public bool Expanded { get; set; }
///
/// If true, displays the loading icon.
///
[Parameter] [Category(CategoryTypes.TreeView.Behavior)] public bool Loading { get; set; }
///
/// Called whenever expanded changed.
///
[Parameter] public EventCallback ExpandedChanged { get; set; }
///
/// The loading icon.
///
[Parameter] [Category(CategoryTypes.TreeView.Appearance)] public string LoadingIcon { get; set; } = Icons.Material.Filled.Loop;
///
/// The color of the loading. It supports the theme colors.
///
[Parameter] [Category(CategoryTypes.TreeView.Appearance)] public ThemeColor LoadingIconColor { get; set; } = ThemeColor.Default;
///
/// The expand/collapse icon.
///
[Parameter] [Category(CategoryTypes.TreeView.Appearance)] public string ExpandedIcon { get; set; } = Icons.Material.Filled.ChevronRight;
///
/// The color of the expand/collapse. It supports the theme colors.
///
[Parameter] [Category(CategoryTypes.TreeView.Appearance)] public ThemeColor ExpandedIconColor { get; set; } = ThemeColor.Default;
private Task ToggleAsync()
{
Expanded = !Expanded;
return ExpandedChanged.InvokeAsync(Expanded);
}
}