Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for IParentComponent #38

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.0" PrivateAssets="all" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.14" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.14" PrivateAssets="all" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using EasyMicroservices.UI.TemplateGenerator.Blazor.Interfaces;

namespace EasyMicroservices.UI.TemplateGenerator.Blazor.TestUI.Helpers;

public class ParentComponentHelper : IParentComponent
{
public IParentComponent Parent { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using EasyMicroservices.Domain.Contracts.Common;
using EasyMicroservices.UI.BlazorComponents;
using EasyMicroservices.UI.Cores;
using EasyMicroservices.UI.TemplateGenerator.Blazor.Pages.Generators.Components;
using EasyMicroservices.UI.TemplateGenerator.Blazor.TestUI;
using EasyMicroservices.UI.TemplateGenerator.Blazor.Interfaces;
using EasyMicroservices.UI.TemplateGenerator.Blazor.TestUI.Helpers;
using EasyMicroservices.UI.TemplateGenerator.ViewModels.Actions;
using EasyMicroservices.UI.TemplateGenerator.ViewModels.Events;
using EasyMicroservices.UI.TemplateGenerator.ViewModels.FormItems;
Expand All @@ -19,7 +19,7 @@
LoadLanguage("en-US");

var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<EasyMicroservices.UI.TemplateGenerator.Blazor.TestUI.App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
string baseAddress = "http://localhost:1050";
//string baseAddress = "https://templategenerator.adahmsay.ir/";
Expand All @@ -31,6 +31,7 @@
builder.Services.AddScoped(sp => new EventClient(baseAddress, sp.GetService<HttpClient>()));
builder.Services.AddScoped(sp => new FormItemEventClient(baseAddress, sp.GetService<HttpClient>()));

builder.Services.AddTransient<IParentComponent, ParentComponentHelper>();
builder.Services.AddTransient<FilterFormsListViewModel>();
builder.Services.AddTransient<AddOrUpdateFormViewModel>();
builder.Services.AddTransient<AddOrUpdateFormItemViewModel>();
Expand Down Expand Up @@ -137,8 +138,8 @@ void LoadLanguage(string languageShortName)
{
ShortName = languageShortName,
Value = "Do you really want to delete these records? This process cannot be undone."
});
});

