nizio test sub components x update a cascata
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
|
||||
<div class="card my-2">
|
||||
<div class="card-header @CssClass">
|
||||
<h3>@Name</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="fs-3">@Message</div>
|
||||
<small>@LocalInfo</small>
|
||||
<Test.UI.Components.Compo.ChildObj Name="@SubName" CssClass="bg bg-primary" Message="load OPT" LoadPar="loadHwOpt"></Test.UI.Components.Compo.ChildObj>
|
||||
<Test.UI.Components.Compo.ChildObj Name="@SubName" CssClass="bg bg-primary" Message="load PNG" LoadPar="loadPng"></Test.UI.Components.Compo.ChildObj>
|
||||
<Test.UI.Components.Compo.ChildObj Name="@SubName" CssClass="bg bg-primary" Message="load SVG" LoadPar="loadSvg"></Test.UI.Components.Compo.ChildObj>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,38 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace Test.UI.Components.Compo
|
||||
{
|
||||
public partial class ChildNoLoad
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public string CssClass { get; set; } = "";
|
||||
|
||||
[Parameter]
|
||||
public string Message { get; set; } = "";
|
||||
|
||||
[Parameter]
|
||||
public string Name { get; set; } = "NONE";
|
||||
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected string LocalInfo = "";
|
||||
protected string SubName = "";
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
LocalInfo = $"Updated on {DateTime.Now:HH:ss.fff}";
|
||||
SubName = $"Child of {Name}";
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
@if (IsLoading)
|
||||
{
|
||||
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="card my-2">
|
||||
<div class="card-header @CssClass">
|
||||
<h3>@Name</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="fs-3">@Message</div>
|
||||
<small>@LocalInfo</small>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace Test.UI.Components.Compo
|
||||
{
|
||||
public partial class ChildObj
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public string CssClass { get; set; } = "";
|
||||
|
||||
[Parameter]
|
||||
public string Message { get; set; } = "";
|
||||
|
||||
[Parameter]
|
||||
public string Name { get; set; } = "NONE";
|
||||
|
||||
[Parameter]
|
||||
public string LoadPar { get; set; } = "";
|
||||
|
||||
[CascadingParameter(Name = "CurrLoading")]
|
||||
public List<string> CurrLoading { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected string LocalInfo = "";
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
LocalInfo = $"Updated on {DateTime.Now:HH:ss.fff}";
|
||||
}
|
||||
|
||||
private bool IsLoading
|
||||
{
|
||||
get => CurrLoading != null && CurrLoading.Count > 0 && CurrLoading.Contains(LoadPar);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,11 @@
|
||||
<span class="bi bi-house-fill px-2 fs-4" aria-hidden="true"></span> <span class="@hideText">Aedifica</span>
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="uitest">
|
||||
<span class="bi bi-house-fill px-2 fs-4" aria-hidden="true"></span> <span class="@hideText">UI Testing</span>
|
||||
</NavLink>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
@page "/uitest"
|
||||
@* @attribute [StreamRendering] *@
|
||||
@rendermode InteractiveServer
|
||||
|
||||
<PageTitle>UI test</PageTitle>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<CascadingValue Value="isLoading" Name="CurrLoading">
|
||||
<div class="row">
|
||||
<div class="col-12 ">
|
||||
<Test.UI.Components.Compo.ChildObj Name="A" CssClass="bg bg-primary" Message="BLOCK A - SVG" LoadPar="loadSvg"></Test.UI.Components.Compo.ChildObj>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<Test.UI.Components.Compo.ChildNoLoad Name="B" CssClass="bg bg-secondary" Message="BLOCK C"></Test.UI.Components.Compo.ChildNoLoad>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<Test.UI.Components.Compo.ChildObj Name="C" CssClass="bg bg-primary" Message="BLOCK C" LoadPar="loadShape"></Test.UI.Components.Compo.ChildObj>
|
||||
</div>
|
||||
</div>
|
||||
</CascadingValue>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<button class="btn btn-success btn-lg w-100" @onclick="DoReload">Reload!</button>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" @bind="loadPng">
|
||||
<label class="form-check-label">Reload PNG</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" @bind="loadSvg">
|
||||
<label class="form-check-label">Reload SVG</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" @bind="loadShape">
|
||||
<label class="form-check-label">Reload SHAPE</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" @bind="loadHwOpt">
|
||||
<label class="form-check-label">Reload HW OPT</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
@if (isLoading.Count > 0)
|
||||
{
|
||||
<EgwCoreLib.Razor.LoadingData DisplayMode="EgwCoreLib.Razor.LoadingData.SpinMode.BounceLine" Title="@($"...wating {delay}ms")"></EgwCoreLib.Razor.LoadingData>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,50 @@
|
||||
namespace Test.UI.Components.Pages
|
||||
{
|
||||
public partial class UiTest
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
protected List<string> isLoading = new List<string>();
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task DoReload()
|
||||
{
|
||||
isLoading = new List<string>();
|
||||
if (loadHwOpt)
|
||||
isLoading.Add("loadHwOpt");
|
||||
if (loadPng)
|
||||
isLoading.Add("loadPng");
|
||||
if (loadShape)
|
||||
isLoading.Add("loadShape");
|
||||
if (loadSvg)
|
||||
isLoading.Add("loadSvg");
|
||||
|
||||
while (isLoading.Count > 0)
|
||||
{
|
||||
delay = rnd.Next(600, 1000);
|
||||
await Task.Delay(delay);
|
||||
int i2rem = rnd.Next(isLoading.Count);
|
||||
isLoading.RemoveAt(i2rem);
|
||||
}
|
||||
isLoading = new List<string>();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private int delay = 0;
|
||||
|
||||
private Random rnd = new Random();
|
||||
|
||||
private bool loadSvg = false;
|
||||
private bool loadPng = false;
|
||||
private bool loadShape = false;
|
||||
private bool loadHwOpt = false;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user