How to use the react-jsonschema-form/lib/utils.getWidget 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 Talend / ui / packages / forms / src / deprecated / fields / ArrayField.js View on Github external
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 / StringField.js View on Github external
formData,
		required,
		disabled,
		readonly,
		autofocus,
		registry,
		onChange,
		onBlur,
		onFocus,
	} = props;
	const { title, format } = schema;
	const { widgets, formContext } = registry;
	const enumOptions = isSelect(schema) ? optionsList(schema) : undefined;
	const defaultWidget = format || (enumOptions ? 'select' : 'text');
	const { widget = defaultWidget, placeholder = '', ...options } = getUiOptions(uiSchema);
	const Widget = getWidget(schema, widget, widgets);

	const onChangeHandler = value => {
		onChange(value, options);
	};

	return (
github Talend / ui / packages / forms / src / deprecated / fields / ArrayField.js View on Github external
registry,
			formContext,
			onBlur,
			onChange,
			onFocus,
		} = this.props;
		const title = schema.title === undefined ? name : schema.title;
		const { ArrayFieldTemplate, definitions, fields, widgets } = registry;
		const { TitleField, DescriptionField } = fields;
		const itemsSchema = retrieveSchema(schema.items, definitions);
		const { widget, addable = true, type = 'element', ...options } = getUiOptions(uiSchema);
		if (typeof widget === 'string') {
			if (widget === 'hidden') {
				return null;
			}
			const Widget = getWidget(schema, widget, widgets);
			const onChangeHandler = value => {
				onChange(value, options);
			};
			return (
				
			);
		}
github Talend / ui / packages / forms / src / deprecated / fields / BooleanField.js View on Github external
onChange: onChangeHandler,
		onBlur: onBlurHandler,
		label: title === undefined ? name : title,
		value: formData,
		checked: formData,
		required,
		disabled,
		readonly,
		registry,
		formContext,
		autofocus,
		'data-feature': uiSchema['data-feature'],
	};

	if (widget) {
		const Widget = getWidget(schema, widget, widgets);
		return ;
	}
	return ;
}
github chili-epfl / collab-react-components / src / client / fields / CollabStringField.js View on Github external
static getWidget(schema, widget, widgets) {
    if (widget === 'password') {
      throw Error(
        'You should not use the widget "password" within a collaborative form'
      );
    } else {
      return getWidget(schema, widget, widgets);
    }
  }
github cloudwan / gohan_webui / src / Form / formComponents / fields / StringField.js View on Github external
label: (title === undefined) ? name : title,
    value: formData,
    step: uiSchema['ui:step'],
    onChange,
    required,
    disabled,
    readonly,
    formContext,
    autofocus
  };

  if (schema.options !== undefined) {
    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 ;
github Talend / ui / packages / forms / src / deprecated / fields / ObjectField.js View on Github external
readonly,
			onBlur,
			onChange,
			onFocus,
			registry,
		} = this.props;
		const { definitions, fields, formContext, widgets } = registry;
		const { SchemaField, TitleField, DescriptionField } = fields;
		const schema = retrieveSchema(this.props.schema, definitions);
		const { widget, ...options } = getUiOptions(uiSchema);

		if (typeof widget === 'string') {
			if (widget === 'hidden') {
				return null;
			}
			const Widget = getWidget(schema, widget, widgets);
			const onChangeHandler = value => {
				onChange(value, options);
			};
			return (
				
			);
		}
github cloudwan / gohan_webui / src / Form / formComponents / fields / ArrayField / ArrayField.js View on Github external
} = this.props;
    const {items} = this.state;
    const {widgets, definitions} = this.props.registry;
    const itemsSchema = retrieveSchema(schema.items, definitions);
    const enumOptions = (itemsSchema && itemsSchema.options) ?
      optionsListObject(itemsSchema) :
      optionsList(itemsSchema);

    const {
      widget = 'select',
      ...options
    } = {
      ...getUiOptions(uiSchema),
      enumOptions,
    };
    const Widget = getWidget(schema, widget, widgets);
    return (
      
    );
  }
github Talend / ui / packages / forms / src / deprecated / fields / ArrayField.js View on Github external
schema,
			uiSchema,
			idSchema,
			name,
			disabled,
			readonly,
			autofocus,
			onBlur,
			onFocus,
			registry,
		} = this.props;
		const title = schema.title || name;
		const items = this.props.formData;
		const { widgets, formContext } = registry;
		const { widget = 'files', ...options } = getUiOptions(uiSchema);
		const Widget = getWidget(schema, widget, widgets);
		return (