Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 {
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));
};
}
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)
));
}
}
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));
};
}
function setupFormData(data, schema, uiSchema) {
const schemaWithItemsCorrected = updateItemsSchema(schema);
return updateSchemaAndData(
schemaWithItemsCorrected,
uiSchema,
getDefaultFormState(schemaWithItemsCorrected, data, {}),
);
}
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));
};
}
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}`,
);
});
}
getStateFromProps(props) {
const { schema, formData, registry } = props;
return getDefaultFormState(schema, formData, registry.definitions) || {};
}
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 {