Browse Source

fix layout of FeatureManagementModal for MudBlazor

pull/25235/head
İsmail ÇAĞDAŞ 8 months ago
parent
commit
24829ad215
  1. 100
      modules/feature-management/src/Volo.Abp.FeatureManagement.Blazor.MudBlazor/Components/FeatureManagementModal.razor

100
modules/feature-management/src/Volo.Abp.FeatureManagement.Blazor.MudBlazor/Components/FeatureManagementModal.razor

@ -6,7 +6,8 @@
@using Volo.Abp.FeatureManagement.Localization @using Volo.Abp.FeatureManagement.Localization
@inherits AbpFeatureManagementComponentBase @inherits AbpFeatureManagementComponentBase
<MudDialog @bind-Visible="@_isVisible" Options="@(new DialogOptions { MaxWidth = MaxWidth.Large, FullWidth = true })" CloseOnEscapeKey="true"> <MudDialog @bind-Visible="@_isVisible" Options="@(new DialogOptions { MaxWidth = MaxWidth.Large, FullWidth = true })"
CloseOnEscapeKey="true">
<TitleContent> <TitleContent>
<MudText Typo="Typo.h6">@L["Features"]@ProviderKeyDisplayName</MudText> <MudText Typo="Typo.h6">@L["Features"]@ProviderKeyDisplayName</MudText>
</TitleContent> </TitleContent>
@ -17,65 +18,63 @@
} }
else else
{ {
<MudTabs @bind-ActivePanelIndex="@_activeTabIndex" <MudTabs @bind-ActivePanelIndex="@_activeTabIndex" Variant="Variant.Pills" Position="Position.Left"
Variant="Variant.Pills" PanelClass="pa-4">
Position="Position.Left"
PanelClass="pa-4">
@foreach (var group in Groups) @foreach (var group in Groups)
{ {
<MudTabPanel Text="@group.DisplayName"> <MudTabPanel Text="@group.DisplayName">
<MudText Typo="Typo.h6" Class="mb-3">@group.DisplayName</MudText> <MudGrid>
<MudDivider Class="my-2" /> <MudItem xs="12">
@foreach (var feature in group.Features) <MudText Typo="Typo.h6">@group.DisplayName</MudText>
{ </MudItem>
var disabled = IsDisabled(feature); <MudItem xs="12">
<div class="mt-2" style="@GetFeatureStyles(feature)"> @foreach (var feature in group.Features)
@if (feature.ValueType is FreeTextStringValueType)
{ {
<MudTextField Label="@GetShownName(feature)" var disabled = IsDisabled(feature);
Disabled="@disabled" <div style="@GetFeatureStyles(feature)">
Value="@feature.Value" @if (feature.ValueType is FreeTextStringValueType)
{
<MudTextField Label="@GetShownName(feature)" Disabled="@disabled" Value="@feature.Value"
ValueChanged="@(async ([CanBeNull] string v) => await OnFeatureValueChangedAsync(v, feature))" /> ValueChanged="@(async ([CanBeNull] string v) => await OnFeatureValueChangedAsync(v, feature))" />
@if (feature.Description != null) @if (feature.Description != null)
{ {
<MudText Typo="Typo.caption" Class="mt-1">@feature.Description</MudText> <MudText Typo="Typo.caption" Class="mt-1">@feature.Description</MudText>
} }
} }
@if (feature.ValueType is SelectionStringValueType) @if (feature.ValueType is SelectionStringValueType)
{
var items = ((SelectionStringValueType)feature.ValueType).ItemSource.Items;
var selectedValue = SelectionStringValues[feature.Name];
<MudSelect T="string"
Label="@GetShownName(feature)"
Disabled="@disabled"
Value="@selectedValue"
ValueChanged="@(s => SelectionStringValues[feature.Name] = s)">
@foreach (var item in items)
{ {
<MudSelectItem Value="@item.Value"> var items = ((SelectionStringValueType)feature.ValueType).ItemSource.Items;
@CreateStringLocalizer(item.DisplayText.ResourceName).GetString(item.DisplayText.Name) var selectedValue = SelectionStringValues[feature.Name];
</MudSelectItem> <MudSelect T="string" Label="@GetShownName(feature)" Disabled="@disabled"
Value="@selectedValue" ValueChanged="@(s => SelectionStringValues[feature.Name] = s)">
@foreach (var item in items)
{
<MudSelectItem Value="@item.Value">
@CreateStringLocalizer(item.DisplayText.ResourceName).GetString(item.DisplayText.Name)
</MudSelectItem>
}
</MudSelect>
@if (feature.Description != null)
{
<MudText Typo="Typo.caption" Class="mt-1">@feature.Description</MudText>
}
} }
</MudSelect>
@if (feature.Description != null)
{
<MudText Typo="Typo.caption" Class="mt-1">@feature.Description</MudText>
}
}
@if (feature.ValueType is ToggleStringValueType) @if (feature.ValueType is ToggleStringValueType)
{ {
<MudCheckBox Disabled="@disabled" Value="@ToggleValues[feature.Name]" <MudCheckBox Disabled="@disabled" Value="@ToggleValues[feature.Name]"
ValueChanged="@(async (bool v) => await OnSelectedValueChangedAsync(v, feature))" ValueChanged="@(async (bool v) => await OnSelectedValueChangedAsync(v, feature))"
Label="@GetShownName(feature)" /> Label="@GetShownName(feature)" />
@if (feature.Description != null) @if (feature.Description != null)
{ {
<MudText Typo="Typo.caption" Class="mt-1">@feature.Description</MudText> <MudText Typo="Typo.caption" Class="mt-1">@feature.Description</MudText>
} }
}
</div>
} }
</div> </MudItem>
} </MudGrid>
</MudTabPanel> </MudTabPanel>
} }
</MudTabs> </MudTabs>
@ -83,7 +82,8 @@
</DialogContent> </DialogContent>
<DialogActions> <DialogActions>
<MudButton OnClick="@CloseModal">@L["Cancel"]</MudButton> <MudButton OnClick="@CloseModal">@L["Cancel"]</MudButton>
<MudButton Color="Color.Primary" Variant="Variant.Text" OnClick="@(async () => await DeleteAsync(ProviderName, ProviderKey))">@L["ResetToDefault"]</MudButton> <MudButton Color="Color.Primary" Variant="Variant.Text"
OnClick="@(async () => await DeleteAsync(ProviderName, ProviderKey))">@L["ResetToDefault"]</MudButton>
<MudButton Color="Color.Primary" Variant="Variant.Filled" OnClick="@SaveAsync">@L["Save"]</MudButton> <MudButton Color="Color.Primary" Variant="Variant.Filled" OnClick="@SaveAsync">@L["Save"]</MudButton>
</DialogActions> </DialogActions>
</MudDialog> </MudDialog>

Loading…
Cancel
Save