Fix periodo x grafica più responsive e possibilità traduzione labels
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
@page "/TestComponenti"
|
||||
@using EgwCoreLib.Utils
|
||||
@using static EgwCoreLib.Razor.Sorter
|
||||
|
||||
@inject NavigationManager NavMan
|
||||
@@ -196,6 +197,20 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="card">
|
||||
<div class="card-header"><h4>Test Periodo</h4></div>
|
||||
<div class="card-body small">
|
||||
<h5>standard</h5>
|
||||
<PeriodoSel></PeriodoSel>
|
||||
<h5>custom</h5>
|
||||
<PeriodoSel DictSelect="@CustomSelDict"></PeriodoSel>
|
||||
<div class="condensed">
|
||||
<PeriodoSel DictSelect="@CustomSelDict"></PeriodoSel>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
@@ -287,7 +302,28 @@
|
||||
Tooltip = $"Switch {i:00}"
|
||||
});
|
||||
}
|
||||
|
||||
// preparo sel periodo custom (es traduzioni)...
|
||||
CustomSelDict = Enum.GetValues(typeof(DtUtils.PeriodSet))
|
||||
.Cast<DtUtils.PeriodSet>()
|
||||
.ToDictionary(e => e, e => Traduci(e.ToString()));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Mockup traduzione termini
|
||||
/// </summary>
|
||||
/// <param name="lemma"></param>
|
||||
/// <returns></returns>
|
||||
private string Traduci(string lemma)
|
||||
{
|
||||
return $"IT | {lemma}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Periodo custom selezione valori
|
||||
/// </summary>
|
||||
private Dictionary<DtUtils.PeriodSet, string>? CustomSelDict = new();
|
||||
|
||||
async void LocationChanged(object sender, LocationChangedEventArgs e)
|
||||
{
|
||||
qsNome = NavMan.ExtractQueryStringByKey<string>("Nome");
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
@using EgwCoreLib.Utils;
|
||||
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">Periodo</span>
|
||||
<span class="input-group-text">@PeriodoLabel</span>
|
||||
<input type="date" class="form-control" @bind-value="@Inizio">
|
||||
<input type="date" class="form-control" @bind-value="@Fine">
|
||||
<select @bind="@PerSelect" class="form-select form-select-sm">
|
||||
@foreach (var item in periodList)
|
||||
<select @bind="@PerSelect" class="form-select form-select-sm bg-opacity-10 flex-grow-0 w-auto ps-2">
|
||||
@foreach (var item in DictSelect ?? new())
|
||||
{
|
||||
<option value="@item">@item</option>
|
||||
<option value="@item.Key">@item.Value</option>
|
||||
|
||||
}
|
||||
</select>
|
||||
<span class="input-group-text"><i class="far fa-calendar-alt"></i></span>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -7,13 +7,6 @@ namespace EgwCoreLib.Razor
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<DtUtils.Periodo> E_PeriodoSel { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Parameter]
|
||||
public DtUtils.Periodo CurrPeriodo
|
||||
{
|
||||
@@ -28,7 +21,43 @@ namespace EgwCoreLib.Razor
|
||||
}
|
||||
}
|
||||
|
||||
protected DateTime Fine
|
||||
[Parameter]
|
||||
public Dictionary<DtUtils.PeriodSet, string>? DictSelect { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<DtUtils.Periodo> E_PeriodoSel { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string PeriodoLabel { get; set; } = "Periodo";
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await E_PeriodoSel.InvokeAsync(CurrPeriodo);
|
||||
}
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
// se fosse vuoto il dizionario lo preparo...
|
||||
if (DictSelect == null || DictSelect.Count == 0)
|
||||
{
|
||||
// inizializzo!
|
||||
DictSelect = Enum.GetValues(typeof(DtUtils.PeriodSet))
|
||||
.Cast<DtUtils.PeriodSet>()
|
||||
.ToDictionary(e => e, e => $"{e}");
|
||||
}
|
||||
|
||||
}
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private DtUtils.Periodo currPeriodo { get; set; } = new DtUtils.Periodo();
|
||||
|
||||
private DateTime Fine
|
||||
{
|
||||
get => CurrPeriodo.Fine;
|
||||
set
|
||||
@@ -42,7 +71,7 @@ namespace EgwCoreLib.Razor
|
||||
}
|
||||
}
|
||||
|
||||
protected DateTime Inizio
|
||||
private DateTime Inizio
|
||||
{
|
||||
get => CurrPeriodo.Inizio;
|
||||
set
|
||||
@@ -56,9 +85,13 @@ namespace EgwCoreLib.Razor
|
||||
}
|
||||
}
|
||||
|
||||
protected List<string> periodList { get => Enum.GetNames(typeof(DtUtils.PeriodSet)).ToList(); }
|
||||
#if false
|
||||
private List<string> periodList { get => Enum.GetNames(typeof(DtUtils.PeriodSet)).ToList(); }
|
||||
#endif
|
||||
|
||||
protected string PerSelect
|
||||
private string perSelect { get; set; } = "Select";
|
||||
|
||||
private string PerSelect
|
||||
{
|
||||
get => perSelect;
|
||||
set
|
||||
@@ -73,22 +106,6 @@ namespace EgwCoreLib.Razor
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await E_PeriodoSel.InvokeAsync(CurrPeriodo);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private DtUtils.Periodo currPeriodo { get; set; } = new DtUtils.Periodo();
|
||||
private string perSelect { get; set; } = "Select";
|
||||
|
||||
#endregion Private Properties
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user