127 lines
3.3 KiB
C#
127 lines
3.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Components;
|
|
using System.Net.Http;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Components.Authorization;
|
|
using Microsoft.AspNetCore.Components.Forms;
|
|
using Microsoft.AspNetCore.Components.Routing;
|
|
using Microsoft.AspNetCore.Components.Web;
|
|
using Microsoft.AspNetCore.Components.Web.Virtualization;
|
|
using Microsoft.JSInterop;
|
|
using MP.SPEC;
|
|
using MP.SPEC.Shared;
|
|
using MP.SPEC.Components;
|
|
using MP.SPEC.Data;
|
|
|
|
namespace MP.SPEC.Components
|
|
{
|
|
public partial class ToggleMode
|
|
{
|
|
[Parameter]
|
|
public EventCallback<SelectGlobalToggle> FilterChanged { get; set; }
|
|
|
|
[Parameter]
|
|
public SelectGlobalToggle SelFilter { get; set; } = new SelectGlobalToggle();
|
|
|
|
protected bool isActive
|
|
{
|
|
get => SelFilter.isActive;
|
|
set
|
|
{
|
|
if (SelFilter.isActive != value)
|
|
{
|
|
SelFilter.isActive = value;
|
|
reportChange();
|
|
}
|
|
}
|
|
}
|
|
|
|
protected string leftString
|
|
{
|
|
get => SelFilter.leftString;
|
|
set
|
|
{
|
|
if (SelFilter.leftString != value)
|
|
{
|
|
SelFilter.leftString = value;
|
|
reportChange();
|
|
}
|
|
}
|
|
}
|
|
protected string leftStringCSS
|
|
{
|
|
get => SelFilter.leftStringCSS;
|
|
set
|
|
{
|
|
if (SelFilter.leftStringCSS != value)
|
|
{
|
|
SelFilter.leftStringCSS = value;
|
|
reportChange();
|
|
}
|
|
}
|
|
}
|
|
protected string rightString
|
|
{
|
|
get => SelFilter.rightString;
|
|
set
|
|
{
|
|
if (SelFilter.rightString != value)
|
|
{
|
|
SelFilter.rightString = value;
|
|
reportChange();
|
|
}
|
|
}
|
|
}
|
|
protected string rightStringCSS
|
|
{
|
|
get => SelFilter.rightStringCSS;
|
|
set
|
|
{
|
|
if (SelFilter.rightStringCSS != value)
|
|
{
|
|
SelFilter.rightStringCSS = value;
|
|
reportChange();
|
|
}
|
|
}
|
|
}
|
|
|
|
protected void toggle()
|
|
{
|
|
var currFilt = SelFilter;
|
|
currFilt.isActive = !currFilt.isActive;
|
|
SelFilter = currFilt;
|
|
if (isActive)
|
|
{
|
|
rightStringCSS = "fw-bold";
|
|
leftStringCSS = "text-secondary";
|
|
}
|
|
else
|
|
{
|
|
leftStringCSS = "fw-bold";
|
|
rightStringCSS = "text-secondary";
|
|
}
|
|
}
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
if (isActive)
|
|
{
|
|
rightStringCSS = "fw-bold";
|
|
leftStringCSS = "text-secondary";
|
|
}
|
|
else
|
|
{
|
|
leftStringCSS = "fw-bold";
|
|
rightStringCSS = "text-secondary";
|
|
}
|
|
await FilterChanged.InvokeAsync(SelFilter);
|
|
}
|
|
|
|
private void reportChange()
|
|
{
|
|
FilterChanged.InvokeAsync(SelFilter);
|
|
}
|
|
}
|
|
} |