You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
2.2 KiB
66 lines
2.2 KiB
@namespace Connected.Components
|
|
@using Connected.Annotations;
|
|
@using Connected.Utilities;
|
|
|
|
<div class="mud-treeview-item-arrow">
|
|
@if (Visible)
|
|
{
|
|
<IconButton OnClick="@ToggleAsync" Icon="@(Loading ? LoadingIcon : ExpandedIcon)" Color="@(Loading ? LoadingIconColor : ExpandedIconColor)" Class="@Classname"></IconButton>
|
|
}
|
|
</div>
|
|
|
|
@code {
|
|
protected string Classname =>
|
|
new CssBuilder()
|
|
.AddClass("mud-treeview-item-arrow-expand mud-transform", Expanded && !Loading)
|
|
.AddClass("mud-treeview-item-arrow-load", Loading)
|
|
.Build();
|
|
|
|
/// <summary>
|
|
/// If true, displays the button.
|
|
/// </summary>
|
|
[Parameter] [Category(CategoryTypes.TreeView.Behavior)] public bool Visible { get; set; }
|
|
|
|
/// <summary>
|
|
/// Determens when to flip the expanded icon.
|
|
/// </summary>
|
|
[Parameter] [Category(CategoryTypes.TreeView.Behavior)] public bool Expanded { get; set; }
|
|
|
|
/// <summary>
|
|
/// If true, displays the loading icon.
|
|
/// </summary>
|
|
[Parameter] [Category(CategoryTypes.TreeView.Behavior)] public bool Loading { get; set; }
|
|
|
|
/// <summary>
|
|
/// Called whenever expanded changed.
|
|
/// </summary>
|
|
[Parameter] public EventCallback<bool> ExpandedChanged { get; set; }
|
|
|
|
/// <summary>
|
|
/// The loading icon.
|
|
/// </summary>
|
|
[Parameter] [Category(CategoryTypes.TreeView.Appearance)] public string LoadingIcon { get; set; } = Icons.Material.Filled.Loop;
|
|
|
|
/// <summary>
|
|
/// The color of the loading. It supports the theme colors.
|
|
/// </summary>
|
|
[Parameter] [Category(CategoryTypes.TreeView.Appearance)] public ThemeColor LoadingIconColor { get; set; } = ThemeColor.Default;
|
|
|
|
/// <summary>
|
|
/// The expand/collapse icon.
|
|
/// </summary>
|
|
[Parameter] [Category(CategoryTypes.TreeView.Appearance)] public string ExpandedIcon { get; set; } = Icons.Material.Filled.ChevronRight;
|
|
|
|
/// <summary>
|
|
/// The color of the expand/collapse. It supports the theme colors.
|
|
/// </summary>
|
|
[Parameter] [Category(CategoryTypes.TreeView.Appearance)] public ThemeColor ExpandedIconColor { get; set; } = ThemeColor.Default;
|
|
|
|
|
|
private Task ToggleAsync()
|
|
{
|
|
Expanded = !Expanded;
|
|
return ExpandedChanged.InvokeAsync(Expanded);
|
|
}
|
|
}
|