commit 65f2d94030e6c6b402068bdf70dec2844ee8cf53
parent 1d768a28d5976c4a1d521ff90674d8b54da685b1
Author: Sebastian <sebasjm@gmail.com>
Date: Mon, 13 May 2024 14:53:35 -0300
updated docs
Diffstat:
5 files changed, 131 insertions(+), 0 deletions(-)
diff --git a/design-documents/054-dynamic-form.rst b/design-documents/054-dynamic-form.rst
@@ -396,6 +396,43 @@ already present in the list, and for that it will use ``labelFieldId``.
fields: UIFormElementConfig[];
} & UIFormFieldBaseConfig;
+.. code-block:: json
+
+ {
+ "label": "Example form",
+ "id": "example",
+ "version": 1,
+ "config": {
+ "type": "double-column",
+ "design": [
+ {
+ "title": "Amount inputs",
+ "fields": [
+ {
+ "type": "array",
+ "name": "people",
+ "id": ".people",
+ "help": "who is coming to the party?",
+ "labelFieldId": ".name",
+ "fields": [{
+ "type": "text",
+ "name": "firstName",
+ "id": ".name",
+ "label": "First name"
+ },
+ {
+ "type": "text",
+ "name": "lastName",
+ "id": ".lastName",
+ "label": "Last name"
+ }],
+ }
+ ]
+ }
+ ]
+ }
+ }
+
.. image:: ../screenshots/dynamic-forms.list.png
:width: 400
@@ -454,6 +491,49 @@ will produce a list of values in the resulting JSON.
choices: Array<SelectUiChoice>;
} & UIFormFieldBaseConfig;
+
+.. code-block:: json
+
+ {
+ "label": "Example form",
+ "id": "example",
+ "version": 1,
+ "config": {
+ "type": "double-column",
+ "design": [
+ {
+ "title": "Choice inputs",
+ "fields": [
+ {
+ "type": "choiceHorizontal",
+ "name": "food",
+ "label": "Food",
+ "id": ".food",
+ "choices": [
+ {
+ "value": "meat",
+ "label": "Meat"
+ },
+ {
+ "value": "sushi",
+ "label": "Sushi"
+ },
+ {
+ "value": "taco",
+ "label": "Taco"
+ },
+ {
+ "value": "salad",
+ "label": "Salad"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ }
+
.. image:: ../screenshots/dynamic-forms.choice.png
:width: 400
@@ -471,6 +551,32 @@ File input
accept?: string;
} & UIFormFieldBaseConfig;
+
+.. code-block:: json
+
+ {
+ "label": "Example form",
+ "id": "example",
+ "version": 1,
+ "config": {
+ "type": "double-column",
+ "design": [
+ {
+ "title": "File inputs",
+ "fields": [
+ {
+ "type": "file",
+ "name": "photo",
+ "id": ".photo",
+ "label": "Photo",
+ "accept": "*.png"
+ }
+ ]
+ }
+ ]
+ }
+ }
+
.. image:: ../screenshots/dynamic-forms.file.png
:width: 400
@@ -515,6 +621,31 @@ Boolean input
type UIFormFieldToggle = { type: "toggle" } & UIFormFieldBaseConfig;
+
+.. code-block:: json
+
+ {
+ "label": "Example form",
+ "id": "example",
+ "version": 1,
+ "config": {
+ "type": "double-column",
+ "design": [
+ {
+ "title": "Boolean inputs",
+ "fields": [
+ {
+ "type": "toggle",
+ "name": "the_question",
+ "id": ".the_question",
+ "label": "Yes or no?"
+ }
+ ]
+ }
+ ]
+ }
+ }
+
.. image:: ../screenshots/dynamic-forms.boolean.png
:width: 400
diff --git a/screenshots/dynamic-forms.boolean.png b/screenshots/dynamic-forms.boolean.png
Binary files differ.
diff --git a/screenshots/dynamic-forms.choice.png b/screenshots/dynamic-forms.choice.png
Binary files differ.
diff --git a/screenshots/dynamic-forms.file.png b/screenshots/dynamic-forms.file.png
Binary files differ.
diff --git a/screenshots/dynamic-forms.list.png b/screenshots/dynamic-forms.list.png
Binary files differ.