-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Showing
94 changed files
with
2,555 additions
and
375 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 |
---|---|---|
@@ -0,0 +1,96 @@ | ||
@page "/definition-form" | ||
|
||
@using VxFormGenerator.Core | ||
@using VxFormGenerator.Core.Layout | ||
@using VxFormGeneratorDemoData | ||
|
||
|
||
<h1>Model Based Form Demo</h1> | ||
|
||
<div class="card"> | ||
<div class="card-header"> | ||
Change form options | ||
</div> | ||
<div class="card-body"> | ||
|
||
<EditForm Model="Options" | ||
OnSubmit="ChangeLayoutOptions"> | ||
<VxFormGenerator.Core.Validation.ObjectGraphDataAnnotationsValidator /> | ||
<RenderFormElements></RenderFormElements> | ||
<button class="btn btn-primary" type="submit">Submit</button> | ||
</EditForm> | ||
|
||
</div> | ||
</div> | ||
<br /> | ||
|
||
<div class="card"> | ||
<div class="card-header"> | ||
Generated by POCO | ||
</div> | ||
<div class="card-body"> | ||
|
||
<EditForm Model="Model" | ||
OnValidSubmit="HandleValidSubmit" | ||
OnInvalidSubmit="HandleInValidSubmit"> | ||
<VxFormGenerator.Core.Validation.ObjectGraphDataAnnotationsValidator /> | ||
<RenderFormElements FormLayoutOptions="@OptionsForForm"></RenderFormElements> | ||
<button class="btn btn-primary" type="submit">Submit</button> | ||
</EditForm> | ||
</div> | ||
</div> | ||
|
||
<br /> | ||
|
||
@code{ | ||
|
||
/// <summary> | ||
/// Model that is used for the form | ||
/// </summary> | ||
private object Model = new FeedingSession(); | ||
private VxFormLayoutOptionsAnnotated Options = new VxFormLayoutOptionsAnnotated(); | ||
private VxFormLayoutOptions OptionsForForm = new VxFormLayoutOptions(); | ||
|
||
protected override void OnInitialized() | ||
{ | ||
base.OnInitialized(); | ||
|
||
ChangeLayoutOptions(new EditContext(Options)); | ||
} | ||
|
||
/// <summary> | ||
/// Will handle the submit action of the form | ||
/// </summary> | ||
/// <param name="context">The model with values as entered in the form</param> | ||
private void HandleValidSubmit(EditContext context) | ||
{ | ||
// save your changes | ||
} | ||
|
||
private void HandleInValidSubmit(EditContext context) | ||
{ | ||
|
||
|
||
} | ||
|
||
private void ChangeLayoutOptions(EditContext context) | ||
{ | ||
var options = ((VxFormLayoutOptionsAnnotated)context.Model); | ||
OptionsForForm = options.ToFormLayoutOptions(); | ||
|
||
switch (options.FormRenderKind) | ||
{ | ||
case TypeOfForm.SIMPLE: | ||
Model = new FeedingSession(); | ||
break; | ||
case TypeOfForm.ADVANCED: | ||
Model = new AddressViewModel(); | ||
break; | ||
case TypeOfForm.COMPLEX: | ||
Model = new OrderViewModel(); | ||
break; | ||
} | ||
|
||
} | ||
|
||
} |
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 was deleted.
Oops, something went wrong.
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
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
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,12 @@ | ||
|
||
<Project> | ||
<PropertyGroup> | ||
<Deterministic>true</Deterministic> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo"> | ||
<_Parameter1>$(MSBuildProjectName).Tests</_Parameter1> | ||
</AssemblyAttribute> | ||
</ItemGroup> | ||
</Project> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Oops, something went wrong.