Merge branch 'release/UpdateSorterComp_01'

This commit is contained in:
Samuele Locatelli
2025-01-15 08:58:56 +01:00
3 changed files with 73 additions and 29 deletions
@@ -1,4 +1,5 @@
@page "/TestComponenti"
@using static EgwCoreLib.Razor.Sorter
@inject NavigationManager NavMan
@implements IDisposable
@@ -129,27 +130,65 @@
</div>
</div>
<div class="col-3">
<div class="card ">
<div class="card">
<div class="card-header"><h4>Test toggler</h4></div>
<div class="card-body">
<Toggler SelFilter="@TogFilter"></Toggler>
<br/>
<br />
<NumInput Value="@numero"></NumInput>
</div>
</div>
</div>
<div class="col-3">
<span class="form-check form-switch">
<label class="form-check-label">Small Pager</label>
<input class="form-check-input" type="checkbox" @bind="@ShowSmallPager">
</span>
<div class="card">
<div class="card-header"><h4>Test switch pager</h4></div>
<div class="card-body">
<span class="form-check form-switch">
<label class="form-check-label">Small Pager</label>
<input class="form-check-input" type="checkbox" @bind="@ShowSmallPager">
</span>
</div>
</div>
</div>
<div class="col-3">
<div class="card">
<div class="card-header"><h4>Test Sorter</h4></div>
<div class="card-body">
<table class="table table-sm table-striped table-responsive-lg">
<thead>
<tr>
<th>
Col A
<Sorter ParamName="ColA" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter>
</th>
<th>
ColB
<Sorter ParamName="ColB" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter>
</th>
<th>
Col C
<Sorter ParamName="ColC" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>Sort param</td>
<td>@sortField</td>
<td>@sortAsc</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="card-footer">
@if(ShowSmallPager)
@if (ShowSmallPager)
{
<DataPager currPage="1" totalCount="@numero" NumPages="4" DisplSize="DataPager.ObjSize.small"></DataPager>
<DataPager currPage="1" totalCount="@numero" NumPages="4" DisplSize="DataPager.ObjSize.small"></DataPager>
}
else
{
@@ -170,6 +209,18 @@
private int qsIntero = -1;
private int numero = 0;
private bool sortAsc = false;
private string sortField = "";
protected void SortRequested(SortCallBack e)
{
if (sortField == e.ParamName)
{
sortAsc = e.IsAscending;
}
sortField = e.ParamName;
}
private bool ShowSmallPager { get; set; } = false;
protected Random rnd = new Random();
+1 -1
View File
@@ -1,5 +1,5 @@
<button class="btn btn-sm @cssStyle py-1" @onclick="() => sortAct()">
<i class="@CurrIcon"></i>
<i class="@currIcon"></i>
</button>
+13 -20
View File
@@ -53,6 +53,16 @@ namespace EgwCoreLib.Razor
#endregion Public Properties
/// <summary>
/// Sistemazione campi calcolati...
/// </summary>
protected override void OnParametersSet()
{
isCurrent=ParamName.Equals(CurrParam);
cssStyle= isCurrent ? "text-primary" : "text-secondary opacity-25";
currIcon = isCurrent ? (IsAsc ? SortAscCss : SortDescCss) : UnsortCss;
}
#region Public Classes
/// <summary>
@@ -73,28 +83,11 @@ namespace EgwCoreLib.Razor
#region Private Properties
private string cssStyle
{
get
{
return isCurrent ? "text-primary" : "text-secondary opacity-25";
}
}
private string cssStyle { get; set; } = "text-secondary";
private string CurrIcon
{
get
{
string answ = UnsortCss;
if (isCurrent)
{
answ = IsAsc ? SortAscCss : SortDescCss;
}
return answ;
}
}
private string currIcon { get; set; } = "";
private bool isCurrent { get => ParamName.Equals(CurrParam); }
private bool isCurrent { get; set; } = false;
#endregion Private Properties