-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
48246ea
commit 8ceeb27
Showing
18 changed files
with
1,125 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks> | ||
<Authors>EasyMicroservices</Authors> | ||
<IsPackable>true</IsPackable> | ||
<Version>0.0.0.17</Version> | ||
<Version>0.0.0.18</Version> | ||
<Description>TemplateGenerator UI compoents.</Description> | ||
<Copyright>[email protected]</Copyright> | ||
<PackageTags>component,microcomponent,ui,core,templategenerator,generator,template,form,formgenerator</PackageTags> | ||
|
@@ -16,7 +16,7 @@ | |
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="EasyMicroservices.UI.BlazorComponents" Version="*" /> | ||
<PackageReference Include="EasyMicroservices.UI.BlazorComponents" Version="0.0.0.20" /> | ||
<PackageReference Include="MudBlazor" Version="6.12.0" /> | ||
</ItemGroup> | ||
|
||
|
51 changes: 51 additions & 0 deletions
51
src/CSharp/Blazor/EasyMicroservices.UI.TemplateGenerator.Blazor/Pages/Actions/Actions.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
@using EasyMicroservices.UI.Cores | ||
@using EasyMicroservices.UI.TemplateGenerator.ViewModels.Actions | ||
@using EasyMicroservices.UI.TemplateGenerator.ViewModels.Generators | ||
@using MudBlazor | ||
@using TemplateGenerators.GeneratedServices | ||
@inject ActionsViewModel viewModel; | ||
|
||
<MudRTLProvider RightToLeft="BaseViewModel.IsRightToLeft"> | ||
<MudSelect @bind-Value="viewModel.SelectedAction" Label="@viewModel.GetLanguage("Action")" OpenIcon="@Icons.Material.Filled.LocalDrink" AdornmentColor="Color.Secondary"> | ||
@foreach (var item in viewModel.Actions) | ||
{ | ||
<MudSelectItem Value="@item">@viewModel.GetLanguage(@item.JobName)</MudSelectItem> | ||
} | ||
</MudSelect> | ||
</MudRTLProvider> | ||
|
||
@code { | ||
public ActionsViewModel ViewModel | ||
{ | ||
get | ||
{ | ||
return viewModel; | ||
} | ||
} | ||
|
||
protected override void OnInitialized() | ||
{ | ||
ViewModel.BindSpecifiedPropertyChanged(nameof(ActionsViewModel.SelectedAction), () => | ||
{ | ||
SelectedActionChanged.InvokeAsync(SelectedAction); | ||
}); | ||
base.OnInitialized(); | ||
} | ||
|
||
[Parameter] | ||
[Category(CategoryTypes.FormComponent.Data)] | ||
public ActionContract SelectedAction | ||
{ | ||
get | ||
{ | ||
return ViewModel.SelectedAction; | ||
} | ||
set | ||
{ | ||
ViewModel.SelectedAction = value; | ||
} | ||
} | ||
|
||
[Parameter] | ||
public EventCallback<ActionContract> SelectedActionChanged { get; set; } | ||
} |
47 changes: 47 additions & 0 deletions
47
.../EasyMicroservices.UI.TemplateGenerator.Blazor/Pages/Actions/AddOrUpdateEventAction.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
@using EasyMicroservices.UI.BlazorComponents | ||
@using EasyMicroservices.UI.Cores | ||
@using EasyMicroservices.UI.TemplateGenerator.ViewModels.Actions | ||
@using EasyMicroservices.UI.TemplateGenerator.ViewModels.Events | ||
@using EasyMicroservices.UI.TemplateGenerator.ViewModels.Generators | ||
@using MudBlazor | ||
@using TemplateGenerators.GeneratedServices | ||
@inject AddOrUpdateEventActionViewModel viewModel; | ||
|
||
<MudRTLProvider RightToLeft="BaseViewModel.IsRightToLeft"> | ||
<MudStack> | ||
<Actions @ref="actionsView" @bind-SelectedAction="@viewModel.SelectedAction" /> | ||
<EventActionsList/> | ||
</MudStack> | ||
</MudRTLProvider> | ||
|
||
@code { | ||
public AddOrUpdateEventActionViewModel ViewModel | ||
{ | ||
get | ||
{ | ||
return viewModel; | ||
} | ||
} | ||
|
||
protected override void OnInitialized() | ||
{ | ||
ViewModel.BindPropertyChanged(StateHasChanged); | ||
base.OnInitialized(); | ||
} | ||
|
||
[Parameter] | ||
[Category(CategoryTypes.FormComponent.Data)] | ||
public ActionContract SelectedAction | ||
{ | ||
get | ||
{ | ||
return viewModel.SelectedAction; | ||
} | ||
set | ||
{ | ||
viewModel.SelectedAction = value; | ||
} | ||
} | ||
|
||
public Actions actionsView; | ||
} |
140 changes: 140 additions & 0 deletions
140
...Blazor/EasyMicroservices.UI.TemplateGenerator.Blazor/Pages/Actions/EventActionsList.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
@using EasyMicroservices.UI.BlazorComponents | ||
@using EasyMicroservices.UI.Cores | ||
@using EasyMicroservices.UI.TemplateGenerator.ViewModels.Actions | ||
@using EasyMicroservices.UI.TemplateGenerator.ViewModels.Events | ||
@using EasyMicroservices.UI.TemplateGenerator.ViewModels.Generators | ||
@using MudBlazor | ||
@using TemplateGenerators.GeneratedServices | ||
@inject EventActionsListViewModel viewModel; | ||
|
||
<MudRTLProvider RightToLeft="BaseViewModel.IsRightToLeft"> | ||
<MudDataGrid T="FormItemEventActionContract" Items="viewModel.Children"> | ||
<ToolBarContent> | ||
<MudStack AlignItems="AlignItems.Center" Row="true" Spacing="5"> | ||
<MudFab Color="Color.Primary" StartIcon="@Icons.Material.Filled.Add" OnClick="(arg) => ShowAddActionDialog()" /> | ||
<MudText Typo="Typo.h6" mar> | ||
@viewModel.GetLanguage("Actions") | ||
</MudText> | ||
</MudStack> | ||
</ToolBarContent> | ||
<Columns> | ||
<TemplateColumn CellClass="d-flex justify-end"> | ||
<CellTemplate> | ||
<MudIconButton Size="@Size.Small" Icon="@Icons.Material.Outlined.KeyboardArrowUp" OnClick="(arg) => viewModel.IndexOrderingActions.MoveUp(context.Item)" /> | ||
<MudIconButton Size="@Size.Small" Icon="@Icons.Material.Outlined.KeyboardArrowDown" OnClick="(arg) => viewModel.IndexOrderingActions.MoveDown(context.Item)" /> | ||
</CellTemplate> | ||
</TemplateColumn> | ||
<PropertyColumn Property="x => x.OrderIndex" Title="@viewModel.GetLanguage("Index")" /> | ||
<PropertyColumn Property="x => viewModel.GetLanguage(x.Action.JobName)" Title="@viewModel.GetLanguage("Job")" /> | ||
<TemplateColumn CellClass="d-flex justify-end"> | ||
<CellTemplate> | ||
<MudIconButton Size="@Size.Small" Icon="@Icons.Material.Outlined.Edit" OnClick="(arg) => ShowUpdateDialog(context.Item)" /> | ||
<MudIconButton Size="@Size.Small" Icon="@Icons.Material.Outlined.Delete" Color="Color.Error" OnClick="(arg) => ShowDeleteDialog(context.Item)" /> | ||
</CellTemplate> | ||
</TemplateColumn> | ||
</Columns> | ||
</MudDataGrid> | ||
<BaseDialog @ref="addOrUpdateActionDialog"> | ||
<TitleContent> | ||
<MudText Typo="Typo.h6"> | ||
<MudIcon Icon="@Icons.Material.Filled.Edit" Class="mr-3" /> | ||
Add | ||
</MudText> | ||
</TitleContent> | ||
<DialogContent> | ||
<AddOrUpdateEventAction @ref="AddOrUpdateEventActionView" /> | ||
</DialogContent> | ||
<DialogActions> | ||
<MudButton OnClick="() => addOrUpdateActionDialog.CloseDialog()"> | ||
@viewModel.GetLanguage("Cancel") | ||
</MudButton> | ||
<MudButton Color="Color.Primary" Variant="Variant.Filled" OnClick="()=>Save()"> | ||
<MudText> | ||
@viewModel.GetLanguage("Save") | ||
</MudText> | ||
</MudButton> | ||
</DialogActions> | ||
</BaseDialog> | ||
|
||
<BaseDialog @ref="deleteDialog"> | ||
<TitleContent> | ||
<MudText> | ||
@viewModel.GetLanguage("DeleteAction_Title") | ||
</MudText> | ||
</TitleContent> | ||
<DialogContent> | ||
@viewModel.GetLanguage("DeleteQuestion_Content") | ||
</DialogContent> | ||
<DialogActions> | ||
<MudButton OnClick="() => deleteDialog.CloseDialog()"> | ||
@viewModel.GetLanguage("Cancel") | ||
</MudButton> | ||
<MudButton Color="Color.Error" Variant="Variant.Filled" Disabled="viewModel.IsBusy" OnClick="DoDelete"> | ||
<MudText> | ||
@viewModel.GetLanguage("Delete") | ||
</MudText> | ||
</MudButton> | ||
</DialogActions> | ||
</BaseDialog> | ||
</MudRTLProvider> | ||
|
||
@code { | ||
public EventActionsListViewModel ViewModel | ||
{ | ||
get | ||
{ | ||
return viewModel; | ||
} | ||
} | ||
|
||
protected override void OnInitialized() | ||
{ | ||
ViewModel.BindPropertyChanged(StateHasChanged); | ||
base.OnInitialized(); | ||
} | ||
|
||
BaseDialog addOrUpdateActionDialog; | ||
BaseDialog deleteDialog; | ||
AddOrUpdateEventAction AddOrUpdateEventActionView; | ||
Actions actionsView; | ||
|
||
void ShowAddActionDialog() | ||
{ | ||
ViewModel.CurrentFormItemAction = currentUpdate = null; | ||
addOrUpdateActionDialog.ShowDialog(); | ||
} | ||
|
||
void Save() | ||
{ | ||
if (AddOrUpdateEventActionView.ViewModel.SelectedAction != null) | ||
{ | ||
if (currentUpdate != null) | ||
viewModel.Children.Remove(currentUpdate); | ||
viewModel.Children.Add(AddOrUpdateEventActionView.ViewModel.GetEventAction()); | ||
addOrUpdateActionDialog.CloseDialog(); | ||
} | ||
} | ||
|
||
void ShowDeleteDialog(FormItemEventActionContract item) | ||
{ | ||
ViewModel.SelectedFormItemEventAction = item; | ||
deleteDialog.ShowDialog(); | ||
} | ||
|
||
void DoDelete() | ||
{ | ||
viewModel.DoDeleteSelected(); | ||
deleteDialog.CloseDialog(); | ||
} | ||
|
||
FormItemEventActionContract currentUpdate; | ||
void ShowUpdateDialog(FormItemEventActionContract item) | ||
{ | ||
currentUpdate = item; | ||
addOrUpdateActionDialog.ShowDialog(() => | ||
{ | ||
AddOrUpdateEventActionView.ViewModel.CurrentFormItemAction = item; | ||
AddOrUpdateEventActionView.ViewModel.SelectedAction = AddOrUpdateEventActionView.actionsView.ViewModel.Actions.FirstOrDefault(x => x.Id == item.ActionId); | ||
}); | ||
} | ||
} |
Oops, something went wrong.