@rjsf/core
Advanced tools
Comparing version 5.12.1 to 5.13.0
@@ -7,4 +7,3 @@ import { __rest } from "tslib"; | ||
import omit from 'lodash/omit'; | ||
import unset from 'lodash/unset'; | ||
import { ADDITIONAL_PROPERTY_FLAG, deepEquals, ERRORS_KEY, getDiscriminatorFieldFromSchema, getUiOptions, getWidget, mergeSchemas, TranslatableString, } from '@rjsf/utils'; | ||
import { deepEquals, ERRORS_KEY, getDiscriminatorFieldFromSchema, getUiOptions, getWidget, mergeSchemas, TranslatableString, } from '@rjsf/utils'; | ||
/** The `AnyOfField` component is used to render a field in the schema that is an `anyOf`, `allOf` or `oneOf`. It tracks | ||
@@ -113,7 +112,6 @@ * the currently selected option and cleans up any irrelevant data in `formData`. | ||
if (option) { | ||
// merge all top level fields except properties | ||
const { oneOf, anyOf, properties } = schema, remaining = __rest(schema, ["oneOf", "anyOf", "properties"]); | ||
// merge top level required field | ||
const { required } = schema; | ||
// Merge in all the non-oneOf/anyOf properties and also skip the special ADDITIONAL_PROPERTY_FLAG property | ||
unset(remaining, ADDITIONAL_PROPERTY_FLAG); | ||
optionSchema = !isEmpty(remaining) ? mergeSchemas(remaining, option) : option; | ||
optionSchema = required ? mergeSchemas({ required }, option) : option; | ||
} | ||
@@ -120,0 +118,0 @@ const translateEnum = title |
@@ -415,3 +415,3 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | ||
const { extraErrors, extraErrorsBlockSubmit, focusOnFirstError, onError } = this.props; | ||
const { formData } = this.state; | ||
const { formData, errors: prevErrors } = this.state; | ||
const schemaValidation = this.validate(formData); | ||
@@ -422,3 +422,4 @@ let errors = schemaValidation.errors; | ||
const schemaValidationErrorSchema = errorSchema; | ||
if (errors.length > 0 || (extraErrors && extraErrorsBlockSubmit)) { | ||
const hasError = errors.length > 0 || (extraErrors && extraErrorsBlockSubmit); | ||
if (hasError) { | ||
if (extraErrors) { | ||
@@ -450,5 +451,12 @@ const merged = validationDataMerge(schemaValidation, extraErrors); | ||
}); | ||
return false; | ||
} | ||
return true; | ||
else if (prevErrors.length > 0) { | ||
this.setState({ | ||
errors: [], | ||
errorSchema: {}, | ||
schemaValidationErrors: [], | ||
schemaValidationErrorSchema: {}, | ||
}); | ||
} | ||
return !hasError; | ||
} | ||
@@ -455,0 +463,0 @@ /** Renders the `Form` fields inside the <form> | `tagName` or `_internalFormWrapper`, rendering any errors if |
{ | ||
"name": "@rjsf/core", | ||
"version": "5.12.1", | ||
"version": "5.13.0", | ||
"description": "A simple React component capable of building HTML forms out of a JSON schema.", | ||
@@ -41,3 +41,3 @@ "scripts": { | ||
"peerDependencies": { | ||
"@rjsf/utils": "^5.8.x", | ||
"@rjsf/utils": "^5.12.x", | ||
"react": "^16.14.0 || >=17" | ||
@@ -59,5 +59,5 @@ }, | ||
"@babel/preset-typescript": "^7.22.5", | ||
"@rjsf/utils": "^5.12.1", | ||
"@rjsf/validator-ajv6": "^5.12.1", | ||
"@rjsf/validator-ajv8": "^5.12.1", | ||
"@rjsf/utils": "^5.13.0", | ||
"@rjsf/validator-ajv6": "^5.13.0", | ||
"@rjsf/validator-ajv8": "^5.13.0", | ||
"@types/lodash": "^4.14.196", | ||
@@ -108,3 +108,3 @@ "@types/react": "^17.0.62", | ||
}, | ||
"gitHead": "de6477730fd16a07def501c2cb761af9c3f4c247" | ||
"gitHead": "588b1c063095f75278585838cbca9b20252e13c9" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1396066
19389