- Aggiunto componente CardTree

- Aggiunti commenti
- Enum di TableComp portati in un file esterno (LayoutConst)
This commit is contained in:
Annamaria Sassi
2025-10-13 12:20:15 +02:00
parent bd0e3536fb
commit d7cfc9de29
10 changed files with 413 additions and 178 deletions
+4 -4
View File
@@ -19,10 +19,10 @@
<div class="col d-flex justify-content-center">
@for (int j = 0; j < CurrSashList.Count; j++)
{
int Index = j;
<div class="input-group mb-2 justify-content-center">
<button class="btn btn-outline-secondary btn-sm" @onclick="() => RaiseCopySash(CurrSplitted,Index)">Copy Sash @(CurrSashList.Count == 1 ? "" : (Index + 1))</button>
</div>
int Index = j;
<div class="input-group mb-2 justify-content-center">
<button class="btn btn-outline-secondary btn-sm" @onclick="() => RaiseCopySash(CurrSplitted,Index)">Copy Sash @(CurrSashList.Count == 1 ? "" : (Index + 1))</button>
</div>
}
</div>
</div>
+18 -3
View File
@@ -8,17 +8,29 @@ namespace WebWindowComplex.Compo
{
#region Public Properties
/// <summary>
/// Lista delle sash
/// </summary>
[Parameter]
public List<Sash> CurrSashList { get; set; } = null;
/// <summary>
/// Oggetto splitted corrente
/// </summary>
[Parameter]
public Splitted CurrSplitted { get; set; } = null;
/// <summary>
/// Lista degli Splitted
/// </summary>
[Parameter]
public List<Splitted> CurrSplittedList { get; set; } = null;
/// <summary>
/// Evento per copiare Sash
/// </summary>
[Parameter]
public EventCallback<Data> EC_CopySash { get; set; }
public EventCallback<DataAreaSplit> EC_CopySash { get; set; }
#endregion Public Properties
@@ -30,7 +42,7 @@ namespace WebWindowComplex.Compo
/// <returns></returns>
private async Task RaiseCopySash(Splitted item, int indexCurrSash)
{
var Args = new Data
var Args = new DataAreaSplit
{
splitted = item,
index = indexCurrSash,
@@ -42,7 +54,10 @@ namespace WebWindowComplex.Compo
}
public class Data
/// <summary>
/// Classe per raggruppare oggetti che servono per copiare Sash
/// </summary>
public class DataAreaSplit
{
public Splitted splitted { get; set; }
public int index { get; set; }
+52 -6
View File
@@ -8,30 +8,57 @@ namespace WebWindowComplex.Compo
{
#region Public Properties
/// <summary>
/// Indice del fill corrente rispetto alla lista fill
/// </summary>
[Parameter]
public int CurrIndex { get; set; } = 0;
/// <summary>
/// Fill corrente rispetto alla lista fill
/// </summary>
[Parameter]
public Fill CurrItem { get; set; } = null!;
/// <summary>
/// Evento per cambiare tutti i fill
/// </summary>
[Parameter]
public EventCallback<FillTypes> EC_ChangeAllType { get; set; }
/// <summary>
/// Evento per cambiare solo il fill corrente
/// </summary>
[Parameter]
public EventCallback<FillTypes> EC_ChangeType { get; set; }
/// <summary>
/// Evento per copiare sash
/// </summary>
[Parameter]
public EventCallback<Data> EC_CopySash { get; set; }
public EventCallback<DataAreaSplit> EC_CopySash { get; set; }
/// <summary>
/// Evento per tornare nella pagine Tree
/// </summary>
[Parameter]
public EventCallback<bool> EC_ReqClose { get; set; }
/// <summary>
/// Lista dei Fill
/// </summary>
[Parameter]
public List<Fill> FillList { get; set; } = null!;
/// <summary>
/// Lista delle sash
/// </summary>
[Parameter]
public List<Sash> SashList { get; set; } = null!;
/// <summary>
/// Lista degli Splitted
/// </summary>
[Parameter]
public List<Splitted> SplittedList { get; set; } = null!;
@@ -40,17 +67,32 @@ namespace WebWindowComplex.Compo
#region Protected Methods
/// <summary>
/// Sollevo evento per cambiare tutti i Fill
/// </summary>
/// <param name="reqFillType"> tipo di fill richiesto </param>
/// <returns></returns>
protected async Task ChangeAllFill(FillTypes reqFillType)
{
await EC_ChangeAllType.InvokeAsync(reqFillType);
}
/// <summary>
/// Sollevo evento per cambiare solo il Fill corrente
/// </summary>
/// <param name="reqFillType"> tipo di fill richiesto </param>
/// <returns></returns>
protected async Task ChangeOneFill(FillTypes reqFillType)
{
await EC_ChangeType.InvokeAsync(reqFillType);
}
protected async Task CopySash(Data Args)
/// <summary>
/// Sollevo evento per copiare sash
/// </summary>
/// <param name="Args"></param>
/// <returns></returns>
protected async Task CopySash(DataAreaSplit Args)
{
await EC_CopySash.InvokeAsync(Args);
}
@@ -59,6 +101,14 @@ namespace WebWindowComplex.Compo
#region Private Methods
/// <summary>
/// Sollevo evento per tornare alla pagina Tree
/// </summary>
private void ReqClose()
{
_ = EC_ReqClose.InvokeAsync(true);
}
/// <summary>
/// Calcola bottone selezionato per il Fill
/// </summary>
@@ -70,9 +120,5 @@ namespace WebWindowComplex.Compo
#endregion Private Methods
private void ReqClose()
{
_ = EC_ReqClose.InvokeAsync(true);
}
}
}
+45
View File
@@ -0,0 +1,45 @@
@using static WebWindowComplex.LayoutConst
<table class="table table-sm table-hover align-middle shadow">
<tbody>
@for (int i = 0; i < ItemTableList.Count; i++)
{
<tr>
@for (int j = 0; j < maxCol; j++)
{
CompileStep cs = CompileStep.Frame;
int ind = -1;
@if (j + 1 == ItemTableList[i].Col)
{
@if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.FRAME)
{
cs = CompileStep.Frame;
}
else if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.SPLIT)
{
cs = CompileStep.Split;
ind = ItemTableList[i].IndexItem;
}
else if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.SASH)
{
cs = CompileStep.Sash;
ind = ItemTableList[i].IndexItem;
}
else if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.FILL)
{
cs = CompileStep.Fill;
ind = ItemTableList[i].IndexItem;
}
<td>
<button class="btn btn-sm btn-secondary" style="font-size: 1rem;" @onclick="() => RaiseNextStep(cs, ind)" title="Vai a step @(cs)">@ItemTableList[i].Desc</button>
</td>
}
else
{
<td>@FillTable(i, j)</td>
}
}
</tr>
}
</tbody>
</table>
+139
View File
@@ -0,0 +1,139 @@
using Microsoft.AspNetCore.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static WebWindowComplex.LayoutConst;
namespace WebWindowComplex.Compo
{
public partial class CardTree
{
/// <summary>
/// Lista oggetti ItemTable
/// </summary>
[Parameter]
public List<ItemTable> ItemTableList { get; set; } = null!;
/// <summary>
/// Numero massimo di colonne
/// </summary>
[Parameter]
public int maxCol { get; set; } = 0;
/// <summary>
/// Evento richiesta prossimo step
/// </summary>
[Parameter]
public EventCallback<DataNextStep> EC_NextStep { get; set; }
/// <summary>
/// Sollevo evento richiesta prossimo step
/// </summary>
/// <returns></returns>
private async Task RaiseNextStep(CompileStep cs, int indexStep)
{
var Args = new DataNextStep
{
currCompileStep = cs,
index = indexStep,
};
await EC_NextStep.InvokeAsync(Args);
}
/// <summary>
/// Metodo per riempire tabella con contenuto vuoto o con i simboli per rappresentare la struttura
/// </summary>
/// <param name="row"> riga della cella </param>
/// <param name="col"> colonna della cella </param>
/// <returns></returns>
private string 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)
{
return "└";
}
else if (itemSameCol.Last().NumChild == 0)
{
return " ";
}
else
{
return "├";
}
}
// Non sono alla riga successiva
else
{
// se ha un solo figlio
if (itemSameCol.Last().NumChild == 1)
{
return " ";
}
else if (col + 2 <= maxCol && ItemTableList[row].Col == col + 2)
{
if (numItemNextCol < itemSameCol.Last().NumChild && numItemNextCol != (itemSameCol.Last().NumChild - 1))
{
return "├";
}
return "└";
}
else if (numItemNextCol < itemSameCol.Last().NumChild)
{
return "│";
}
else
{
return " ";
}
}
}
else
{
return " ";
}
}
}
/// <summary>
/// Classe per inserire dati per NextStep
/// </summary>
public class DataNextStep
{
public CompileStep currCompileStep { get; set; }
public int index { get; set; }
}
}
+30
View File
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WebWindowComplex
{
public partial class LayoutConst
{
public enum CompileStep
{
Template = 0,
Tree = 1,
Frame,
Split,
Sash,
Fill,
General
}
public enum PositionJoints
{
BL = 0, // Bottom Left
BR = 1, // Bottom Right
TR, // Top Right
TL // Top Left
}
}
}
+5 -49
View File
@@ -1,4 +1,5 @@
<div class="row">
@using static WebWindowComplex.LayoutConst
<div class="row">
@if (isLoading)
{
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
@@ -59,10 +60,10 @@
@if (FrameWindow != null)
{
<li class="nav-item m-1">
<button data-target="#Tree" class="@tabNavCss(CompileStep.Tree)" aria-current="true" @onclick="() => NextStepAndPreview(CompileStep.Tree)">Tree</button>
<button data-target="#Tree" class="@tabNavCss(CompileStep.Tree)" aria-current="true" @onclick="() => NextStep(CompileStep.Tree)">Tree</button>
</li>
<li class="nav-item m-1">
<button data-target="#General" class="@tabNavCss(CompileStep.General)" aria-current="true" @onclick="() => NextStepAndPreview(CompileStep.General)">General</button>
<button data-target="#General" class="@tabNavCss(CompileStep.General)" aria-current="true" @onclick="() => NextStep(CompileStep.General)">General</button>
</li>
}
</ul>
@@ -117,52 +118,7 @@
}
@if (currStep == CompileStep.Tree)
{
<div class="display-6">
<table class="table table-sm table-hover align-middle shadow">
<tbody>
@for (int i = 0; i < ItemTableList.Count; i++)
{
<tr>
@for (int j = 0; j < m_maxCol; j++)
{
CompileStep cs = CompileStep.Frame;
int ind = -1;
@if (j + 1 == ItemTableList[i].Col)
{
@if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.FRAME)
{
cs = CompileStep.Frame;
}
else if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.SPLIT)
{
cs = CompileStep.Split;
ind = ItemTableList[i].IndexItem;
}
else if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.SASH)
{
cs = CompileStep.Sash;
ind = ItemTableList[i].IndexItem;
}
else if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.FILL)
{
cs = CompileStep.Fill;
ind = ItemTableList[i].IndexItem;
}
<td>
<button class="btn btn-sm btn-secondary" style="font-size: 1rem;" @onclick="() => NextStepAndPreview(cs, ind)" title="Vai a step @(cs)">@ItemTableList[i].Desc</button>
</td>
}
else
{
<td>@FillTable(i, j)</td>
}
}
</tr>
}
</tbody>
</table>
</div>
<CardTree ItemTableList="m_ItemTableList" maxCol="m_maxCol" EC_NextStep="NextStepArgs"></CardTree>
}
else if (currStep == CompileStep.Frame)
{
+102 -114
View File
@@ -6,7 +6,9 @@ using WebWindowComplex.Compo;
using WebWindowComplex.DTO;
using WebWindowComplex.Json;
using WebWindowComplex.Models;
using static WebWindowComplex.LayoutConst;
using static WebWindowComplex.Json.WindowConst;
//using static WebWindowComplex.Compo.CardTree;
namespace WebWindowComplex
{
@@ -88,29 +90,6 @@ namespace WebWindowComplex
#endregion Protected Fields
#region Protected Enums
protected enum CompileStep
{
Template = 0,
Tree = 1,
Frame,
Split,
Sash,
Fill,
General
}
protected enum PositionJoints
{
BL = 0, // Bottom Left
BR = 1, // Bottom Right
TR, // Top Right
TL // Top Left
}
#endregion Protected Enums
#region Protected Properties
protected List<Fill> FillList
@@ -975,7 +954,7 @@ namespace WebWindowComplex
/// <param name="currSplitted"> Area Splitted corrente </param>
/// <param name="numSash"> Indice della Sash che si vuole copiare </param>
/// <returns></returns>
private async Task CopySash(Data Args)
private async Task CopySash(DataAreaSplit Args)
{
Splitted currSplitted = Args.splitted;
int numSash = Args.index;
@@ -990,90 +969,92 @@ namespace WebWindowComplex
await DoPreviewSvg();
}
/// <summary>
/// Metodo per riempire tabella con contenuto vuoto o con i simboli per rappresentare la struttura
/// </summary>
/// <param name="row"> riga della cella </param>
/// <param name="col"> colonna della cella </param>
/// <returns></returns>
private string 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)
{
return "└";
}
else if (itemSameCol.Last().NumChild == 0)
{
return " ";
}
else
{
return "├";
}
}
// Non sono alla riga successiva
else
{
// se ha un solo figlio
if (itemSameCol.Last().NumChild == 1)
{
return " ";
}
else if (col + 2 <= m_maxCol && ItemTableList[row].Col == col + 2)
{
if (numItemNextCol < itemSameCol.Last().NumChild && numItemNextCol != (itemSameCol.Last().NumChild - 1))
{
return "├";
}
return "└";
}
else if (numItemNextCol < itemSameCol.Last().NumChild)
{
return "│";
}
else
{
return " ";
}
}
}
else
{
return " ";
}
}
///// <summary>
///// Metodo per riempire tabella con contenuto vuoto o con i simboli per rappresentare la struttura
///// </summary>
///// <param name="row"> riga della cella </param>
///// <param name="col"> colonna della cella </param>
///// <returns></returns>
//private string FillTable(DataFillTable Args)
//{
// int row = Args.indRow;
// int col = Args.indCol;
// 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)
// {
// return "└";
// }
// else if (itemSameCol.Last().NumChild == 0)
// {
// return " ";
// }
// else
// {
// return "├";
// }
// }
// // Non sono alla riga successiva
// else
// {
// // se ha un solo figlio
// if (itemSameCol.Last().NumChild == 1)
// {
// return " ";
// }
// else if (col + 2 <= m_maxCol && ItemTableList[row].Col == col + 2)
// {
// if (numItemNextCol < itemSameCol.Last().NumChild && numItemNextCol != (itemSameCol.Last().NumChild - 1))
// {
// return "├";
// }
// return "└";
// }
// else if (numItemNextCol < itemSameCol.Last().NumChild)
// {
// return "│";
// }
// else
// {
// return " ";
// }
// }
// }
// else
// {
// return " ";
// }
//}
/// <summary>
/// Calcola larghezza colonna header nav
@@ -1102,10 +1083,21 @@ namespace WebWindowComplex
}
/// <summary>
/// Metodo per cambiare step e aggiornare preview svg
/// Metodo per cambiare step
/// </summary>
/// <param name="Args"> argomenti passati dal componente </param>
private void NextStepArgs(DataNextStep Args)
{
CompileStep newStep = Args.currCompileStep;
int Index = Args.index;
NextStep(newStep, Index);
}
/// <summary>
/// Metodo per cambiare step
/// </summary>
/// <param name="newStep"> step successivo </param>
private void NextStepAndPreview(CompileStep newStep, int Index = -1)
private void NextStep(CompileStep newStep, int Index = 1)
{
editLock = true;
currStep = newStep;
@@ -1133,10 +1125,6 @@ namespace WebWindowComplex
break;
}
}
#if false
await DoPreviewSvg();
#endif
}
/// <summary>
+10 -1
View File
@@ -6,7 +6,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>2.7.10.1310</Version>
<Version>2.7.10.1312</Version>
<Authors>Annamaria Sassi</Authors>
<Company>Egalware</Company>
<Description>Componente gestione Configurazioni avanzate Window per LUX</Description>
@@ -61,6 +61,15 @@