From 6ebd5ee849154ff56f592fb1b70dc797618fb349 Mon Sep 17 00:00:00 2001 From: Nick Grosenbacher Date: Fri, 12 Jan 2024 14:38:27 -0500 Subject: [PATCH 01/47] [v6] Remove `@rjsf/material-ui` theme (Material UI v4) (#4010) --- CHANGELOG.md | 4 ++++ packages/core/src/components/Form.tsx | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b41ff3c81..f7ca89fb42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -443,6 +443,10 @@ should change the heading of the (upcoming) version to include a major version b - BREAKING CHANGE: Removed `@rjsf/material-ui` package. Material UI v4 (`@material-ui/core`) has been deprecated since September 2021. To use Material UI v5 (`@mui/core`) with RJSF, please use the `@rjsf/mui` theme instead. +## @rjsf/material-ui + +- Removed `@rjsf/material-ui` package. Material UI v4 (`@material-ui/core`) has been deprecated since September 2021. To use Material UI v5 (`@mui/core`) with RJSF, please use the `@rjsf/mui` theme instead. + ## @rjsf/react-bootstrap - Added new package to replace `@rjsf/bootstrap-4` diff --git a/packages/core/src/components/Form.tsx b/packages/core/src/components/Form.tsx index 05d9509987..b3a7c9cf93 100644 --- a/packages/core/src/components/Form.tsx +++ b/packages/core/src/components/Form.tsx @@ -1052,9 +1052,9 @@ export default class Form< const registry = this.getRegistry(); const { SchemaField: _SchemaField } = registry.fields; const { SubmitButton } = registry.templates.ButtonTemplates; - // The `semantic-ui` and `material-ui` themes have `_internalFormWrapper`s that take an `as` prop that is the + // The `semantic-ui` theme has an `_internalFormWrapper` that take an `as` prop that is the // PropTypes.elementType to use for the inner tag, so we'll need to pass `tagName` along if it is provided. - // NOTE, the `as` prop is native to `semantic-ui` and is emulated in the `material-ui` theme + // NOTE, the `as` prop is native to `semantic-ui` const as = _internalFormWrapper ? tagName : undefined; const FormTag = _internalFormWrapper || tagName || 'form'; From 504bac8400762a9e5db0921782cc2c7d41cb748c Mon Sep 17 00:00:00 2001 From: Nick Grosenbacher Date: Fri, 19 Apr 2024 13:21:32 -0400 Subject: [PATCH 02/47] Merge changes in `main` to `rjsf-v6` (#4164) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Heath C <51679588+heath-freenome@users.noreply.github.com> Co-authored-by: Abdallah Al-Soqatri Co-authored-by: Kevin Burnett <18027+burnettk@users.noreply.github.com> Co-authored-by: Marek Bodinger Co-authored-by: Mehdi Salem Co-authored-by: Jonasz Wiącek Co-authored-by: Bogdan Savluk Co-authored-by: Christian Wendt <54559756+cwendtxealth@users.noreply.github.com> Co-authored-by: Ben Lambert Co-authored-by: David R. Bild Co-authored-by: Ariqun <38001928+Ariqun@users.noreply.github.com> Co-authored-by: Shivam Anand Murmu <35562703+Rozamo@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Shubham Biswas <46351104+Shubhcoder@users.noreply.github.com> Co-authored-by: popmanhe Co-authored-by: Yuki Aoki Co-authored-by: Xiangcheng Kuo <37873394+orange-guo@users.noreply.github.com> Co-authored-by: Bart van Andel Co-authored-by: Laurent Direr Co-authored-by: Vegard Stenvik <42935080+vstenvik@users.noreply.github.com> Co-authored-by: Appie Co-authored-by: Oren Forer Co-authored-by: Marcus Penn <11893741+mpenndev@users.noreply.github.com> Co-authored-by: joachimhagheim <47362824+joachimhagheim@users.noreply.github.com> Co-authored-by: MarekBodingerBA <104828482+MarekBodingerBA@users.noreply.github.com> Co-authored-by: momesana Co-authored-by: Martti Roitto fix(utils): direct lodash function import to improve bundling on library client side (#3976) fix: #3961 resolve all recurse list for object properties (#3981) fix gap in outline when label is hidden (#3984) Fix: Expose the internal `ajv` variable in the validator implementation classes (#3991) Fixes: #3972 indirectly by exposing the `ajv` variable for use in the issue Fix: Change FormHelperText usage with @mui/material to render divs (#4032) Fixes #4031 by switching the render component for `FormHelperText` to be `div` fix: Added support for anyOf/oneOf in uiSchema (#4055) Fixes #4039 by updating `MultiSchemaField` to properly support `anyOf`/`oneOf` arrays in the `uiSchema` Fix checkbox with 0 as a value was unselectable in antd (#4068) Fixed #4067 by properly dealing with enums that have 0 as a value Fix potential XSS in the preview button of FileWidget (#4065) Fix: Make 'ui:rows' option work with chakra-ui for textarea elements #4070 (#4078) Fix typo in ErrorsListTemplate example (#4087) Fix #4080 by moving `base64` encoder/decoder from `@rjsf/utils` to playground (#4093) Fix: Error state not resetting when schema changes (#4079) (#4103) Fix noImplicitAny error (#4106) Fixes: [WARNING] Duplicate key "include" in object literal [duplicate-object-key] (#4114) Fixes: Warning: validateDOMNesting(...):

cannot appear as a descendant of

. (#4117) Fix documentation to add missing Form imports (#4131) Fix #4127 to add missing `Form` import in documentation Fix: filename should be bold (#4125) Fix: use correct ConfigProvider context by using named imports (#4132) Fix 4134 by filtering out bad DOM props (#4140) Fixes: #4134 by updating the spreading of props onto the `TextField` to remove bad DOM fields Fixed Programmatic submit not working properly in Firefox (#4150) Fix Maximum call stack size exceeded in findSchemaDefinition (#4123) --- CHANGELOG.md | 142 ++++++++++++++++++ packages/docs/docs/usage/widgets.md | 2 + .../test/__snapshots__/Array.test.tsx.snap | 4 + packages/playground/babel.config.js | 3 + packages/playground/jest.config.js | 6 + 5 files changed, 157 insertions(+) create mode 100644 packages/playground/babel.config.js create mode 100644 packages/playground/jest.config.js diff --git a/CHANGELOG.md b/CHANGELOG.md index f7ca89fb42..5f810adc09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1086,6 +1086,148 @@ should change the heading of the (upcoming) version to include a major version b - add missing typescript project reference for `utils` in `validator-ajv6` and `validator-ajv8` packages tsconfigs - Added a dropdown for changing the `experimental_defaultFormStateBehavior.allOf` behaviour in the playground + +# 5.18.2 + +## @rjsf/core + +- Fixed Programmatic submit not working properly in Firefox [#3121](https://github.com/rjsf-team/react-jsonschema-form/issues/3121) + +## @rjsf/utils + +- [#4116](https://github.com/rjsf-team/react-jsonschema-form/issues/4116) Fix Maximum call stack size exceeded when encountering circular definitions ([Link to PR](https://github.com/rjsf-team/react-jsonschema-form/pull/4123)) + +# 5.18.0 + +## @rjsf/antd +- Fix issue where the theme provided by the ConfigProvider under antd v5 wasn't respected thereby rendering the form items unusable under dark themes [#4129](https://github.com/rjsf-team/react-jsonschema-form/issues/4129) + +## @rjsf/core + +- Fix Error state not resetting when schema changes [#4079](https://github.com/rjsf-team/react-jsonschema-form/issues/4079) + +## @rjsf/mui + +- Fixed the `SelectWidget` and `BaseInputTemplate` to filter out `errorSchema` and `autocomplete` from the `textFieldProps` being spread onto the `TextField`, fixing [#4134](https://github.com/rjsf-team/react-jsonschema-form/issues/4134) + +## @rjsf/utils + +- Added a new `skipEmptyDefault` option in `emptyObjectFields`, fixing [#3880](https://github.com/rjsf-team/react-jsonschema-form/issues/3880) +- Added a new `computeSkipPopulate` option in `arrayMinItems`, allowing custom logic to skip populating arrays with default values, implementing [#4121](https://github.com/rjsf-team/react-jsonschema-form/pull/4121). +- Fixed bug where the string `"\"` would get printed next to filenames when uploading files, and restored intended bolding of filenames fixing [#4120](https://github.com/rjsf-team/react-jsonschema-form/issues/4120). + +## Dev / docs / playground + +- Updated the documentation to describe how to use the `skipEmptyDefault` option. +- Fixed missing import of `Form` in usage documentation - fixing [#4127](https://github.com/rjsf-team/react-jsonschema-form/issues/4127) + +# 5.17.1 + +## @rjsf/chakra-ui + +- Added support for `UiSchema` `"ui:rows"` option for `textarea` elements, fixing [#4070](https://github.com/rjsf-team/react-jsonschema-form/issues/4070). + +## @rjsf/core + +- [#4091](https://github.com/rjsf-team/react-jsonschema-form/issues/4091) Added `errorSchema` to `ArrayFieldTemplate` props. + +## @rjsf/utils + +- [#4080](https://github.com/rjsf-team/react-jsonschema-form/issues/4080) - BREAKING CHANGE: Removed the `base64` object from the `@rjsf/utils` package. Note that this is a breaking change if you relied on the `base64` object exported by `@rjsf/utils`. Since this change caused [#4080](https://github.com/rjsf-team/react-jsonschema-form/issues/4080), and was only internally used by playground code, we are shipping this change in a patch release. +- [#4091](https://github.com/rjsf-team/react-jsonschema-form/issues/4091) Added `errorSchema` to the `ArrayFieldTemplateProps` type. + +## Dev / docs / playground + +- [#4080](https://github.com/rjsf-team/react-jsonschema-form/issues/4080) - Moved the `base64` encoder/decoder object to the Playground package. +- Added test configuration and script to the Playground. + +# 5.17.0 + +## @rjsf/core + +- Added support for `anyOf`/`oneOf` in `uiSchema`s in the `MultiSchemaField`, fixing [#4039](https://github.com/rjsf-team/react-jsonschema-form/issues/4039) +- Fix potential XSS vulnerability in the preview button of FileWidget, fixing [#4057](https://github.com/rjsf-team/react-jsonschema-form/issues/4057) + +## @rjsf/utils + +- [#4024](https://github.com/rjsf-team/react-jsonschema-form/issues/4024) Added `base64` to support `encoding` and `decoding` using the `UTF-8` charset to support the characters out of the `Latin1` range. +- Updated `enumOptionsValueForIndex()` to fix issue that filtered enum options with a value that was 0, fixing [#4067](https://github.com/rjsf-team/react-jsonschema-form/issues/4067) +- Changes the way of parsing the data URL, to fix [#4057](https://github.com/rjsf-team/react-jsonschema-form/issues/4057) + +## Dev / docs / playground + +- [#4024](https://github.com/rjsf-team/react-jsonschema-form/issues/4024) Updated the base64 references from (`atob` and `btoa`) to invoke the functions from the new `base64` object in `@rjsf/utils`. +- Updated the `uiSchema.md` documentation to describe how to use the new `anyOf`/`oneOf` support + +# 5.16.1 + +## Dev / docs / playground + +- Bumped peer dependencies due to new utils function + +# 5.16.0 + +## @rjsf/core + +- Pass indexed title from array into its items, adding enhancement asked in [#3983](https://github.com/rjsf-team/react-jsonschema-form/issues/3983) +- Removed `dateElementProps` function implementation, and replaced it with `getDateElementProps` from `@rjsf/utils`. +- Modify submit method to make it a public method, fixing [#4015](https://github.com/rjsf-team/react-jsonschema-form/issues/4015) +- Support file deletion for `format: "data-url"` in `FileWidget`, fixing [#3957](https://github.com/rjsf-team/react-jsonschema-form/issues/3957). + +## @rjsf/antd + +- Removed `dateElementProps` function implementation, and replaced it with `getDateElementProps` from `@rjsf/utils`. + +## @rjsf/chakra-ui + +- Removed `dateElementProps` function implementation, and replaced it with `getDateElementProps` from `@rjsf/utils`. + +## @rjsf/mui + +- Updated the `FieldErrorTemplate` and `FieldHelpTemplate` to support html-based errors that cause ` cannot appear as a descendant of

` browser warnings, fixing [#4031](https://github.com/rjsf-team/react-jsonschema-form/issues/4031) + +## @rjsf/utils + +- Added `getDateElementProps()` to refactor duplicate function in `core`, `antd` & `chakra-ui` AltDateWidget's source code. The same function, implements the feature requested in [#297](https://github.com/rjsf-team/react-jsonschema-form/issues/297) + +## Dev / docs / playground + +- Updated docs and playground with the implementation guide of newly added date re-order feature. + +# 5.15.1 + +## @rjsf/core + +- fix `getFieldNames`. Now correctly defines an array of primitives. + +## @rjsf/validator-ajv6 + +- Updated the `AJV6Validator` class to expose the internal `ajv` object, allowing access to support a fix related to [#3972](https://github.com/rjsf-team/react-jsonschema-form/issues/3972) + +## @rjsf/validator-ajv8 + +- Updated the `AJV8Validator` class to expose the internal `ajv` object, allowing access to support a fix related to [#3972](https://github.com/rjsf-team/react-jsonschema-form/issues/3972) + +## Dev / docs / playground + +- Updated the documentation to describe how to use the newly exposed `ajv` variable + +# 5.15.0 + +## @rjsf/mui + +- fix gap in text and select widget outlines when `"ui:label": false` is specified. + +## @rjsf/utils + +- Updated `resolveAllReferences()` to use own recurse list for each object properties, fixing [#3961](https://github.com/rjsf-team/react-jsonschema-form/issues/3961) +- Added an experimental flag `allOf` to `experimental_defaultFormStateBehavior` for populating defaults when using `allOf` schemas [#3969](https://github.com/rjsf-team/react-jsonschema-form/pull/3969) + +## Dev / playground + +- add missing typescript project reference for `utils` in `validator-ajv6` and `validator-ajv8` packages tsconfigs +- Added a dropdown for changing the `experimental_defaultFormStateBehavior.allOf` behaviour in the playground + # 5.14.3 ## @rjsf/core diff --git a/packages/docs/docs/usage/widgets.md b/packages/docs/docs/usage/widgets.md index 63bf42518d..9f3b2e9e2a 100644 --- a/packages/docs/docs/usage/widgets.md +++ b/packages/docs/docs/usage/widgets.md @@ -96,6 +96,8 @@ It's also possible to remove the `Now` and `Clear` buttons with the `hideNowButt You can also, customize the order in which date input fields are displayed by providing `format` property to `ui:options` in your uiSchema, available values are `YMD`(default), `MDY` and `DMY`. +You can also, customize the order in which date input fields are displayed by providing `format` property to `ui:options` in your uiSchema, available values are `YMD`(default), `MDY` and `DMY`. + ```tsx import Form from '@rjsf/core'; import { RJSFSchema, UiSchema } from '@rjsf/utils'; diff --git a/packages/mui/test/__snapshots__/Array.test.tsx.snap b/packages/mui/test/__snapshots__/Array.test.tsx.snap index 625d7ad48b..08c060e7c8 100644 --- a/packages/mui/test/__snapshots__/Array.test.tsx.snap +++ b/packages/mui/test/__snapshots__/Array.test.tsx.snap @@ -7118,6 +7118,7 @@ label[data-shrink=false]+.MuiInputBase-formControl .emotion-4:focus::-ms-input-p onClick={[Function]} >