Expose simple value for FilePicker in "single selection" mode #1224
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently the FilePicker always exposes an array of (removed/added) values, even though the picker may be configured to only allow a single selection. For single-valued fields it is common (and expected) that the value is provided as a simple value and not wrapped inside a "dummy" array of a single element. This PR adds special handling for the case that multipleItemSelection is configured to false, yielding only the value of the itemKey without a wrapping array as the (added/removed) value of the field.
This PR also moves code that was specific to FilePicker from the BaseFormControl module (where it didn't belong) to the FilePicker itself.
Additionally it addresses a minor bug found during testing that could result in forms not being initialized correctly: calls to publishValue providing a Deferred may occur AFTER the widget has already been added to the DOM tree, resulting in the Deferred to never be resolved and thus the form to never complete its initialization.