using Egw.Window.Data;
using Microsoft.AspNetCore.Components;
using Newtonsoft.Json;
using System.Reflection.Metadata;
using WebWindowComplex.Compo;
using WebWindowComplex.DTO;
using WebWindowComplex.Json;
using WebWindowComplex.Models;
using static WebWindowComplex.Json.WindowConst;
namespace WebWindowComplex
{
public partial class TableComp : IDisposable
{
#region Public Properties
///
/// Classe override css x SVG (x rescale)
///
[Parameter]
public string CssSvg { get; set; } = "responsive-svg";
///
/// Preselezione valori
///
[Parameter]
public SelectPayload? CurrSelection { get; set; } = null;
///
/// Richiesta chiusura JWD (+ refresh)
/// se torna true --> richiesta salvataggio
/// se torna false --> richiesta revert
///
[Parameter]
public EventCallback EC_OnClose { get; set; }
///
/// Evento selezione template
///
[Parameter]
public EventCallback EC_OnSelectedTemplate { get; set; }
///
/// Richiesta refresh SVG da JWD
///
[Parameter]
public EventCallback> EC_OnUpdate { get; set; }
///
/// Sollevo evento errore validazione con una lista di errori rilevati
///
[Parameter]
public EventCallback> EC_ValidError { get; set; }
///
/// Elenco anagrafiche di base
///
[Parameter]
public BaseListPayload ListPayload { get; set; } = null!;
///
/// Dati live controllo (JWD, SVG, ...)
///
[Parameter]
public LivePayload LiveData { get; set; } = null!;
#endregion Public Properties
#region Public Methods
public void Dispose()
{
if (m_CurrWindow != null)
{
m_CurrWindow.OnPreview -= M_CurrWindow_OnPreview;
m_CurrWindow = null;
}
}
#endregion Public Methods
#region Protected Fields
///
/// Dati live precedenti x comparazione
///
protected LivePayload? prevLiveData = null;
#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 FillList
{
get => m_FillList;
}
protected Frame FrameWindow
{
get => m_Frame!;
set => m_Frame = value;
}
protected List ItemTableList
{
get => m_ItemTableList;
}
protected string m_SelSVG { get; set; } = "";
///
/// Componente SVG da mostrare
///
protected MarkupString outSvg
{
get
{
// aggiunta gestione classe svg per posizionamento con costraints
var newSvg = LiveData.SvgPreview.Replace("