Skip to content

Pass along label/placeholder/registry for custom multiselect widgets.#1301

Merged
epicfaace merged 1 commit intorjsf-team:masterfrom
fsteger:pass-to-widget
Jun 3, 2019
Merged

Pass along label/placeholder/registry for custom multiselect widgets.#1301
epicfaace merged 1 commit intorjsf-team:masterfrom
fsteger:pass-to-widget

Conversation

@fsteger
Copy link
Contributor

@fsteger fsteger commented May 29, 2019

Reasons for making this change

Inconsistency between properties passed to custom select widgets. When widget is for a question of type string with an enum, the custom widget receives props for label, placeholder, and registry. When widget is used on a multi-select field, these properties are missing.

Sample Schema:

{
	type: 'object',
	properties: {
		selectQuestion: {
			title: 'Select Question',
			type: 'string',
			enum: ['foo', 'bar', 'baz', 'qux'],
			enumNames: ['foo', 'bar', 'baz', 'qux']
		},
		multiSelectQuestion: {
			title: 'Multi-Select Question',
			type: 'array',
			uniqueItems: true,
			items: {
				type: 'string',
				enum: ['foo', 'bar', 'baz', 'qux'],
				enumNames: ['foo', 'bar', 'baz', 'qux']
			}
		}
}

Sample UI Schema:

{
	selectQuestion: {
		'ui:widget': 'select'
	},
	multiSelectQuestion: {
		'ui:widget': 'select'
	}
}

Checklist

  • I'm updating documentation
  • I'm adding or updating code
    • I've added and/or updated tests
    • I've updated docs if needed
    • [X I've run npm run cs-format on my branch to conform my code to prettier coding style
  • I'm adding a new feature
    • I've updated the playground with an example use of the feature

@epicfaace epicfaace merged commit 2a7e4e1 into rjsf-team:master Jun 3, 2019
@fsteger fsteger deleted the pass-to-widget branch June 24, 2019 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants