From 38f7d32ac3d1e751bc6dfb7efe6d491f1e84cb88 Mon Sep 17 00:00:00 2001 From: Jaejoon Han Date: Sat, 18 May 2024 04:17:23 +0900 Subject: [PATCH] fix typos in constants.ts, Form.tsx (#4185) * fix typos in constants.ts, Form.tsx * keep the constants to for backwards compatibility Co-authored-by: Heath C <51679588+heath-freenome@users.noreply.github.com> --------- Co-authored-by: Heath C <51679588+heath-freenome@users.noreply.github.com> --- CHANGELOG.md | 6 ++++++ packages/core/src/components/Form.tsx | 13 +++++++++---- packages/utils/src/constants.ts | 6 +++++- packages/utils/src/schema/toPathSchema.ts | 4 ++-- packages/validator-ajv8/src/createAjvInstance.ts | 4 ++-- 5 files changed, 24 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e1b10fed2..eadf9bea7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,12 @@ should change the heading of the (upcoming) version to include a major version b --> +# 5.18.4 + +## Dev / docs / playground + +- Fixed typo in `constants.ts`, `Form.tsx` + # 5.18.3 ## @rjsf/semantic-ui diff --git a/packages/core/src/components/Form.tsx b/packages/core/src/components/Form.tsx index 9addaf8c0e..f77849207b 100644 --- a/packages/core/src/components/Form.tsx +++ b/packages/core/src/components/Form.tsx @@ -20,7 +20,7 @@ import { RegistryWidgetsType, RJSFSchema, RJSFValidationError, - RJSF_ADDITONAL_PROPERTIES_FLAG, + RJSF_ADDITIONAL_PROPERTIES_FLAG, SchemaUtilsType, shouldRender, SUBMIT_BTN_OPTIONS_KEY, @@ -111,8 +111,12 @@ export interface FormProps void; //
HTML attributes - /** The value of this prop will be passed to the `accept-charset` HTML attribute on the form */ + /** The value of this prop will be passed to the `accept-charset` HTML attribute on the form + * @deprecated replaced with `acceptCharset` which will supercede this value if both are specified + */ acceptcharset?: string; + /** The value of this prop will be passed to the `accept-charset` HTML attribute on the form */ + acceptCharset?: string; /** The value of this prop will be passed to the `action` HTML attribute on the form * * NOTE: this just renders the `action` attribute in the HTML markup. There is no real network request being sent to @@ -537,7 +541,7 @@ export default class Form< if (typeof _obj[key] === 'object') { const newPaths = paths.map((path) => [...path, key]); // If an object is marked with additionalProperties, all its keys are valid - if (_obj[key][RJSF_ADDITONAL_PROPERTIES_FLAG] && _obj[key][NAME_KEY] !== '') { + if (_obj[key][RJSF_ADDITIONAL_PROPERTIES_FLAG] && _obj[key][NAME_KEY] !== '') { acc.push(_obj[key][NAME_KEY]); } else { getAllPaths(_obj[key], acc, newPaths); @@ -871,6 +875,7 @@ export default class Form< autoComplete, enctype, acceptcharset, + acceptCharset, noHtml5Validate = false, disabled = false, readonly = false, @@ -905,7 +910,7 @@ export default class Form< action={action} autoComplete={autoComplete} encType={enctype} - acceptCharset={acceptcharset} + acceptCharset={acceptCharset || acceptcharset} noValidate={noHtml5Validate} onSubmit={this.onSubmit} as={as} diff --git a/packages/utils/src/constants.ts b/packages/utils/src/constants.ts index b3908e228f..3221c7bb0e 100644 --- a/packages/utils/src/constants.ts +++ b/packages/utils/src/constants.ts @@ -1,6 +1,6 @@ /** Below are the list of all the keys into various elements of a RJSFSchema or UiSchema that are used by the various * utility functions. In addition to those keys, there are the special `ADDITIONAL_PROPERTY_FLAG` and - * `RJSF_ADDITONAL_PROPERTIES_FLAG` flags that is added to a schema under certain conditions by the `retrieveSchema()` + * `RJSF_ADDITIONAL_PROPERTIES_FLAG` flags that is added to a schema under certain conditions by the `retrieveSchema()` * utility. */ export const ADDITIONAL_PROPERTY_FLAG = '__additional_property'; @@ -23,7 +23,11 @@ export const PROPERTIES_KEY = 'properties'; export const REQUIRED_KEY = 'required'; export const SUBMIT_BTN_OPTIONS_KEY = 'submitButtonOptions'; export const REF_KEY = '$ref'; +/** + * @deprecated Replace with correctly spelled constant `RJSF_ADDITIONAL_PROPERTIES_FLAG` + */ export const RJSF_ADDITONAL_PROPERTIES_FLAG = '__rjsf_additionalProperties'; +export const RJSF_ADDITIONAL_PROPERTIES_FLAG = '__rjsf_additionalProperties'; export const ROOT_SCHEMA_PREFIX = '__rjsf_rootSchema'; export const UI_FIELD_KEY = 'ui:field'; export const UI_WIDGET_KEY = 'ui:widget'; diff --git a/packages/utils/src/schema/toPathSchema.ts b/packages/utils/src/schema/toPathSchema.ts index dfef2b8226..ea168361bc 100644 --- a/packages/utils/src/schema/toPathSchema.ts +++ b/packages/utils/src/schema/toPathSchema.ts @@ -12,7 +12,7 @@ import { ONE_OF_KEY, PROPERTIES_KEY, REF_KEY, - RJSF_ADDITONAL_PROPERTIES_FLAG, + RJSF_ADDITIONAL_PROPERTIES_FLAG, } from '../constants'; import getDiscriminatorFieldFromSchema from '../getDiscriminatorFieldFromSchema'; import { FormContextType, PathSchema, RJSFSchema, StrictRJSFSchema, ValidatorType } from '../types'; @@ -69,7 +69,7 @@ function toPathSchemaInternal