Skip to content

Commit

Permalink
Merge pull request #139 from SSchulze1989/develop
Browse files Browse the repository at this point in the history
v 0.11.6
  • Loading branch information
SSchulze1989 authored Feb 24, 2024
2 parents 2eb97bd + a13f886 commit 77d956c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
ErrorText="@ErrorText"
@attributes="AdditionalAttributes"
@ref=Autocomplete
NoItemsTemplate="NoItemsTemplate"
MaxItems="MaxItems" />
NoItemsTemplate="NoItemsTemplate"
MaxItems="MaxItems"
MinCharacters="MinCharacters" />
<MudChipSet Class="mt-1" AllClosable=true OnClose="RemoveValue">
@foreach (var val in selectedValues)
{
Expand Down Expand Up @@ -78,6 +79,9 @@
[Parameter]
public int MaxItems { get; set; } = 100;

[Parameter]
public int MinCharacters { get; set; } = 0;

private HashSet<T> selectedValues = new HashSet<T>();

private MudAutocomplete<T> Autocomplete { get; set; } = default!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,17 @@
var propertyType = GetColumnPropertyType(Condition.ColumnPropertyName);

<MudSelect Label="Type" @bind-Value="Condition.Comparator"
HelperText="Select how to compare values"
HelperText="@GetComparatorHelperText(Condition.Comparator)"
Variant="Variant.Outlined">
@foreach (var compType in Enum.GetValues<ComparatorType>().Where(x => x != ComparatorType.InList))
@foreach (var compType in Enum.GetValues<ComparatorType>())
{
if (AllowForEach == false && compType == ComparatorType.ForEach)
{
continue;
}
<MudSelectItem Value=@compType>@compType.GetText()</MudSelectItem>
<MudSelectItem Value=@compType>
@compType.GetText()
</MudSelectItem>
}
</MudSelect>

Expand All @@ -70,7 +72,12 @@
}
else if (Condition.Comparator == ComparatorType.InList)
{
@*TODO: Fill in Component for values selection from list*@
<MultiSelectAutoComplete @bind-Values="Condition.FilterValues"
Label="@valueLabel"
DebounceInterval="50"
SearchFunc="@(async (value) => new[] {value})"
ToStringFunc="@(value => value)"
Variant="Variant.Outlined" />
}
else if (propertyType == typeof(RaceStatus))
{
Expand All @@ -82,10 +89,10 @@
</MudSelect>
}
else if (propertyType == typeof(string)
|| propertyType == typeof(double)
|| propertyType == typeof(double?)
|| propertyType == typeof(int)
|| propertyType == typeof(int?))
|| propertyType == typeof(double)
|| propertyType == typeof(double?)
|| propertyType == typeof(int)
|| propertyType == typeof(int?))
{
var isNumeric = propertyType == typeof(double) || propertyType == typeof(double?) || propertyType == typeof(int) || propertyType == typeof(int?);
<MudTextField Label="@valueLabel" @bind-Value="Condition.Value" InputType="@(isNumeric ? InputType.Number : InputType.Text)" Variant="Variant.Outlined" />
Expand Down Expand Up @@ -220,4 +227,16 @@
var property = typeof(ResultRowModel).GetProperty(name);
return property?.PropertyType;
}

private string GetComparatorHelperText(ComparatorType comparator) => comparator switch
{
ComparatorType.IsSmaller => "match if smaller than given value",
ComparatorType.IsSmallerOrEqual => "match if smaller or equal to given value",
ComparatorType.IsEqual => "match if equal to given value",
ComparatorType.IsBiggerOrEqual => "match if bigger or equal to given value",
ComparatorType.IsBigger => "match if bigger than given value",
ComparatorType.NotEqual => "match if not equal to given value",
ComparatorType.InList => "match if equal to one of the values in list",
_ => "",
};
}
2 changes: 1 addition & 1 deletion src/iRLeagueManager.Web/iRLeagueManager.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Version>0.11.5</Version>
<Version>0.11.6</Version>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>aspnet-iRLeagueManager.Web-2B05F9DC-55A3-49D1-BD64-31507000EDF3</UserSecretsId>
Expand Down

0 comments on commit 77d956c

Please sign in to comment.