- Possibilità di nascondere figli multipli nella pagina con la gerarchia

- Gestione bottom rail del frame
This commit is contained in:
Annamaria Sassi
2026-02-10 12:17:00 +01:00
parent 3d092b53fb
commit a898ccced5
9 changed files with 377 additions and 63 deletions
+73 -38
View File
@@ -5,48 +5,83 @@
@for (int i = 0; i < ItemTableList.Count; i++)
{
<tr>
@for (int j = 0; j < maxCol; j++)
@for (int j = 0; j < maxCol - 1; j++)
{
CompileStep cs = CompileStep.Frame;
int ind = -1;
string s = "Vai a step ";
@if (j + 1 == ItemTableList[i].Col)
{
@if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.FRAME)
{
cs = CompileStep.Frame;
s = s + cs.ToString();
}
else if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.SPLIT)
{
cs = CompileStep.Split;
ind = ItemTableList[i].IndexItem;
s = s + cs.ToString() + ((ind + 1) > 0 ? (ind + 1): "");
}
else if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.SASH)
{
cs = CompileStep.Sash;
ind = ItemTableList[i].IndexItem;
s = s + cs.ToString() + ((ind + 1) > 0 ? (ind + 1) : "");
}
else if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.FILL)
{
cs = CompileStep.Fill;
ind = ItemTableList[i].IndexItem;
s = s + cs.ToString() + ((ind + 1) > 0 ? (ind + 1) : "");
}
<td>
<button class="btn btn-sm btn-secondary" style="font-size: 1rem;" @onclick="() => RaiseNextStep(cs, ind)" title="@(s)">@ItemTableList[i].Desc</button>
@* @if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.SASH ||
ItemTableList[i].Type is Json.WindowConst.AreaTypes.SPLIT)
{
<button class="btn btn-sm btn-secondary" style="font-size: 1rem;" @onclick="() => Remove(cs, ind)" title="Remove">Canc</button>
} *@
</td>
var index = RowCollapsedDict.Keys.Where(k => k <= i).LastOrDefault();
@if ((RowCollapsedDict.ContainsValue(true) && RowCollapsedDict.GetValueOrDefault(index))
&& i - 1 > 0 && ItemTableList.ElementAt(i).Col > ItemTableList.ElementAt(index-1).Col){
continue;
}
else
{
<td>@FillTable(i, j)</td>
CompileStep cs = CompileStep.Frame;
int row = i;
int ind = -1;
string s = "Vai a step ";
@if (j + 1 == ItemTableList[i].Col)
{
@if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.FRAME)
{
cs = CompileStep.Frame;
s = s + cs.ToString();
}
else if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.SPLIT)
{
cs = CompileStep.Split;
ind = ItemTableList[i].IndexItem;
s = s + cs.ToString() + ((ind + 1) > 0 ? (ind + 1): "");
}
else if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.SASH)
{
cs = CompileStep.Sash;
ind = ItemTableList[i].IndexItem;
s = s + cs.ToString() + ((ind + 1) > 0 ? (ind + 1) : "");
}
else if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.FILL)
{
cs = CompileStep.Fill;
ind = ItemTableList[i].IndexItem;
s = s + cs.ToString() + ((ind + 1) > 0 ? (ind + 1) : "");
}
<td>
<div class="d-flex flex-row align-items-center justify-content-center">
<div class="card text-center p-1 shadow-sm hover-shadow" >
<button class="btn btn-sm btn-rounded" @onclick="() => RaiseNextStep(cs, ind)" title="@(s)"
style="font-size: 1rem;">
@ItemTableList[i].Desc
</button>
</div>
@if (ItemTableList[row].NumChild > 4)
{
<div class="card border-light text-center">
<button class="btn btn-sm" @onclick="() => ChangeCollapsed(ItemTableList[row].Row)"
style="--bs-btn-padding-y: .25rem; --bs-btn-padding-x: .5rem; --bs-btn-font-size: .75rem;">
<i class="@hwIcon(ItemTableList[i].Row)" style="width:0.5rem;"></i>
</button>
</div>
@* <button class="btn btn-xs btn-light btn-rounded" style="width:2rem;"
@onclick="() => changeCollapsed(ItemTableList[row].Row)">
<i class="@hwIcon(ItemTableList[i].Row)" style="width:0.5rem;"></i>
</button> *@
}
@* <div class="card text-center m-1 p-1 shadow-sm hover-shadow">
<button class="btn btn-sm btn-danger btn-rounded"
style="font-size: 1rem;">
<i class="bi bi-trash3-fill"></i>
</button>
</div> *@
</div>
@* @if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.SASH ||
ItemTableList[i].Type is Json.WindowConst.AreaTypes.SPLIT)
{
<button class="btn btn-sm btn-secondary" style="font-size: 1rem;" @onclick="() => Remove(cs, ind)" title="Remove">Canc</button>
} *@
</td>
}
else
{
<td>@FillTable(i, j)</td>
}
}
}
</tr>
+234
View File
@@ -22,12 +22,30 @@ namespace WebWindowComplex.Compo
[Parameter]
public int maxCol { get; set; } = 0;
/// <summary>
/// Dizionario con elementi che possono collassare
/// </summary>
[Parameter]
public Dictionary<int, bool> RowCollapsedDict { get; set; } = new Dictionary<int, bool>();
/// <summary>
/// Dizionario con numero di figli per elementi che possono collassare
/// </summary>
[Parameter]
public Dictionary<int, int> ChildDict { get; set; } = new Dictionary<int, int>();
/// <summary>
/// Evento richiesta prossimo step
/// </summary>
[Parameter]
public EventCallback<DataNextStep> EC_NextStep { get; set; }
/// <summary>
/// Evento aggiornamento dizionari per collasso righe
/// </summary>
[Parameter]
public EventCallback<Dictionary<int, bool>> EC_Collapsed { get; set; }
/// <summary>
/// Metodo per richiesta prossimo step
/// </summary>
@@ -42,6 +60,70 @@ namespace WebWindowComplex.Compo
return EC_NextStep.InvokeAsync(Args);
}
//private Dictionary<int, bool> RowCollapsedDict { get; set; } = new Dictionary<int, bool>();
//private Dictionary<int, int> Child { get; set; } = new Dictionary<int, int>();
//protected override void OnAfterRender(bool firstRender)
//{
// if (firstRender)
// {
// foreach (var key in RowCollapsedDict.Keys.ToList())
// {
// RowCollapsedDict[key] = false;
// Child[key] = -1;
// }
// //for (int i = 0; i < ItemTableList.Count; i++)
// //{
// // for (int j = 0; j < maxCol; j++)
// // {
// // if (j + 1 == ItemTableList[i].Col)
// // {
// // TableList.Add(new DataTable
// // {
// // item = ItemTableList[i],
// // row = i,
// // col = j,
// // hidden = false
// // });
// // }
// // else
// // {
// // FillTable(i, j);
// // }
// // }
// //}
// }
//}
//protected override void OnParametersSet()
//{
// RowCollapsedDict.Clear();
// Child.Clear();
// foreach (var item in ItemTableList)
// {
// if(item.NumChild > 4)
// {
// RowCollapsedDict.Add(item.Row, false);
// Child.Add(item.Row, item.NumChild);
// }
// }
//}
/// <summary>
/// Metodo per aprire/chiudere sottorighe
/// </summary>
/// <returns></returns>
private Task ChangeCollapsed(int row)
{
RowCollapsedDict[row] = RowCollapsedDict[row] ? false : true;
return EC_Collapsed.InvokeAsync(RowCollapsedDict);
}
private string hwIcon(int row)
{
return RowCollapsedDict[row] ? "fa-solid fa-chevron-down" : "fa-solid fa-chevron-up";
}
//private async Task Remove(CompileStep cs, int indexStep)
//{
// var Args = new DataNextStep
@@ -136,6 +218,157 @@ namespace WebWindowComplex.Compo
return " ";
}
}
private bool HideRow(int row, int col)
{
List<ItemTable> itemSameCol = new List<ItemTable>();
for (int k = 0; k < row; k++)
{
if (ItemTableList[k].Col == col + 1)
{
itemSameCol.Add(ItemTableList[k]);
}
continue;
}
if(itemSameCol.Count > 0)
return RowCollapsedDict.GetValueOrDefault(itemSameCol.First().Row - 1);
return false;
}
// private void FillTable(int row, int col)
// {
// List<ItemTable> itemSameCol = new List<ItemTable>();
// for (int k = 0; k < row; k++)
// {
// if (ItemTableList[k].Col == col + 1)
// {
// itemSameCol.Add(ItemTableList[k]);
// }
// continue;
// }
// int numItemNextCol = 0;
// for (int k = 0; k < row; k++)
// {
// if (ItemTableList[k].Row <= row && ItemTableList[k].Col == col + 2)
// {
// numItemNextCol++;
// }
// continue;
// }
// if (itemSameCol.Count > 1)
// {
// for (int i = 0; i <= itemSameCol.Count - 2; i++)
// {
// if (itemSameCol[i].NumChild > 0)
// numItemNextCol = numItemNextCol - itemSameCol[i].NumChild;
// }
// }
// if (itemSameCol.Count > 0)
// {
// // Sono alla riga successiva di un elemento e nella stessa colonna
// if (itemSameCol.Last().Row == row)
// {
// // se ha un solo figlio
// if (itemSameCol.Last().NumChild == 1)
// {
// TableList.Add(new DataTable
// {
// symbol = "└",
// row = row,
// col = col,
// hidden = false
// });
// }
// else if (itemSameCol.Last().NumChild == 0)
// {
// TableList.Add(new DataTable
// {
// symbol = " ",
// row = row,
// col = col,
// hidden = false
// });
// }
// else
// {
// TableList.Add(new DataTable
// {
// symbol = "├",
// row = row,
// col = col,
// hidden = false
// });
// }
// }
// // Non sono alla riga successiva
// else
// {
// // se ha un solo figlio
// if (itemSameCol.Last().NumChild == 1)
// {
// TableList.Add(new DataTable
// {
// symbol = " ",
// row = row,
// col = col,
// hidden = false
// });
// }
// else if (col + 2 <= maxCol && ItemTableList[row].Col == col + 2)
// {
// if (numItemNextCol < itemSameCol.Last().NumChild && numItemNextCol != (itemSameCol.Last().NumChild - 1))
// {
// TableList.Add(new DataTable
// {
// symbol = "├",
// row = row,
// col = col,
// hidden = false
// });
// }
// TableList.Add(new DataTable
// {
// symbol = "└",
// row = row,
// col = col,
// hidden = false
// });
// }
// else if (numItemNextCol < itemSameCol.Last().NumChild)
// {
// TableList.Add(new DataTable
// {
// symbol = "│",
// row = row,
// col = col,
// hidden = false
// });
// }
// else
// {
// TableList.Add(new DataTable
// {
// symbol = " ",
// row = row,
// col = col,
// hidden = false
// });
// }
// }
// }
// else
// {
// TableList.Add(new DataTable
// {
// symbol = " ",
// row = row,
// col = col,
// hidden = false
// });
// }
// }
//}
}
/// <summary>
@@ -146,4 +379,5 @@ namespace WebWindowComplex.Compo
public CompileStep currCompileStep { get; set; }
public int index { get; set; }
}
}