@namespace Connected.Components
@inherits UIComponent
@typeparam T

<Column T="T" Tag="@("hierarchy-column")" Sortable="false" Resizable="false" ShowColumnOptions="false" HeaderStyle="width:0%" FieldType="@typeof(object)"
    Filterable="false">
    <CellTemplate>
        <label class="ma-n3">
            <IconButton
            Icon="@(context.openHierarchies.Contains(context.Item) ?  OpenIcon : ClosedIcon)" 
            OnClick="context.Actions.ToggleHierarchyVisibilityForItem"
            Size="@IconSize"
            Disabled="ButtonDisabledFunc.Invoke(context.Item)"/>
        </label>
    </CellTemplate>
</Column>

@code {
    [Parameter] public string ClosedIcon { get; set; } = Icons.Material.Filled.ChevronRight;
    [Parameter] public string OpenIcon { get; set; } = Icons.Material.Filled.ExpandMore;
    [Parameter] public Size IconSize { get; set; } = Size.Medium;
    [Parameter] public Func<T, bool> ButtonDisabledFunc { get; set; } = x => false;
}