-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consider maxItems value before rendering the add button (#599)
* Consider maxItems value before rendering the add button jsonschema refuses to validate an array of items when the number of items is greater than the maxItems constraint. Therefore the UI should consisder this constraint and not provide an "add" button when the maximum number of elements is reached. The "add" button is rendered in the following cases: - ui:options.addable is not false and items.length < schema.maxItems - schema.maxItems is unspecified and ui:options.addable is not false As before, if ui:options.addable is not specified, it is considered as true by default. The "add" button is *not* rendered in the following cases: - ui:options.addable is false, - items.length >= schema.maxItems, even if ui.options:addable is true * Consider maxItems value before rendering the add button on fixed arrays The "add" button is rendered if "additionalItems" is defined *and* if one of the following conditions is met: - ui:options.addable is not false and items.length < schema.maxItems - schema.maxItems is unspecified and ui:options.addable is not false items length here takes all items into account, i.e. both fixed ones and additional ones. * use object spread instead of Object.assign() … in order to match codebase convention * extract "addable" logic in a dedicated method
- Loading branch information
Showing
2 changed files
with
113 additions
and
6 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