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.
|
|
|
|
// Copyright (c) MudBlazor 2021
|
|
|
|
|
// MudBlazor licenses this file to you under the MIT license.
|
|
|
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
|
|
|
|
|
|
namespace Connected.Components;
|
|
|
|
|
|
|
|
|
|
public class HeaderContext<T>
|
|
|
|
|
{
|
|
|
|
|
internal DataGrid<T> _dataGrid;
|
|
|
|
|
public IEnumerable<T> Items
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return _dataGrid.Items;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public HeaderActions Actions { get; internal set; }
|
|
|
|
|
public bool IsAllSelected
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (_dataGrid.Selection != null && Items != null)
|
|
|
|
|
{
|
|
|
|
|
return _dataGrid.Selection.Count == Items.Count();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public HeaderContext(DataGrid<T> dataGrid)
|
|
|
|
|
{
|
|
|
|
|
_dataGrid = dataGrid;
|
|
|
|
|
Actions = new HeaderContext<T>.HeaderActions
|
|
|
|
|
{
|
|
|
|
|
SetSelectAll = async (x) => await _dataGrid.SetSelectAllAsync(x),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class HeaderActions
|
|
|
|
|
{
|
|
|
|
|
public Action<bool> SetSelectAll { get; internal set; }
|
|
|
|
|
}
|
|
|
|
|
}
|