-
Notifications
You must be signed in to change notification settings - Fork 0
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
10 changed files
with
140 additions
and
7 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,14 @@ | ||
# Form Builder REST API Reference | ||
|
||
The Form Builder REST API provides endpoints to manage forms and list of values (LOV). | ||
You can use the Form Builder API to create, update, delete, and retrieve forms and LOV data. | ||
|
||
## Form API | ||
- `GET /api/forms`: Get all forms in the form of paged response. | ||
- Query Parameters: | ||
- `page`: The non-zero-based page number. Default is 1. | ||
- `pageSize`: The number of items per page. Default is 10. | ||
- Response: | ||
- `pageSize`: The number of items per page. | ||
- `pagesCount`: The total number of available pages. | ||
- `data`: An array of form data. |
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 @@ | ||
# Form Renderer Component Reference | ||
|
||
The Form Renderer component is used to render forms in that designed by the `FormEditor` component. | ||
You can specify either the `FormId` or `FormJson` property to render a form. | ||
|
||
## FormRenderer Properties | ||
- `FormId`: The ID of the form to render. It fetches form data from the API based on the ID. | ||
- `FormJson`: The JSON data of the form to render. You can pass the JSON data of the form directly to the component. | ||
- `IsLoadingForm`: A boolean value that indicates whether the form is loading and rendering. | ||
|
||
## FormRenderer Events | ||
- `IsLoadingFormChanged`: An event that is triggered when the `IsLoadingForm` property changes. You can use this event to perform additional actions when the form is loading. | ||
- `FormLoaded`: An event that is triggered when the form is loaded and rendered. You can use this event to perform additional actions when the form is loaded. | ||
|
||
## FormRenderer public methods | ||
- `LoadFormFromIdAsync(string formId)`: A method that loads the form data from the API based on the form ID. | ||
- `LoadFormFromJsonAsync(string formJson)`: A method that loads the form data from the JSON data. | ||
- `GetFormAsJsonAsync()`: A method that returns the JSON data of the rendered form. | ||
|
||
## Examples | ||
## Render a form using FormId or FormJson properties | ||
```html | ||
<FormRenderer FormId="1" /> | ||
``` | ||
```html | ||
<FormRenderer FormJson="@formJson" /> | ||
``` | ||
|
||
## Render a form dynamically using methods | ||
```html | ||
<FormRenderer @ref="formRendererRef" /> | ||
|
||
<RadzenTextBox @bind-Value="_formId" /> | ||
<RadzenButton Text="Load Form" Click="@LoadForm" /> | ||
``` | ||
```csharp | ||
@code { | ||
private FormRenderer? formRendererRef; | ||
private string? _formId; | ||
|
||
private async Task LoadForm() | ||
{ | ||
if (formRendererRef is null || string.IsNullOrEmpty(_formId)) | ||
{ | ||
return; | ||
} | ||
|
||
await formRenderer.LoadFormFromIdAsync(_formId); | ||
} | ||
} | ||
``` |
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,58 @@ | ||
# How to integrate FormBuilder with your Blazor application | ||
|
||
This guide explains how to integrate the Blazor Form Builder with your existing Blazor application. The integration process involves the following steps: | ||
|
||
1. **Add the FormBuilder Razor class library to your Blazor application**: | ||
Add the `FormBuilder` Razor class library to your Blazor application as a project reference. | ||
|
||
2. **Register the FormBuilder services**: | ||
Add `AddFormBuilder()` to the service collection in the `Program.cs` file. | ||
Also, you need to pass `FormApiUrl` to the `AddFormBuilder()` method. The `FormApiUrl` is the URL of the Form Builder API. | ||
For example: | ||
```csharp | ||
builder.Services.AddFormBuilder(options => | ||
{ | ||
options.FormApiUrl = "https://localhost:8000"; | ||
}); | ||
``` | ||
|
||
3. **Add styles and scripts**: | ||
Include the required styles and scripts in the `index.html` file. | ||
Add the following styles to the `head` section: | ||
```html | ||
<link href="_content/FormBuilder/css/app.css" rel="stylesheet" /> | ||
``` | ||
The `app.css` file includes styles for Radzen components and Bootstrap 5. | ||
Alternatively, you can directly include Radzen styles and Bootstrap in your application. | ||
For example: | ||
```html | ||
<link href="_content/Radzen.Blazor/css/standard-base.css" rel="stylesheet" /> <!-- Radzen standard theme --> | ||
<link href="_content/{YOUR_APPLICATION_NAME}/css/bootstrap/bootstrap.min.css" rel="stylesheet" /> | ||
``` | ||
Add the following scripts to the `body` section: | ||
```html | ||
<script src="_content/FormBuilder/js/app.js"></script> | ||
``` | ||
The `app.js` file includes scripts for Radzen components. | ||
Alternatively, you can directly include Radzen scripts in your application. | ||
For example: | ||
```html | ||
<script src="_content/Radzen.Blazor/Radzen.Blazor.js"></script> | ||
``` | ||
4. **Use FormEditor component**: | ||
Use the `FormEditor` component in your Blazor application to design forms. | ||
For example: | ||
```html | ||
<FormEditor /> | ||
``` | ||
|
||
5. **Use FormRenderer component**: | ||
Use the `FormRenderer` component in your Blazor application to render forms. | ||
For example: | ||
```html | ||
<FormRenderer FormId="1" /> | ||
``` | ||
|
||
You can view a sample Blazor application that integrates the Blazor Form Builder in the `src/FormBuilder.DesignerApp` project. | ||
The sample application demonstrates how to design and render forms using the Blazor Form Builder components. | ||
|
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"FormBuilderOptions": { | ||
"FormApiUrl": "https://localhost:7000" | ||
"FormBuilder": { | ||
"FormApiHost": "https://localhost:7000" | ||
} | ||
} |
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,6 @@ | ||
namespace FormBuilder.Services; | ||
|
||
public interface IFormService | ||
{ | ||
|
||
} |