From c90470d0ca38d1c516c05b120fb8d0c79aad8c3d Mon Sep 17 00:00:00 2001 From: Jaejoon Han Date: Fri, 3 May 2024 18:01:45 +0900 Subject: [PATCH 1/2] fix typos in constants.ts, Form.tsx --- CHANGELOG.md | 6 ++++++ packages/core/src/components/Form.tsx | 10 +++++----- packages/utils/src/constants.ts | 4 ++-- packages/utils/src/schema/toPathSchema.ts | 4 ++-- packages/validator-ajv8/src/createAjvInstance.ts | 4 ++-- 5 files changed, 17 insertions(+), 11 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..7e5dc64a33 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, @@ -112,7 +112,7 @@ export interface FormProps void; //
HTML attributes /** The value of this prop will be passed to the `accept-charset` HTML attribute on the form */ - acceptcharset?: string; + 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 +537,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); @@ -870,7 +870,7 @@ export default class Form< action, autoComplete, enctype, - acceptcharset, + acceptCharset, noHtml5Validate = false, disabled = false, readonly = false, @@ -905,7 +905,7 @@ export default class Form< action={action} autoComplete={autoComplete} encType={enctype} - 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..2768d08bad 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,7 @@ export const PROPERTIES_KEY = 'properties'; export const REQUIRED_KEY = 'required'; export const SUBMIT_BTN_OPTIONS_KEY = 'submitButtonOptions'; export const REF_KEY = '$ref'; -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 Date: Tue, 14 May 2024 09:47:26 +0900 Subject: [PATCH 2/2] keep the constants to for backwards compatibility Co-authored-by: Heath C <51679588+heath-freenome@users.noreply.github.com> --- packages/core/src/components/Form.tsx | 7 ++++++- packages/utils/src/constants.ts | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/core/src/components/Form.tsx b/packages/core/src/components/Form.tsx index 7e5dc64a33..f77849207b 100644 --- a/packages/core/src/components/Form.tsx +++ b/packages/core/src/components/Form.tsx @@ -111,6 +111,10 @@ export interface FormProps void; // HTML attributes + /** 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 @@ -870,6 +874,7 @@ export default class Form< action, autoComplete, enctype, + acceptcharset, acceptCharset, noHtml5Validate = false, disabled = 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 2768d08bad..3221c7bb0e 100644 --- a/packages/utils/src/constants.ts +++ b/packages/utils/src/constants.ts @@ -23,6 +23,10 @@ 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';