diff --git a/WebWindowComplex/Compo/CardTree.razor b/WebWindowComplex/Compo/CardTree.razor index ad3f3d5..25654c7 100644 --- a/WebWindowComplex/Compo/CardTree.razor +++ b/WebWindowComplex/Compo/CardTree.razor @@ -5,48 +5,83 @@ @for (int i = 0; i < ItemTableList.Count; i++) { - @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) : ""); - } - - - @* @if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.SASH || - ItemTableList[i].Type is Json.WindowConst.AreaTypes.SPLIT) - { - - } *@ - + 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 { - @FillTable(i, j) + 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) : ""); + } + +
+
+ +
+ @if (ItemTableList[row].NumChild > 4) + { +
+ +
+ @* *@ + } + @*
+ +
*@ +
+ @* @if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.SASH || + ItemTableList[i].Type is Json.WindowConst.AreaTypes.SPLIT) + { + + } *@ + + } + else + { + @FillTable(i, j) + } } } diff --git a/WebWindowComplex/Compo/CardTree.razor.cs b/WebWindowComplex/Compo/CardTree.razor.cs index 3309ac6..233d574 100644 --- a/WebWindowComplex/Compo/CardTree.razor.cs +++ b/WebWindowComplex/Compo/CardTree.razor.cs @@ -22,12 +22,30 @@ namespace WebWindowComplex.Compo [Parameter] public int maxCol { get; set; } = 0; + /// + /// Dizionario con elementi che possono collassare + /// + [Parameter] + public Dictionary RowCollapsedDict { get; set; } = new Dictionary(); + + /// + /// Dizionario con numero di figli per elementi che possono collassare + /// + [Parameter] + public Dictionary ChildDict { get; set; } = new Dictionary(); + /// /// Evento richiesta prossimo step /// [Parameter] public EventCallback EC_NextStep { get; set; } + /// + /// Evento aggiornamento dizionari per collasso righe + /// + [Parameter] + public EventCallback> EC_Collapsed { get; set; } + /// /// Metodo per richiesta prossimo step /// @@ -42,6 +60,70 @@ namespace WebWindowComplex.Compo return EC_NextStep.InvokeAsync(Args); } + //private Dictionary RowCollapsedDict { get; set; } = new Dictionary(); + //private Dictionary Child { get; set; } = new Dictionary(); + + //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); + // } + // } + //} + + /// + /// Metodo per aprire/chiudere sottorighe + /// + /// + 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 itemSameCol = new List(); + 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 itemSameCol = new List(); + // 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 + // }); + // } + // } + //} + } /// @@ -146,4 +379,5 @@ namespace WebWindowComplex.Compo public CompileStep currCompileStep { get; set; } public int index { get; set; } } + } diff --git a/WebWindowComplex/DTO/LivePayload.cs b/WebWindowComplex/DTO/LivePayload.cs index 9d00a07..946b8b3 100644 --- a/WebWindowComplex/DTO/LivePayload.cs +++ b/WebWindowComplex/DTO/LivePayload.cs @@ -61,7 +61,7 @@ namespace WebWindowComplex.DTO return false; if (!DictUtils.DictAreEqual(DictShape, item.DictShape)) return false; - if (ProfElementList.Count == item.ProfElementList.Count && !ProfElementList.OrderBy(x => x).SequenceEqual(item.ProfElementList.OrderBy(x => x))) + if (ProfElementList.Count != item.ProfElementList.Count || !ProfElementList.OrderBy(x => x.GroupId).SequenceEqual(item.ProfElementList.OrderBy(x => x.GroupId))) return false; return true; } diff --git a/WebWindowComplex/Models/Area.cs b/WebWindowComplex/Models/Area.cs index 1b3eeef..3e0e34f 100644 --- a/WebWindowComplex/Models/Area.cs +++ b/WebWindowComplex/Models/Area.cs @@ -101,9 +101,13 @@ namespace WebWindowComplex.Models public void AddFirstSash() { // Salvo il parent - if(this is Frame) + if(this is Frame || ParentArea.AreaList.Last().Equals(this)) { - Frame f = (Frame)this; + Frame f = null; + if (this is Frame) + f = (Frame)this; + else + f = (Frame)ParentWindow.AreaList.First(); f.BottomRailQty = 0; f.BottomRailElemDimList.Clear(); } diff --git a/WebWindowComplex/Models/Split.cs b/WebWindowComplex/Models/Split.cs index ebaa969..ef880af 100644 --- a/WebWindowComplex/Models/Split.cs +++ b/WebWindowComplex/Models/Split.cs @@ -409,6 +409,7 @@ namespace WebWindowComplex.Models m_SplitHorizList = value; } } + public List ElemDimHorizList { get @@ -499,7 +500,6 @@ namespace WebWindowComplex.Models Fill newFill = Fill.CreateFill(ParentArea, FillTypes.GLASS); newFill.SetAreaType(AreaTypes.FILL); ParentArea.AreaList.Add(newFill); - //m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); } public List searchElemFromSubArea(int subArea) @@ -607,12 +607,6 @@ namespace WebWindowComplex.Models } else { - // Un Elemento per ogni dimensione principale e secondaria - //int subArea = 1; - //if (!bSplitStartVert) - // subArea = 0; - //for (int i = 0; i < QtyHoriz; i++) - // ElemDimHorizList.Add(new SplitElementDimension(this, i + 1, 78, subArea)); // Un Elemento per ogni dimensione principale e per ogni sotto dimensione if (bSplitStartVert) { @@ -660,12 +654,6 @@ namespace WebWindowComplex.Models } else { - // Un Elemento per ogni dimensione principale e secondaria - //int subArea = 0; - //if (!bSplitStartVert) - // subArea = 1; - //for (int i = 0; i < QtyVert; i++) - // ElemDimVertList.Add(new SplitElementDimension(this, i + 1, 78, subArea)); // Un Elemento per ogni dimensione principale e per ogni sotto dimensione if (bSplitStartVert) { @@ -722,14 +710,12 @@ namespace WebWindowComplex.Models #region Private Fields - //private bool m_bIsPercentage = true; private bool m_bSplitStartVert = true; private SplitShapes m_SelSplitShape; private List m_SplitHorizList = new List(); private List m_ElemDimHorizList = new List(); private List m_ElemDimVertList = new List(); - private List m_SplitPositionList = new List(); private List m_SplitShapeList = new List { @@ -741,8 +727,6 @@ namespace WebWindowComplex.Models private List m_SplitVertList = new List(); - //private double m_Width = 0; - #endregion Private Fields } } \ No newline at end of file diff --git a/WebWindowComplex/TableComp.razor b/WebWindowComplex/TableComp.razor index 6b9fbe7..dc146dc 100644 --- a/WebWindowComplex/TableComp.razor +++ b/WebWindowComplex/TableComp.razor @@ -77,8 +77,11 @@ @if (currStep == CompileStep.Tree) { + maxCol="m_maxCol" + RowCollapsedDict="RowCollapsed" + ChildDict="Child" + EC_NextStep="NextStepArgs" + EC_Collapsed="CollapsedRowTree"> } else if (currStep == CompileStep.Frame) diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index 1ccc5ba..af6f3cf 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -587,7 +587,8 @@ namespace WebWindowComplex CurrJwd = LiveData.CurrJwd, DictOptionsXml = LiveData.DictOptionsXml, DictShape = LiveData.DictShape, - SvgPreview = LiveData.SvgPreview + SvgPreview = LiveData.SvgPreview, + ProfElementList = LiveData.ProfElementList }; // Aggiornati parametri di ingresso selezionati UpdateSelParameter(); @@ -843,6 +844,21 @@ namespace WebWindowComplex m_ItemTableList = new List(); CreateWindowsList((m_CurrWindow!).AreaList.First(), false); CreateElementTable(m_CurrWindow.AreaList.First(), 1, 1, 1, 1); + foreach (var item in ItemTableList) + { + if (item.NumChild > 4) + { + if (!RowCollapsed.ContainsKey(item.Row)) + { + RowCollapsed.Add(item.Row, false); + Child.Add(item.Row, item.NumChild); + } + } + else if(RowCollapsed.ContainsKey(item.Row)) + { + RowCollapsed.Remove(item.Row); + } + } } /// @@ -920,6 +936,9 @@ namespace WebWindowComplex private List m_FillList = new List(); private List m_SplittedList = new List(); + private Dictionary RowCollapsed { get; set; } = new Dictionary(); + private Dictionary Child { get; set; } = new Dictionary(); + private static Logger Log = LogManager.GetCurrentClassLogger(); #endregion Private Fields @@ -1101,6 +1120,22 @@ namespace WebWindowComplex NextStep(newStep, Index); } + /// + /// Metodo per aggiornare il valore collassato degli elementi della gerarchia + /// + /// + private void CollapsedRowTree(Dictionary Args) + { + foreach(var item in Args) + { + RowCollapsed[item.Key] = Args[item.Key] ? true : false; + if (m_ItemTableList.FirstOrDefault(x => x.Row == item.Key) != null) + { + Child[item.Key] = m_ItemTableList.FirstOrDefault(x => x.Row == item.Key).NumChild; + } + } + } + /// /// Richiesta reset dizionario Shape con action /// @@ -1228,6 +1263,11 @@ namespace WebWindowComplex SpElemList.ElementAt(i).SetMaxDimension(Window.m_ParameterList.GetValueOrDefault(SpElemList.ElementAt(i).sName + "_DimMax")); string overlapName = string.Join("_", SpElemList.ElementAt(i).sName.Split('_').Skip(1)); SpElemList.ElementAt(i).SetOverlapElement(Window.m_ParameterList.GetValueOrDefault(SpElemList.ElementAt(i).sName + "_Overlap")); + //// Se la lista in precedenza era vuota, metto i valori di default + //if (prevLiveData.ProfElementList == null || prevLiveData.ProfElementList.Count == 0) + //{ + // SpElemList.ElementAt(i).SetDimension(Window.m_ParameterList.GetValueOrDefault(SpElemList.ElementAt(i).sName + "_DimStd")); + //} } break; } @@ -1238,6 +1278,11 @@ namespace WebWindowComplex item.SetMaxDimension(Window.m_ParameterList.GetValueOrDefault(item.sName + "_DimMax")); string overlapName = string.Join("_", item.sName.Split('_').Skip(1)); item.SetOverlapElement(Window.m_ParameterList.GetValueOrDefault(overlapName + "_Overlap")); + // Se la lista in precedenza era vuota, metto i valori di default + //if (prevLiveData.ProfElementList == null || prevLiveData.ProfElementList.Count == 0) + //{ + // item.SetDimension(Window.m_ParameterList.GetValueOrDefault(item.sName + "_DimStd")); + //} } } } diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index 0e2e989..c714b55 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.2.617 + 3.1.2.1012 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -109,6 +109,11 @@ + + + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index 3c163ca..712f8cc 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.2.617 + 3.1.2.1012 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -97,6 +97,10 @@ + + + +