BaseViewModel.AppendLanguage("Forms", new LanguageContract()
{
ShortName = languageShortName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<Authors>EasyMicroservices</Authors>
<IsPackable>true</IsPackable>
<Version>0.0.0.32</Version>
<Version>0.0.0.33</Version>
<Description>TemplateGenerator UI compoents.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>component,microcomponent,ui,core,templategenerator,generator,template,form,formgenerator</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace EasyMicroservices.UI.TemplateGenerator.Blazor.Interfaces;
public interface IParentComponent
{
public IParentComponent Parent { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
@using EasyMicroservices.UI.Cores
@using EasyMicroservices.UI.TemplateGenerator.Blazor.Interfaces
@using EasyMicroservices.UI.TemplateGenerator.ViewModels.Generators
@using EasyMicroservices.UI.TemplateGenerator.ViewModels.Generators.Components
@using MudBlazor
@using TemplateGenerators.GeneratedServices
@inject ButtonFormItemViewModel viewModel;
@implements IParentComponent

<MudRTLProvider RightToLeft="BaseViewModel.IsRightToLeft">
<MudButton Variant="Variant.Filled" Color="Color.Primary">@viewModel.FormItem?.Title</MudButton>
Expand All @@ -27,4 +29,6 @@
viewModel.FormItem = value;
}
}

public IParentComponent Parent { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
@using EasyMicroservices.UI.Cores
@using EasyMicroservices.UI.TemplateGenerator.Blazor.Interfaces
@using EasyMicroservices.UI.TemplateGenerator.ViewModels.Generators
@using EasyMicroservices.UI.TemplateGenerator.ViewModels.Generators.Components
@using MudBlazor
@using TemplateGenerators.GeneratedServices
@inject CardFormItemViewModel viewModel;
@implements IParentComponent

<MudRTLProvider RightToLeft="BaseViewModel.IsRightToLeft">
<FormItemListGenerator FormItems="@viewModel.FormItem?.Items"/>
<FormItemListGenerator @ref="Control" FormItems="@viewModel.FormItem?.Items"/>
</MudRTLProvider>

@code {
Expand All @@ -27,4 +29,20 @@
viewModel.FormItem = value;
}
}

IParentComponent _Control;
public IParentComponent Control
{
get
{
return _Control;
}
set
{
_Control = value;
value.Parent = this;
}
}

public IParentComponent Parent { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
@using EasyMicroservices.UI.Cores
@using EasyMicroservices.UI.TemplateGenerator.Blazor.Interfaces
@using EasyMicroservices.UI.TemplateGenerator.ViewModels.Generators
@using EasyMicroservices.UI.TemplateGenerator.ViewModels.Generators.Components
@using MudBlazor
@using TemplateGenerators.GeneratedServices
@inject CheckBoxFormItemViewModel viewModel;
@implements IParentComponent

<MudRTLProvider RightToLeft="BaseViewModel.IsRightToLeft">
<MudCheckBox @bind-Value="viewModel.IsChecked" Color="Color.Primary" Label="@viewModel.FormItem?.Title"></MudCheckBox>
Expand All @@ -27,4 +29,5 @@
viewModel.FormItem = value;
}
}
public IParentComponent Parent { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
@using EasyMicroservices.UI.Cores
@using EasyMicroservices.UI.TemplateGenerator.Blazor.Interfaces
@using EasyMicroservices.UI.TemplateGenerator.ViewModels.Generators
@using EasyMicroservices.UI.TemplateGenerator.ViewModels.Generators.Components
@using MudBlazor
@using TemplateGenerators.GeneratedServices
@inject DataGridFormItemViewModel viewModel;
@implements IParentComponent

<MudRTLProvider RightToLeft="BaseViewModel.IsRightToLeft">
<MudDataGrid T="FormItemContract" Items="@Items()">
Expand Down Expand Up @@ -44,4 +46,5 @@
viewModel.FormItem = value;
}
}
public IParentComponent Parent { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
@using EasyMicroservices.UI.Cores
@using EasyMicroservices.UI.TemplateGenerator.Blazor.Interfaces
@using EasyMicroservices.UI.TemplateGenerator.ViewModels.Generators
@using EasyMicroservices.UI.TemplateGenerator.ViewModels.Generators.Components
@using MudBlazor
@using TemplateGenerators.GeneratedServices
@inject DateOnlyFormItemViewModel viewModel;
@implements IParentComponent

<MudRTLProvider RightToLeft="BaseViewModel.IsRightToLeft">
<MudDatePicker DisplayMonths="2" TitleDateFormat="yyyy-MM-dd" Label="@viewModel.FormItem?.Title" Editable="true" @bind-Date="viewModel.SelectedValue" Clearable>
Expand All @@ -28,4 +30,5 @@
viewModel.FormItem = value;
}
}
public IParentComponent Parent { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
@using EasyMicroservices.UI.Cores
@using EasyMicroservices.UI.TemplateGenerator.Blazor.Interfaces
@using EasyMicroservices.UI.TemplateGenerator.ViewModels.Generators
@using EasyMicroservices.UI.TemplateGenerator.ViewModels.Generators.Components
@using MudBlazor
@using TemplateGenerators.GeneratedServices
@inject DateTimeFormItemViewModel viewModel;
@implements IParentComponent

<MudRTLProvider RightToLeft="BaseViewModel.IsRightToLeft">
<MudStack Row="true">
Expand Down Expand Up @@ -31,4 +33,5 @@
viewModel.FormItem = value;
}
}
public IParentComponent Parent { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
@using EasyMicroservices.UI.Cores
@using EasyMicroservices.UI.TemplateGenerator.Blazor.Interfaces
@using EasyMicroservices.UI.TemplateGenerator.ViewModels.Generators
@using EasyMicroservices.UI.TemplateGenerator.ViewModels.Generators.Components
@using MudBlazor
@using TemplateGenerators.GeneratedServices
@inject HorizontalStackFormItemViewModel viewModel;
@implements IParentComponent

<MudRTLProvider RightToLeft="BaseViewModel.IsRightToLeft">
<MudStack Row="true" AlignItems="AlignItems.End" Spacing="5">
@foreach (var formItem in viewModel.FormItem?.Items?.OrderBy(x => x.Index))
{
<FormItemSingleItemGenerator FormItem="@formItem" />
<FormItemSingleItemGenerator @ref="Control" FormItem="@formItem" />
}
</MudStack>
</MudRTLProvider>
Expand All @@ -32,4 +34,20 @@
viewModel.FormItem = value;
}
}

