How to use the react-jsonschema-form/lib/utils.retrieveSchema 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
name,
			required,
			disabled,
			readonly,
			autofocus,
			registry,
			onBlur,
			onFocus,
		} = this.props;
		const title = schema.title || name;
		let items = this.props.formData;
		const { ArrayFieldTemplate, definitions, fields } = registry;
		const { TitleField } = fields;
		const itemSchemas = schema.items.map(item => retrieveSchema(item, definitions));
		const additionalSchema = allowAdditionalItems(schema)
			? retrieveSchema(schema.additionalItems, definitions)
			: null;
		const { addable = true } = getUiOptions(uiSchema);
		const canAdd = addable && additionalSchema;
		if (!items || items.length < itemSchemas.length) {
			// to make sure at least all fixed items are generated
			items = items || [];
			items = items.concat(new Array(itemSchemas.length - items.length));
		}

		// These are the props passed into the render function
		const arrayProps = {
			canAdd,
			className: 'field field-array field-array-fixed-items',
			disabled,
			idSchema,
			items: items.map((item, index) => {
github cloudwan / gohan_webui / src / Form / formComponents / fields / ArrayField / ArrayField.js View on Github external
const {
      schema,
      uiSchema,
      errorSchema,
      idSchema,
      name,
      required,
      disabled,
      readonly,
      autofocus,
    } = this.props;
    const title = (schema.title === undefined) ? name : schema.title;
    const {items} = this.state;
    const {definitions, fields} = this.props.registry;
    const {TitleField, DescriptionField} = fields;
    const itemsSchema = retrieveSchema(schema.items, definitions);
    const {orderable} = {orderable: true, ...uiSchema['ui:options']};

    return (
      <div>
        
        {
          schema.description &amp;&amp;
          
        }</div>
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 / ArrayField.js View on Github external
		const itemSchemas = schema.items.map(item => retrieveSchema(item, definitions));
		const additionalSchema = allowAdditionalItems(schema)
github Talend / ui / packages / forms / src / deprecated / fields / CollapsibleFieldset.js View on Github external
render() {
			const {
				uiSchema,
				formData,
				errorSchema,
				idSchema,
				name,
				required,
				disabled,
				readonly,
				onBlur,
				registry,
			} = this.props;
			const { definitions, fields, formContext } = registry;
			const { SchemaField, TitleField, DescriptionField } = fields;
			const schema = retrieveSchema(this.props.schema, definitions);
			let orderedProperties;
			try {
				const properties = Object.keys(schema.properties);
				orderedProperties = orderProperties(properties, uiSchema['ui:order']);
			} catch (err) {
				return (
					<div>
						<p style="{{">
							Invalid {name || 'root'} object field configuration:
							<em>{err.message}</em>.
						</p>
						<pre>{JSON.stringify(schema)}</pre>
					</div>
				);
			}
			const iconTransform = !formData.isClosed ? 'flip-vertical' : '';
github Talend / ui / packages / forms / src / deprecated / fields / ObjectField.js View on Github external
uiSchema,
			formData,
			errorSchema,
			idSchema,
			name,
			required,
			disabled,
			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 =&gt; {
				onChange(value, options);
			};
			return (
github audibene-labs / react-jsonschema-form-layout / src / index.js View on Github external
render() {
    const {
      uiSchema,
      errorSchema,
      idSchema,
      required,
      disabled,
      readonly,
      onBlur,
      formData
    } = this.props
    const { definitions, fields, formContext } = this.props.registry
    const { SchemaField, TitleField, DescriptionField } = fields
    const schema = retrieveSchema(this.props.schema, definitions)
    const title = (schema.title === undefined) ? '' : schema.title

    const layout = uiSchema['ui:layout']

    return (
      <fieldset>
        {title ?  : null}
        {schema.description ?
           : null}</fieldset>
github cloudwan / gohan_webui / src / Form / formComponents / fields / ObjectField.js View on Github external
render() {
    const {
      uiSchema,
      errorSchema,
      idSchema,
      name,
      required,
      disabled,
      readonly
    } = this.props;
    const widget = uiSchema['ui:widget'];
    const {definitions, fields, formContext} = this.props.registry;
    const {SchemaField, TitleField, DescriptionField} = fields;
    const baseSchema = retrieveSchema(this.props.schema, definitions);
    const title = (baseSchema.title === undefined) ? name : baseSchema.title;
    const schema = cloneDeep(baseSchema);

    if (widget === 'hidden') {
      return null;
    }

    if (schema.nullable &amp;&amp; this.nullValue) {
      return (
        <fieldset>
          {title &amp;&amp; (
            </fieldset>
github cloudwan / gohan_webui / src / Form / formComponents / fields / ArrayField / ArrayField.js View on Github external
const {
      schema,
      uiSchema,
      errorSchema,
      idSchema,
      name,
      required,
      disabled,
      readonly,
      autofocus,
    } = this.props;
    const title = (schema.title === undefined) ? name : schema.title;
    const {items} = this.state;
    const {definitions, fields} = this.props.registry;
    const {TitleField, DescriptionField} = fields;
    const itemsSchema = retrieveSchema(schema.items, definitions);
    const {orderable} = {orderable: true, ...uiSchema['ui:options']};

    return (
      <div>
        
        {
          schema.description &amp;&amp;
            
        }</div>