Added the value card sort to the BeyondFacts Lab (#1206)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-15 13:06:06 +01:00
1 parent 1361b984eb
commit 3ca4b3878b
42 files changed
+2111 -114

No files matched your search

@@ -27,88 +27,106 @@ else if (this.HasPublicDetails)
</MudAlert>
}
@* A section groups its fields under its heading, in a dashed frame; the fields without a section stand on their own. *@
<MudStack Spacing="3">
@foreach (var field in this.Fields)
@foreach (var section in this.Sections)
{
switch (field.Kind)
{
case BflFieldKind.SINGLE_LINE:
case BflFieldKind.LINK:
<MudTextField @key="field.Id"
T="string"
Value="@this.Form.Get(field.Id)"
ValueChanged="@(value => this.SetValueAsync(field, value))"
Label="@LabelOf(field)"
HelperText="@field.Hint"
MaxLength="@field.Kind.MaxLength"
Validation="@this.ValidationOf(field)"
Disabled="@this.Disabled"
Adornment="@AdornmentOf(field)"
AdornmentIcon="@PUBLIC_DETAIL_ICON"
AdornmentColor="Color.Info"
AdornmentAriaLabel="@this.PublicDetailLabel"
Variant="Variant.Outlined"/>
break;
<MudPaper @key="section" Elevation="@SectionElevation(section)" Class="@SectionClass(section)">
@if (section is not BflFormSection.NONE)
{
<MudText Typo="Typo.h6" Class="mb-2">@section.Title</MudText>
}
case BflFieldKind.MULTI_LINE:
<MudTextField @key="field.Id"
T="string"
Value="@this.Form.Get(field.Id)"
ValueChanged="@(value => this.SetValueAsync(field, value))"
Label="@LabelOf(field)"
HelperText="@field.Hint"
MaxLength="@field.Kind.MaxLength"
Disabled="@this.Disabled"
Adornment="@AdornmentOf(field)"
AdornmentIcon="@PUBLIC_DETAIL_ICON"
AdornmentColor="Color.Info"
AdornmentAriaLabel="@this.PublicDetailLabel"
Variant="Variant.Outlined"
Lines="3"
Sizing="InputSizing.Auto"
MaxLines="12"/>
break;
@if (section.HasCardSort)
{
<BflValueCardSort Form="@this.Form" FormChanged="@this.FormChanged" Disabled="@this.Disabled" Class="mb-4"/>
}
case BflFieldKind.CHOICE:
<MudSelect @key="field.Id"
T="string"
Value="@this.Form.Get(field.Id)"
ValueChanged="@(value => this.SetValueAsync(field, value))"
Label="@LabelOf(field)"
HelperText="@field.Hint"
Clearable="true"
Disabled="@this.Disabled"
Variant="Variant.Outlined">
@foreach (var option in field.Options)
<MudStack Spacing="3">
@foreach (var field in this.FieldsOf(section))
{
switch (field.Kind)
{
<MudSelectItem T="string" Value="@option.Id">@option.Label</MudSelectItem>
}
</MudSelect>
break;
case BflFieldKind.SINGLE_LINE:
case BflFieldKind.LINK:
<MudTextField @key="field.Id"
T="string"
Value="@this.Form.Get(field.Id)"
ValueChanged="@(value => this.SetValueAsync(field, value))"
Label="@LabelOf(field)"
HelperText="@field.Hint"
MaxLength="@field.Kind.MaxLength"
Validation="@this.ValidationOf(field)"
Disabled="@this.Disabled"
Adornment="@AdornmentOf(field)"
AdornmentIcon="@PUBLIC_DETAIL_ICON"
AdornmentColor="Color.Info"
AdornmentAriaLabel="@this.PublicDetailLabel"
Variant="Variant.Outlined"/>
break;
case BflFieldKind.MULTI_CHOICE:
<div @key="field.Id">
<MudText Typo="Typo.body2">@LabelOf(field)</MudText>
<MudChipSet T="string"
SelectionMode="SelectionMode.MultiSelection"
SelectedValues="@this.Form.GetChoices(field.Id)"
SelectedValuesChanged="@(values => this.SetChoicesAsync(field, values))"
CheckMark="true"
Color="Color.Primary"
Variant="Variant.Outlined"
Disabled="@this.Disabled">
@foreach (var option in field.Options)
{
<MudChip T="string" Value="@option.Id" Text="@option.Label"/>
}
</MudChipSet>
@if (!string.IsNullOrWhiteSpace(field.Hint))
{
<MudText Typo="Typo.caption">@field.Hint</MudText>
case BflFieldKind.MULTI_LINE:
<MudTextField @key="field.Id"
T="string"
Value="@this.Form.Get(field.Id)"
ValueChanged="@(value => this.SetValueAsync(field, value))"
Label="@LabelOf(field)"
HelperText="@field.Hint"
MaxLength="@field.Kind.MaxLength"
Disabled="@this.Disabled"
Adornment="@AdornmentOf(field)"
AdornmentIcon="@PUBLIC_DETAIL_ICON"
AdornmentColor="Color.Info"
AdornmentAriaLabel="@this.PublicDetailLabel"
Variant="Variant.Outlined"
Lines="3"
Sizing="InputSizing.Auto"
MaxLines="12"/>
break;
case BflFieldKind.CHOICE:
<MudSelect @key="field.Id"
T="string"
Value="@this.Form.Get(field.Id)"
ValueChanged="@(value => this.SetValueAsync(field, value))"
Label="@LabelOf(field)"
HelperText="@field.Hint"
Clearable="true"
Disabled="@this.Disabled"
Variant="Variant.Outlined">
@foreach (var option in field.Options)
{
<MudSelectItem T="string" Value="@option.Id">@option.Label</MudSelectItem>
}
</MudSelect>
break;
case BflFieldKind.MULTI_CHOICE:
<div @key="field.Id">
<MudText Typo="Typo.body2">@LabelOf(field)</MudText>
<MudChipSet T="string"
SelectionMode="SelectionMode.MultiSelection"
SelectedValues="@this.Form.GetChoices(field.Id)"
SelectedValuesChanged="@(values => this.SetChoicesAsync(field, values))"
CheckMark="true"
Color="Color.Primary"
Variant="Variant.Outlined"
Disabled="@this.Disabled">
@foreach (var option in field.Options)
{
<MudChip T="string" Value="@option.Id" Text="@option.Label"/>
}
</MudChipSet>
@if (!string.IsNullOrWhiteSpace(field.Hint))
{
<MudText Typo="Typo.caption">@field.Hint</MudText>
}
</div>
break;
}
</div>
break;
}
}
</MudStack>
</MudPaper>
}
</MudStack>