How to use the react-jsonschema-form/lib/utils.allowAdditionalItems 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 / ArrayField / ArrayField.js View on Github external
uiSchema,
      errorSchema,
      idSchema,
      name,
      required,
      disabled,
      readonly,
      autofocus,
    } = this.props;
    const title = schema.title || name;
    let {items} = this.state;
    const {definitions, fields} = this.props.registry;
    const {TitleField} = fields;
    const itemSchemas = schema.items.map(item =>
      retrieveSchema(item, definitions));
    const additionalSchema = allowAdditionalItems(schema) ?
      retrieveSchema(schema.additionalItems, definitions) : null;

    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));
    }

    return (
      <fieldset>
        
        {schema.description ?</fieldset>
github Talend / ui / packages / forms / src / deprecated / fields / ArrayField.js View on Github external
idSchema,
			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 =&gt; retrieveSchema(item, definitions));
		const additionalSchema = allowAdditionalItems(schema)
			? retrieveSchema(schema.additionalItems, definitions)
			: null;
		const { addable = true } = getUiOptions(uiSchema);
		const canAdd = addable &amp;&amp; additionalSchema;
		if (!items || items.length &lt; 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,