How to use the react-jsonschema-form/lib/utils.isFixedItems 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
render() {
		const { schema, uiSchema, idSchema, registry } = this.props;
		const { definitions } = registry;
		// eslint-disable-next-line no-prototype-builtins
		if (!schema.hasOwnProperty('items')) {
			return (
				
			);
		}
		if (isFixedItems(schema)) {
			return this.renderFixedArray();
		}
		if (isFilesArray(schema, uiSchema, definitions)) {
			return this.renderFiles();
		}
		if (isMultiSelect(schema, definitions)) {
			return this.renderMultiSelect();
		}
		return this.renderNormalArray();
	}
}
github cloudwan / gohan_webui / src / Form / formComponents / fields / ArrayField / ArrayField.js View on Github external
componentDidMount() {
    const {initialItem} = {initialItem: true, ...this.props.uiSchema['ui:options']};

    if (initialItem) {
      const {items} = this.state;
      const {schema, registry} = this.props;
      const {definitions} = registry;
      let itemSchema = schema.items;

      if (isFixedItems(schema) && allowAdditionalItems(schema)) {
        itemSchema = schema.additionalItems;
      }

      if (isEmpty(items) && this.props.required) {
        this.props.onChange(items.concat([
          getDefaultFormState(itemSchema, undefined, definitions)
        ]), {validate: false});
      }
    }
  }
github Talend / ui / packages / forms / src / deprecated / fields / ArrayField.js View on Github external
onAddClick(event) {
		event.preventDefault();
		const { schema, formData, registry } = this.props;
		const { definitions } = registry;
		let itemSchema = schema.items;
		if (isFixedItems(schema) && allowAdditionalItems(schema)) {
			itemSchema = schema.additionalItems;
		}
		formData.forEach(item => Object.assign(item, { isClosed: true }));
		this.props.onChange([...formData, getDefaultFormState(itemSchema, undefined, definitions)], {
			validate: false,
		});
	}
github cloudwan / gohan_webui / src / Form / formComponents / fields / ArrayField / ArrayField.js View on Github external
onAddClick = event => {
    event.preventDefault();
    const {items} = this.state;
    const {schema, registry} = this.props;
    const {definitions} = registry;
    let itemSchema = schema.items;

    if (isFixedItems(schema) && allowAdditionalItems(schema)) {
      itemSchema = schema.additionalItems;
    }

    const newItems = items.concat([
      getDefaultFormState(itemSchema, undefined, definitions)
    ]);

    this.asyncSetState({
      items: newItems,
      selectedTabId: newItems.length - 1
    });
  };
github cloudwan / gohan_webui / src / Form / formComponents / fields / ArrayField / ArrayField.js View on Github external
render() {
    const {schema, uiSchema} = this.props;
    const widget = uiSchema['ui:widget'];

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

    if (isFilesArray(schema, uiSchema)) {
      return this.renderFiles();
    }
    if (isFixedItems(schema)) {
      return this.renderFixedArray();
    }
    if (isMultiSelect(schema)) {
      return this.renderMultiSelect();
    }
    if (schema.items.type === 'object') {
      return this.renderObjectArray();
    }
    return this.renderNormalArray();
  }