Merge pull request #384 from nowcommunity/docs-for-fieldwithtableselection-and-formtextfield

Added docs for FieldWithTableSelection and FormTextField
This commit is contained in:
Aaro Koivukangas
2024-10-23 13:56:53 +03:00
committed by GitHub
4 changed files with 19 additions and 1 deletions
@@ -9,6 +9,6 @@ The DropDownSelector component is used by giving it
The options array consists of strings, numbers or objects of type DropDownOption. A DropDownOption is a simple object that contains the actual value, a display string which is used to show the option's name to the user, and an optional optionDisplay string which is an alternate name for the option used, for example, when the option is inside of a menu.
If `disabled` is set to true, the dropdown selector cannot be clicked.
If `disabled` is set to true, the DropDownSelector cannot be clicked.
If the selected value is invalid, the DropDownSelector will show a red text underneath it explaining the issue. This is done by getting the validator from the current context (if one exists), and then passing it the current `editData` (also from context) and the `field` value. The validator will check if the value in editData corresponding to `field` is valid.
@@ -0,0 +1,14 @@
### FieldWithTableSelection Component
The FieldWithTableSelection component is used by giving it
- a `targetField` which is the field in editData that the component should change (Required)
- a `sourceField` which is a field in the object that the FieldWithTableSelection receives when the user selects an item (Required)
- a `selectorTable` which is the table that is shown when the user clicks the field (Required)
- a `disabled` boolean value (Optional)
The FieldWithTableSelection looks like a normal text field. When the user clicks the field, a pop-up with a table view is shown. When the user selects an item from this table, the `selectorFn` function inside the component is called, with the `selected` parameter being an object that contains the item's data. Since we don't want to write this entire object to editData, the `sourceField` parameter is used to specify which field we want to use.
If `disabled` is set to true, the FieldWithTableSelection cannot be clicked.
If the user selects an invalid value, the FieldWithTableSelection will show a red text underneath it explaining the issue. This is done by getting the validator from the current context (if one exists), and then passing it the current `editData` (also from context) and the `targetField` value. The validator will check if the value in editData corresponding to `targetField` is valid.
@@ -0,0 +1,3 @@
### FormTextField Component
The FormTextField component is currently not used anywhere.
+1
View File
@@ -20,3 +20,4 @@
[RadioSelector](./editingComponents/RadioSelector.md)
[DropDownSelector](./editingComponents/DropDownSelector.md)
[FieldWithTableSelection](./editingComponents/FieldWithTableSelection.md)