Skip to content

Commit

Permalink
[fix] docs of new form controls
Browse files Browse the repository at this point in the history
  • Loading branch information
mafanya23 committed Aug 22, 2023
1 parent 367e019 commit ee85b92
Show file tree
Hide file tree
Showing 11 changed files with 265 additions and 221 deletions.
6 changes: 3 additions & 3 deletions docs/form/api/avatar/avatar_beforechange_event.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ Return `false` to prevent changing the value of the control; otherwise, `true`.

@example:
form.getItem("avatar").events.on("beforeChange", value => {
return (value.file && value.file?.name?.length > 10) ?? true;
// prevent changes if the name of the uploaded file is
// less than 10 characters including the extension
return value.file && value.file.size <= 2097152;
// prevent changes if the size of the uploaded file is
// more than 2Mb or the file is empty
});

@descr:
2 changes: 1 addition & 1 deletion docs/form/api/avatar/avatar_selectfile_method.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ description: You can explore the selectFile method of the Avatar control of Form

@example:
form.getItem("avatar").selectFile();
// -> true/false


@descr:
The type and extension of the selected image depends on the [accept](form/api/avatar/api_avatar_properties.md/#accept) property in the [control's configuration](form/api/avatar/api_avatar_properties.md).
2 changes: 1 addition & 1 deletion docs/form/api/avatar/avatar_setvalue_method.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ description: You can explore the setValue method of the Avatar control of Form i
form.getItem("avatar").setValue([
{
"id": "image",
"src": "http://domen/upload/files/image.png",
"src": "https://server.domain/upload/image.jpg",
"status": "uploaded"
}
]);
Expand Down
10 changes: 5 additions & 5 deletions docs/form/api/fieldset/fieldset_foreach_method.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ description: You can explore the forEach method of the Fieldset control of Form

# forEach()

@short: allows iterating through all the nested elements
@short: allows iterating through all the nested items

@signature: {'forEach(callback: (item: obj, index: number, array: obj[]) => void, tree?: boolean): void;'}

@params:

- `callback: function` - a function that will iterate over the elements of the fieldset. It is called with the following arguments:
- `item: object` - the object of an element (control)
- `callback: function` - a function that will iterate over the items of the fieldset. It is called with the following arguments:
- `item: object` - the object of an item
- `index: number` - the index of an item
- `array: object[]` - an array of iterated elements
- `tree: boolean` - defines, whether all the nested elements should be iterated, *false* by default
- `array: object[]` - an array of iterated items
- `tree: boolean` - defines, whether all the nested items should be iterated, *false* by default

@example:
form.getItem("fieldset").forEach((item, index, arr) => {
Expand Down
Loading

0 comments on commit ee85b92

Please sign in to comment.