How to use the react-jsonschema-form/lib/utils.optionsList function in react-jsonschema-form

To help you get started, we’ve selected a few react-jsonschema-form examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cloudwan / gohan_webui / src / Form / formComponents / fields / BooleanField.js View on Github external
function buildOptions(schema, uiWidget) {
  // Note: uiWidget can be undefined, a string or an object; we only deal with
  // the inline option when we're provided a definition object.
  return {
    inline: isObject(uiWidget) &&
            isObject(uiWidget.options) &&
            uiWidget.options.inline,
    enumOptions: optionsList(Object.assign({
      enumNames: ['true', 'false'],
      enum: [true, false]
    }, {enumNames: schema.enumNames}))
  };
}
github Talend / ui / packages / forms / src / deprecated / fields / ArrayField.js View on Github external
renderMultiSelect() {
		const {
			schema,
			idSchema,
			uiSchema,
			disabled,
			readonly,
			autofocus,
			onBlur,
			onFocus,
			registry,
		} = this.props;
		const items = this.props.formData;
		const { widgets, definitions, formContext } = registry;
		const itemsSchema = retrieveSchema(schema.items, definitions);
		const enumOptions = optionsList(itemsSchema);
		const { widget = 'select', ...options } = {
			...getUiOptions(uiSchema),
			enumOptions,
		};
		const Widget = getWidget(schema, widget, widgets);
		return (
github Talend / ui / packages / forms / src / deprecated / fields / BooleanField.js View on Github external
function buildOptions(schema) {
	return {
		enumOptions: optionsList(
			Object.assign(
				{
					enumNames: ['true', 'false'],
					enum: [true, false],
				},
				{ enumNames: schema.enumNames },
			),
		),
	};
}
github Talend / ui / packages / forms / src / deprecated / widgets / KeyValueWidget / KeyValueWidget.js View on Github external
function Key({ schema, data, onChange, ...internalProps }) {
	if (schema.properties && Array.isArray(schema.properties.key.enum)) {
		const options = optionsList(schema.properties.key);
		return (
			<select value="{data.key}"> onChange({ key: change, value: data.value })}
			/&gt;
		);
	}
	return (
		 onChange(`${change}=${toValue(data)}`)}
		/&gt;</select>
github cloudwan / gohan_webui / src / Form / formComponents / fields / ArrayField / ArrayField.js View on Github external
renderMultiSelect() {
    const {
      schema,
      idSchema,
      uiSchema,
      disabled,
      readonly,
      autofocus
    } = this.props;
    const {items} = this.state;
    const {widgets, definitions} = this.props.registry;
    const itemsSchema = retrieveSchema(schema.items, definitions);
    const enumOptions = (itemsSchema &amp;&amp; itemsSchema.options) ?
      optionsListObject(itemsSchema) :
      optionsList(itemsSchema);

    const {
      widget = 'select',
      ...options
    } = {
      ...getUiOptions(uiSchema),
      enumOptions,
    };
    const Widget = getWidget(schema, widget, widgets);
    return (
github cloudwan / gohan_webui / src / Form / formComponents / fields / StringField.js View on Github external
const enumOptions = optionsListObject(schema);

    if (widget) {
      const Widget = getWidget(schema, widget, {...registry.widgets, ...widgets}, {enumOptions});
      return ;
    }

    return (
      
    );

  } else if (Array.isArray(schema.enum)) {
    const enumOptions = optionsList(schema);

    if (widget) {
      const Widget = getWidget(schema, widget, {...registry.widgets, ...widgets}, {enumOptions});
      return ;
    }

    return ;
  } else if (schema.format === 'text') {
    return ;
  }

  if (widget) {
    const Widget = getWidget(schema, widget, {...registry.widgets, ...widgets});

    return ;
  }
github chili-epfl / collab-react-components / src / client / fields / CollabStringField.js View on Github external
name,
      uiSchema,
      idSchema,
      formData,
      required,
      disabled,
      readonly,
      autofocus,
      onChange,
      onBlur,
      registry = getDefaultRegistry(),
    } = this.props;

    const { title, format } = schema;
    const { widgets, formContext } = registry;
    const enumOptions = Array.isArray(schema.enum) &amp;&amp; optionsList(schema);
    const defaultWidget = format || (enumOptions ? 'select' : 'text');
    const {
      widget = defaultWidget,
      placeholder = '',
      ...options
    } = getUiOptions(uiSchema);

    const Widget = CollabStringField.getWidget(schema, widget, widgets);

    const ref = {};
    if (this.isCollab) ref.widgetRef = w =&gt; (this._widget = w);

    if (options.emptyValue === undefined) options.emptyValue = '';

    return (