How to use the @department-of-veterans-affairs/react-jsonschema-form/lib/utils.getDefaultFormState function in @department-of-veterans-affairs/react-jsonschema-form

To help you get started, we’ve selected a few @department-of-veterans-affairs/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 department-of-veterans-affairs / vets-website / src / applications / common / schemaform / fields / ArrayField.jsx View on Github external
this.setState(newState, () => {
        const newFormData = this.props.formData.concat(getDefaultFormState(this.props.schema.additionalItems, undefined, this.props.registry.definitions) || {});
        this.props.onChange(newFormData);
        this.scrollToRow(`${this.props.idSchema.$id}_${lastIndex + 1}`);
      });
    } else {
github department-of-veterans-affairs / vets-website / src / js / disability-benefits / 526EZ / components / ReviewCardField.jsx View on Github external
return (value) => {
      const formData = Object.keys(this.props.formData || {}).length
        ? this.props.formData
        : getDefaultFormState(this.props.schema, undefined, this.props.registry.definitions);
      this.props.onChange(set(name, value, formData));
    };
  }
github department-of-veterans-affairs / vets-website / src / applications / common / schemaform / fields / ArrayField.jsx View on Github external
componentDidMount() {
    const { schema, formData = [], registry } = this.props;
    if (schema.minItems > 0 && formData.length === 0) {
      this.props.onChange(Array(schema.minItems).fill(
        getDefaultFormState(schema.additionalItems, undefined, registry.definitions)
      ));
    }
  }
github department-of-veterans-affairs / vets-website / src / applications / disability-benefits / all-claims / components / ReviewCardField.jsx View on Github external
return value => {
      const formData = Object.keys(this.props.formData || {}).length
        ? this.props.formData
        : getDefaultFormState(
            this.props.schema,
            undefined,
            this.props.registry.definitions,
          );
      this.props.onChange(set(name, value, formData));
    };
  }
github department-of-veterans-affairs / vets-website / src / applications / vaos / reducers / newAppointment.js View on Github external
function setupFormData(data, schema, uiSchema) {
  const schemaWithItemsCorrected = updateItemsSchema(schema);
  return updateSchemaAndData(
    schemaWithItemsCorrected,
    uiSchema,
    getDefaultFormState(schemaWithItemsCorrected, data, {}),
  );
}
github department-of-veterans-affairs / vets-website / src / platform / forms-system / src / js / review / ObjectField.jsx View on Github external
return value => {
      const formData = Object.keys(this.props.formData || {}).length
        ? this.props.formData
        : getDefaultFormState(
            this.props.schema,
            undefined,
            this.props.registry.definitions,
          );
      this.props.onChange(_.set(name, value, formData));
    };
  }
github department-of-veterans-affairs / vets-website / src / platform / forms-system / src / js / review / ArrayField.jsx View on Github external
handleAdd() {
    const newState = {
      items: this.state.items.concat(
        getDefaultFormState(
          this.getItemSchema(this.state.items.length),
          undefined,
          this.props.schema.definitions,
        ) || {},
      ),
      editing: this.state.editing.concat(true),
    };
    this.setState(newState, () => {
      this.scrollToRow(
        `${this.props.path[this.props.path.length - 1]}_${this.state.items
          .length - 1}`,
      );
    });
  }
github department-of-veterans-affairs / vets-website / src / platform / forms-system / src / js / fields / ObjectField.jsx View on Github external
getStateFromProps(props) {
    const { schema, formData, registry } = props;
    return getDefaultFormState(schema, formData, registry.definitions) || {};
  }
github department-of-veterans-affairs / vets-website / src / platform / forms-system / src / js / fields / ArrayField.jsx View on Github external
this.setState(newState, () => {
        const newFormData = this.props.formData.concat(
          getDefaultFormState(
            this.props.schema.additionalItems,
            undefined,
            this.props.registry.definitions,
          ) || {},
        );
        this.props.onChange(newFormData);
        this.scrollToRow(`${this.props.idSchema.$id}_${lastIndex + 1}`);
      });
    } else {