IParentComponent _Control;
public IParentComponent Control
{
get
{
return _Control;
}
set
{
_Control = value;
value.Parent = this;
}
}

public IParentComponent Parent { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
@using EasyMicroservices.UI.Cores
@using EasyMicroservices.UI.TemplateGenerator.Blazor.Interfaces
@using EasyMicroservices.UI.TemplateGenerator.ViewModels.Generators
@using EasyMicroservices.UI.TemplateGenerator.ViewModels.Generators.Components
@using MudBlazor
@using TemplateGenerators.GeneratedServices
@inject LabelFormItemViewModel viewModel;
@implements IParentComponent

<MudRTLProvider RightToLeft="BaseViewModel.IsRightToLeft">
<MudText>@viewModel.FormItem?.Title</MudText>
Expand All @@ -27,4 +29,5 @@
viewModel.FormItem = value;
}
}
public IParentComponent Parent { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
@using EasyMicroservices.UI.Cores
@using EasyMicroservices.UI.TemplateGenerator.Blazor.Interfaces
@using EasyMicroservices.UI.TemplateGenerator.ViewModels.Generators
@using EasyMicroservices.UI.TemplateGenerator.ViewModels.Generators.Components
@using MudBlazor
@using TemplateGenerators.GeneratedServices
@inject MultipleSelectFormItemViewModel viewModel;
@implements IParentComponent

<MudRTLProvider RightToLeft="BaseViewModel.IsRightToLeft">
<MudSelect T="FormItemContract" MultiSelection="true" @bind-SelectedValues="@viewModel.SelectedValues" ToStringFunc="@converter" Label="@viewModel.FormItem?.Title" AnchorOrigin="Origin.BottomCenter" Variant="Variant.Outlined" Clearable>
Expand Down Expand Up @@ -34,4 +36,5 @@
viewModel.FormItem = value;
}
}
public IParentComponent Parent { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
@using EasyMicroservices.UI.Cores
@using EasyMicroservices.UI.TemplateGenerator.Blazor.Interfaces
@using EasyMicroservices.UI.TemplateGenerator.ViewModels.Generators.Components
@using MudBlazor
@using System.Text
@using TemplateGenerators.GeneratedServices
@inject NavMenuFormItemViewModel viewModel;
@implements IParentComponent

<MudRTLProvider RightToLeft="BaseViewModel.IsRightToLeft">
<MudNavMenu Rounded="true" Margin="Margin.Normal" Color="Color.Tertiary" Class="pa-2">
@foreach (var formItem in viewModel.FormItem?.Items?.OrderBy(x => x.Index))
{
<FormItemSingleItemGenerator FormItem="@formItem" />
<FormItemSingleItemGenerator @ref="Control" FormItem="@formItem" />
}
</MudNavMenu>
</MudRTLProvider>
Expand All @@ -32,4 +34,20 @@
viewModel.FormItem = value;
}
}

IParentComponent _Control;
public IParentComponent Control
{
get
{
return _Control;
}
set
{
_Control = value;
value.Parent = this;
}
}

public IParentComponent Parent { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
@using EasyMicroservices.UI.Cores
@using EasyMicroservices.UI.TemplateGenerator.Blazor.Interfaces
@using EasyMicroservices.UI.TemplateGenerator.ViewModels.Generators.Components
@using MudBlazor
@using System.Text
@using TemplateGenerators.GeneratedServices
@inject NavMenuGroupFormItemViewModel viewModel;
@implements IParentComponent

<MudRTLProvider RightToLeft="BaseViewModel.IsRightToLeft">
<MudNavGroup Title="@viewModel.FormItem.Title">
@foreach (var formItem in viewModel.FormItem?.Items?.OrderBy(x => x.Index))
{
<FormItemSingleItemGenerator FormItem="@formItem" />
<FormItemSingleItemGenerator @ref="Control" FormItem="@formItem" />
}
</MudNavGroup>
</MudRTLProvider>
Expand All @@ -32,4 +34,18 @@
viewModel.FormItem = value;
}
}
IParentComponent _Control;
public IParentComponent Control
{
get
{
return _Control;
}
set
{
_Control = value;
value.Parent = this;
}
}
public IParentComponent Parent { get; set; }
}
Loading
Loading