-
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
5c7370d
commit ac4d5f2
Showing
4 changed files
with
295 additions
and
0 deletions.
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
packages/dm-core-plugins/blueprints/form/docs/Documentation.md
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,74 @@ | ||
Form allows user to input and save data. | ||
|
||
## Table of contents | ||
- [Selecting form fields](#fields) | ||
- [Using widgets](#using-widgets) | ||
- [Configuring recipe for nested objects](#object-recipes) | ||
- [Available Widgets](#available-widgets) | ||
|
||
|
||
### Selecting form fields \{#fields} | ||
Pass field names defined in blueprint to fields array. | ||
```json {3} | ||
"config": { | ||
"type": "PLUGINS:dm-core-plugins/form/FormInput", | ||
"fields": ["name", "date_of_birth", "address"] | ||
} | ||
``` | ||
|
||
### Using widgets \{#using-widgets} | ||
```json {7} | ||
"config": { | ||
"type": "PLUGINS:dm-core-plugins/form/FormInput", | ||
"attributes": [ | ||
{ | ||
"name": "date_of_birth", | ||
"type": "PLUGINS:dm-core-plugins/form/fields/StringField", | ||
"widget": "DateTimeWidget" | ||
} | ||
], | ||
"fields": ["name", "date_of_birth", "address"] | ||
} | ||
``` | ||
|
||
### Configuring recipe for nested objects \{#object-recipes} | ||
```json {8} | ||
"config": { | ||
"type": "PLUGINS:dm-core-plugins/form/FormInput", | ||
"attributes": [ | ||
{ | ||
"name": "address", | ||
"type": "PLUGINS:dm-core-plugins/form/fields/ObjectField", | ||
"showInline": true, | ||
"uiRecipe": "Edit" | ||
} | ||
], | ||
"fields": ["name", "date_of_birth", "address"] | ||
} | ||
``` | ||
|
||
|
||
### Available Widgets \{#available-widgets} | ||
`CheckboxWidget`: [Blueprint](./Blueprints.md#CheckboxWidget) | ||
|
||
`TextWidget`: [Blueprint](./Blueprints.md#TextWidget) | ||
|
||
`TextareaWidget`: [Blueprint](./Blueprints.md#TextareaWidget) | ||
|
||
`BlueprintPickerWidget`: [Blueprint](./Blueprints.md#BlueprintPickerWidget) | ||
|
||
`TypeWidget`: [Blueprint](./Blueprints.md#TypeWidget) | ||
|
||
`SwitchWidget`: [Blueprint](./Blueprints.md#SwitchWidget) | ||
|
||
`SelectWidget`: [Blueprint](./Blueprints.md#SelectWidget) | ||
|
||
`NumberWidget`: [Blueprint](./Blueprints.md#NumberWidget) | ||
|
||
`DateTimeWidget`: [Blueprint](./Blueprints.md#DateTimeWidget) | ||
|
||
`DimensionalScalarWidget`: [Blueprint](./Blueprints.md#DimensionalScalarWidget) | ||
|
||
`EntityPickerWidget`: [Blueprint](./Blueprints.md#EntityPickerWidget) | ||
|
||
`HyperlinkWidget`: [Blueprint](./Blueprints.md#HyperlinkWidget) |
56 changes: 56 additions & 0 deletions
56
packages/dm-core-plugins/blueprints/form/docs/Examples/Basic.json
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,56 @@ | ||
{ | ||
"title": "Basic Form", | ||
"description": "Minimal example for use of form plugin", | ||
"note": "", | ||
"showDemo": true, | ||
"entityFilePrefix": "car", | ||
"blueprint": { | ||
"name": "Car", | ||
"type": "CORE:Blueprint", | ||
"description": "", | ||
"attributes": [ | ||
{ | ||
"name": "type", | ||
"type": "dmss://system/SIMOS/BlueprintAttribute", | ||
"attributeType": "string", | ||
"optional": false | ||
}, | ||
{ | ||
"name": "name", | ||
"type": "CORE:BlueprintAttribute", | ||
"attributeType": "string", | ||
"label": "Manufacturer" | ||
}, | ||
{ | ||
"name": "model", | ||
"type": "CORE:BlueprintAttribute", | ||
"attributeType": "string", | ||
"label": "Model" | ||
}, | ||
{ | ||
"name": "color", | ||
"type": "CORE:BlueprintAttribute", | ||
"attributeType": "string", | ||
"label": "Color", | ||
"optional": true | ||
} | ||
] | ||
}, | ||
"entity": { | ||
"type": "./Car", | ||
"_id": "volvo-in-car-list", | ||
"name": "Volvo", | ||
"color": "White", | ||
"model": "XC40" | ||
}, | ||
"recipe": { | ||
"name": "car", | ||
"type": "CORE:UiRecipe", | ||
"description": "Car form", | ||
"plugin": "@development-framework/dm-core-plugins/form", | ||
"config": { | ||
"type": "PLUGINS:dm-core-plugins/form/FormInput", | ||
"fields": ["name", "color", "model"] | ||
} | ||
} | ||
} |
105 changes: 105 additions & 0 deletions
105
packages/dm-core-plugins/blueprints/form/docs/Examples/Nested.json
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,105 @@ | ||
{ | ||
"title": "Nested Form", | ||
"description": "Nested example for use of form plugin", | ||
"note": "", | ||
"showDemo": false, | ||
"entityFilePrefix": "person", | ||
"blueprint": { | ||
"name": "Person", | ||
"type": "CORE:Blueprint", | ||
"description": "", | ||
"attributes": [ | ||
{ | ||
"name": "type", | ||
"type": "dmss://system/SIMOS/BlueprintAttribute", | ||
"attributeType": "string", | ||
"optional": false | ||
}, | ||
{ | ||
"name": "name", | ||
"type": "CORE:BlueprintAttribute", | ||
"attributeType": "string", | ||
"label": "Name" | ||
}, | ||
{ | ||
"name": "data_of_birth", | ||
"type": "CORE:BlueprintAttribute", | ||
"attributeType": "string", | ||
"label": "Date of birth" | ||
}, | ||
{ | ||
"name": "address", | ||
"type": "CORE:BlueprintAttribute", | ||
"attributeType": "./Address", | ||
"label": "Address" | ||
} | ||
] | ||
}, | ||
"entity": { | ||
"type": "./Person", | ||
"_id": "1179c897-df62-445f-87e4-f393b4253936", | ||
"name": "Joe Biden", | ||
"date_of_birth": "1942-11-20T00:00:00.000+01:00", | ||
"address": { | ||
"street": "1600 Pennsylvania Avenue NW", | ||
"postal_code": "20500", | ||
"city": "Washington DC" | ||
} | ||
}, | ||
"recipe": { | ||
"name": "person", | ||
"type": "CORE:UiRecipe", | ||
"description": "Person form", | ||
"plugin": "@development-framework/dm-core-plugins/form", | ||
"config": { | ||
"type": "PLUGINS:dm-core-plugins/form/FormInput", | ||
"attributes": [ | ||
{ | ||
"name": "date_of_birth", | ||
"type": "PLUGINS:dm-core-plugins/form/fields/StringField", | ||
"widget": "DateTimeWidget" | ||
}, | ||
{ | ||
"name": "address", | ||
"type": "PLUGINS:dm-core-plugins/form/fields/ObjectField", | ||
"showInline": true, | ||
"uiRecipe": "Edit" | ||
} | ||
], | ||
"fields": ["name", "date_of_birth", "address"] | ||
} | ||
}, | ||
"childBlueprints": [ | ||
{ | ||
"name": "Address", | ||
"type": "CORE:Blueprint", | ||
"description": "", | ||
"attributes": [ | ||
{ | ||
"name": "type", | ||
"type": "dmss://system/SIMOS/BlueprintAttribute", | ||
"attributeType": "string", | ||
"optional": false | ||
}, | ||
{ | ||
"name": "street", | ||
"type": "CORE:BlueprintAttribute", | ||
"attributeType": "string", | ||
"label": "Street" | ||
}, | ||
{ | ||
"name": "postal_code", | ||
"type": "CORE:BlueprintAttribute", | ||
"attributeType": "string", | ||
"label": "Postal code" | ||
}, | ||
{ | ||
"name": "city", | ||
"type": "CORE:BlueprintAttribute", | ||
"attributeType": "string", | ||
"label": "City" | ||
} | ||
] | ||
} | ||
] | ||
} |
60 changes: 60 additions & 0 deletions
60
packages/dm-core-plugins/blueprints/form/docs/Examples/WidgetExample.json
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,60 @@ | ||
{ | ||
"title": "Widget Example", | ||
"description": "Example on how to configure use widget in form recipe", | ||
"note": "", | ||
"showDemo": true, | ||
"entityFilePrefix": "person", | ||
"blueprint": { | ||
"name": "Person", | ||
"type": "CORE:Blueprint", | ||
"description": "", | ||
"attributes": [ | ||
{ | ||
"name": "type", | ||
"type": "dmss://system/SIMOS/BlueprintAttribute", | ||
"attributeType": "string", | ||
"optional": false | ||
}, | ||
{ | ||
"name": "name", | ||
"type": "CORE:BlueprintAttribute", | ||
"attributeType": "string", | ||
"label": "Name" | ||
}, | ||
{ | ||
"name": "date_of_birth", | ||
"type": "CORE:BlueprintAttribute", | ||
"attributeType": "string", | ||
"label": "Date of birth" | ||
} | ||
] | ||
}, | ||
"entity": { | ||
"type": "./Person", | ||
"_id": "1179c897-df62-445f-87e4-f393b4253936", | ||
"name": "Joe Biden", | ||
"date_of_birth": "1942-11-20T00:00:00.000+01:00", | ||
"address": { | ||
"street": "1600 Pennsylvania Avenue NW", | ||
"postal_code": "20500", | ||
"city": "Washington DC" | ||
} | ||
}, | ||
"recipe": { | ||
"name": "person", | ||
"type": "CORE:UiRecipe", | ||
"description": "Person form", | ||
"plugin": "@development-framework/dm-core-plugins/form", | ||
"config": { | ||
"type": "PLUGINS:dm-core-plugins/form/FormInput", | ||
"attributes": [ | ||
{ | ||
"name": "date_of_birth", | ||
"type": "PLUGINS:dm-core-plugins/form/fields/StringField", | ||
"widget": "DateTimeWidget" | ||
} | ||
], | ||
"fields": ["name", "date_of_birth"] | ||
} | ||
} | ||
} |