features/new
stm 2 years ago
parent 943579faec
commit 457df20346

@ -23,6 +23,7 @@
<InputText
Label="String"
Required="true"
ErrorText="@errorText"
@bind-Value="@inputValueText">
</InputText>
@ -48,4 +49,14 @@
counter++;
StateHasChanged();
}
string errorText
{
get
{
if (string.IsNullOrEmpty(inputValueText)) return string.Empty;
return "Error!!";
}
}
}

@ -1,4 +1,6 @@
@inherits InputBase
@using Connected.Models;
@inherits InputBase
@typeparam NumberType
@ -28,7 +30,7 @@
}
<span class="input-glyph-wraper">
<span class="input-glyph">
@if (Clearable)
@if (Clearable && Value.ToString().Length > 0)
{
<span class="input-glyph button" @onclick="Clear">
<i class='bx bx-x-circle'></i>
@ -37,7 +39,8 @@
@if (IsError)
{
<span class="input-glyph error">
<i class='bx bx-error-circle'></i>
<Glyph SVG="@Icons.Material.Outlined.Error" Color="#D10000" />
<!--<i class='bx bx-error-circle'></i>-->
</span>
}
</span>

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Components;
using Connected.Models;
using Microsoft.AspNetCore.Components;
using System.Numerics;
namespace Connected.Components;
@ -22,6 +23,7 @@ public partial class InputNumber<NumberType>:InputBase where NumberType : INumbe
{
if (args.Value is not null)
{
if (args.Value.ToString().Length > 0)
{
await ValueChanged.InvokeAsync((NumberType)Convert.ChangeType(args.Value, typeof(NumberType)));

@ -1,4 +1,6 @@
@inherits InputBase;
@using Connected.Models;
@inherits InputBase;
<div class="@InputFieldClassList">
<input type="password"
@ -25,7 +27,7 @@
}
<span class="input-glyph-wraper">
<span class="input-glyph">
@if (Clearable)
@if (Clearable && Value.ToString().Length > 0)
{
<span class="input-glyph button" @onclick="Clear">
<i class='bx bx-x-circle'></i>

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Components;
using Connected.Models;
using Microsoft.AspNetCore.Components;
namespace Connected.Components;
public partial class InputPassword: InputBase

@ -1,4 +1,6 @@
@inherits InputBase;
@using Connected.Models;
@inherits InputBase;
<div class="@InputFieldClassList">
@if (NumOfRows==1)
@ -38,16 +40,18 @@
}
<span class="input-glyph-wraper">
<span class="input-glyph">
@if (Clearable)
@if (Clearable && Value.ToString().Length>0)
{
<span class="input-glyph button" @onclick="Clear">
<i class='bx bx-x-circle'></i>
<Glyph SVG="@Icons.Material.Rounded.Dangerous" />
<!--<i class='bx bx-x-circle'></i>-->
</span>
}
@if (IsError)
{
<span class="input-glyph error">
<i class='bx bx-error-circle'></i>
<Glyph SVG="@Icons.Material.Outlined.Error" Color="#D10000" />
<!--<i class='bx bx-error-circle'></i>-->
</span>
}
</span>

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Components;
using Connected.Models;
using Microsoft.AspNetCore.Components;
namespace Connected.Components;
public partial class InputText: InputBase
@ -6,7 +7,7 @@ public partial class InputText: InputBase
[Parameter]
public int NumOfRows
{
get
get
{
return _numberOfLines;
}
@ -34,16 +35,20 @@ public partial class InputText: InputBase
private async Task ChangeValueAsync(ChangeEventArgs args)
{
if (string.IsNullOrEmpty(args.Value.ToString())) ErrorText = string.Empty;
await ValueChanged.InvokeAsync(args.Value.ToString());
StateHasChanged();
StateHasChanged();
}
private async Task Clear()
{
await ValueChanged.InvokeAsync(string.Empty);
ChangeEventArgs arg = new ChangeEventArgs();
arg.Value = string.Empty;
await ChangeValueAsync(arg);
}
protected override async Task OnInitializedAsync()
protected override async Task OnParametersSetAsync()
{
if (base.InputAttributes is null) base.InputAttributes = new();
if (base.Required)

@ -28,6 +28,8 @@
</ItemGroup>
<ItemGroup>
<Folder Include="Interfaces\" />
<Folder Include="Services\" />
<Folder Include="wwwroot\" />
</ItemGroup>
<!--<Target Name="CompileStaticAssets" AfterTargets="AfterBuild">

@ -1,7 +1,7 @@
using Connected.Utilities;
using Microsoft.AspNetCore.Components;
namespace Connected.Components;
namespace Connected.Models;
public class InputBase : ComponentBase
{
[Parameter]
Loading…
Cancel
Save