118 lines
3.1 KiB
C#
118 lines
3.1 KiB
C#
using IOB_MAN.Core.DTO;
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
namespace IOB_MAN.Components.Compo
|
|
{
|
|
public partial class DataParetoTable
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public string CompoHeight { get; set; } = "300px";
|
|
|
|
[Parameter]
|
|
public EventCallback<string> EC_RecordSel { get; set; }
|
|
|
|
[Parameter]
|
|
public bool EnableSelect { get; set; } = false;
|
|
|
|
[Parameter]
|
|
public List<FluxLogStatsDTO.ParetoVals> SearchRecords { get; set; } = null!;
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Protected Properties
|
|
|
|
protected List<FluxLogStatsDTO.ParetoVals> ListRecords { get; set; } = new List<FluxLogStatsDTO.ParetoVals>();
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected string CssBadge(FluxLogStatsDTO.ParetoVals currRec)
|
|
{
|
|
return currRec.Valore == currSelId ? "text-bg-dark" : "text-bg-primary";
|
|
}
|
|
|
|
protected string CssCheckSelect(FluxLogStatsDTO.ParetoVals currRec)
|
|
{
|
|
return currRec.Valore == currSelId ? "active" : "";
|
|
}
|
|
|
|
protected override void OnParametersSet()
|
|
{
|
|
if (!Equals(searchRecords, SearchRecords))
|
|
{
|
|
currSelId = "";
|
|
searchRecords = SearchRecords;
|
|
}
|
|
ForceReload();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Resetta selezione + evento
|
|
/// </summary>
|
|
/// <param name="recId"></param>
|
|
/// <returns></returns>
|
|
protected async Task ResetSel()
|
|
{
|
|
currSelId = "";
|
|
await EC_RecordSel.InvokeAsync("");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Solleva evento selezione record
|
|
/// </summary>
|
|
/// <param name="recId"></param>
|
|
/// <returns></returns>
|
|
protected async Task SelRecord(string recId)
|
|
{
|
|
currSelId = recId;
|
|
await EC_RecordSel.InvokeAsync(recId);
|
|
}
|
|
|
|
protected void SetNumRec(int newNum)
|
|
{
|
|
numRecord = newNum;
|
|
currPage = 1;
|
|
ForceReload();
|
|
}
|
|
|
|
protected void SetPage(int newNum)
|
|
{
|
|
currPage = newNum;
|
|
ForceReload();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private int currPage = 0;
|
|
private string currSelId = "";
|
|
private int numRecord = 10;
|
|
private int totalCount = 0;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Properties
|
|
|
|
private List<FluxLogStatsDTO.ParetoVals> searchRecords { get; set; } = new List<FluxLogStatsDTO.ParetoVals>();
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Private Methods
|
|
|
|
private void ForceReload()
|
|
{
|
|
totalCount = SearchRecords.Count;
|
|
ListRecords = SearchRecords
|
|
//.OrderByDescending(x => x.Freq)
|
|
.Skip(numRecord * (currPage - 1))
|
|
.Take(numRecord)
|
|
.ToList();
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |