Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion CHANGELOG_v6.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ should change the heading of the (upcoming) version to include a major version b
- Updated the `ArrayFieldTemplate`, `ObjectFieldTemplate`, and `WrapIfAdditionalTemplate` to a unique id using the `buttonId()` function and adding consistent marker classes
- Implemented the `GridTemplate` component, adding it to the `templates` for the theme
- Implemented the new `LayoutGridField`, `LayoutMultiSchemaField` and `LayoutHeaderField` fields, adding them to the `fields` list
- BREAKING CHANGE: Removed support for the deprecated `schema.enumNames` and `uiSchema.classNames` as well as the deprecated `acceptcharset` prop on `Form`

## @rjsf/daisyui

Expand Down Expand Up @@ -91,12 +92,19 @@ should change the heading of the (upcoming) version to include a major version b
- `findFieldInSchema<T = undefined, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, rootSchema: S, path: string | string[], schema: S, formData?: T, experimental_customMergeAllOf?: Experimental_CustomMergeAllOf<S>): FoundFieldType<S>`: Finds the field specified by the `path` within the root or recursed `schema`
- `findSelectedOptionInXxxOf<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, rootSchema: S, schema: S, fallbackField: string,xxx: 'anyOf' | 'oneOf', formData?: T, experimental_customMergeAllOf?: Experimental_CustomMergeAllOf<S>): S | undefined`: Finds the option that matches the selector field in the `schema` or undefined if nothing is selected
- `getFromSchema<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, rootSchema: S, schema: S, path: string | string[], defaultValue: T | S, experimental_customMergeAllOf?: Experimental_CustomMergeAllOf<S>): T | S`: Helper that acts like lodash's `get` but additionally retrieves `$ref`s as needed to get the path for schemas
- Exported a `browser` version of the libraries with a browser-safe version of `getTestIds()`
- BREAKING CHANGE: Removed support for the deprecated `schema.enumNames` from `getOptionsList()` while switching the order of its generic types
- BREAKING CHANGE: Removed the deprecated `getMatchingOption()` and `mergeValidationData()` from the library export and the `SchemaUtilsType` interface
- BREAKING CHANGE: Removed the deprecated `toErrorList()` function from the `ValidatorType` interface
- BREAKING CHANGE: Removed the deprecated `RJSF_ADDITONAL_PROPERTIES_FLAG` constant

## @rjsf/validator-ajv6

- BREAKING CHANGE: This deprecated validator has been removed

## @rjsf/validator-ajv8

- BREAKING CHANGE: Removed the implementation of the deprecated `toErrorList()` function from the validator implementations

## Dev / docs / playground

- Updated the playground to remove `fluent-ui` theme
Expand All @@ -105,6 +113,7 @@ should change the heading of the (upcoming) version to include a major version b
- Added the `v6.x upgrade guide.md` documentation
- Updated the `playground` to add a `Layout Grid` example and made the selected example now be part of the shared export
- Replaced Lerna with Nx, updated all lerna commands to use the Nx CLI
- BREAKING CHANGE: Updated all `peerDependencies` to change minimal `React` support to `>=18`

# 6.0.0-alpha.0

Expand Down
24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/antd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"@rjsf/utils": "^6.x",
"antd": "^5.8.5",
"dayjs": "^1.8.0",
"react": "^16.14.0 || >=17"
"react": ">=18"
},
"dependencies": {
"classnames": "^2.5.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/chakra-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"@rjsf/utils": "^6.x",
"chakra-react-select": ">=3.3.8 <6.0.0",
"framer-motion": ">=5.6.0",
"react": "^16.14.0 || >=17"
"react": ">=18"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
},
"peerDependencies": {
"@rjsf/utils": "^6.x",
"react": "^16.14.0 || >=17"
"react": ">=18"
},
"dependencies": {
"lodash": "^4.17.21",
Expand Down
11 changes: 1 addition & 10 deletions packages/core/src/components/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,6 @@ export interface FormProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
* an `onFocus` handler, which will receive the id of the input that is focused and the field value
*/
onFocus?: (id: string, data: any) => void;
// <form /> 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
Expand Down Expand Up @@ -349,9 +344,6 @@ export default class Form<
* If an update is required, it applies the next state and, if needed, triggers the `onChange` handler to inform about
* changes.
*
* This method effectively replaces the deprecated `UNSAFE_componentWillReceiveProps`, providing a safer alternative
* to handle prop changes and state updates.
*
* @param _ - The previous set of props.
* @param prevState - The previous state of the component before the update.
* @param snapshot - The value returned from `getSnapshotBeforeUpdate`.
Expand Down Expand Up @@ -1029,7 +1021,6 @@ export default class Form<
action,
autoComplete,
enctype,
acceptcharset,
acceptCharset,
noHtml5Validate = false,
disabled,
Expand Down Expand Up @@ -1065,7 +1056,7 @@ export default class Form<
action={action}
autoComplete={autoComplete}
encType={enctype}
acceptCharset={acceptCharset || acceptcharset}
acceptCharset={acceptCharset}
noValidate={noHtml5Validate}
onSubmit={this.onSubmit}
as={as}
Expand Down
14 changes: 3 additions & 11 deletions packages/core/src/components/fields/BooleanField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ function BooleanField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extend
title: uiTitle,
// Unlike the other fields, don't use `getDisplayLabel()` since it always returns false for the boolean type
label: displayLabel = true,
enumNames,
...options
} = getUiOptions<T, S, F>(uiSchema, globalUiOptions);
const Widget = getWidget(schema, widget, widgets);
Expand All @@ -69,10 +70,8 @@ function BooleanField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extend
uiSchema,
);
} else {
// We deprecated enumNames in v5. It's intentionally omitted from RSJFSchema type, so we need to cast here.
const schemaWithEnumNames = schema as S & { enumNames?: string[] };
const enums = schema.enum ?? [true, false];
if (!schemaWithEnumNames.enumNames && enums.length === 2 && enums.every((v: any) => typeof v === 'boolean')) {
if (!enumNames && enums.length === 2 && enums.every((v: any) => typeof v === 'boolean')) {
enumOptions = [
{
value: enums[0],
Expand All @@ -84,14 +83,7 @@ function BooleanField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extend
},
];
} else {
enumOptions = optionsList<T, S, F>(
{
enum: enums,
// NOTE: enumNames is deprecated, but still supported for now.
enumNames: schemaWithEnumNames.enumNames,
} as unknown as S,
uiSchema,
);
enumOptions = optionsList<T, S, F>({ enum: enums } as S, uiSchema);
}
}

Expand Down
8 changes: 0 additions & 8 deletions packages/core/src/components/fields/SchemaField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,6 @@ function SchemaFieldRender<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
if (!hideError && __errors && __errors.length > 0) {
classNames.push('field-error has-error has-danger');
}
if (uiSchema?.classNames) {
if (process.env.NODE_ENV !== 'production') {
console.warn(
"'uiSchema.classNames' is deprecated and may be removed in a major release; Use 'ui:classNames' instead.",
);
}
classNames.push(uiSchema.classNames);
}
if (uiOptions.classNames) {
classNames.push(uiOptions.classNames);
}
Expand Down
3 changes: 2 additions & 1 deletion packages/core/test/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
{
"varsIgnorePattern": "^d$"
}
]
],
"@typescript-eslint/no-unused-expressions": "off"
}
}
21 changes: 12 additions & 9 deletions packages/core/test/ArrayFieldTemplate.test.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { PureComponent } from 'react';
import { expect } from 'chai';
import { Simulate } from 'react-dom/test-utils';
import { getUiOptions } from '@rjsf/utils';

import { createFormComponent, createSandbox } from './test_utils';

describe('ArrayFieldTemplate', () => {
Expand All @@ -18,8 +20,9 @@ describe('ArrayFieldTemplate', () => {

describe('Custom ArrayFieldTemplate of string array', () => {
function ArrayFieldTemplate(props) {
const { classNames } = getUiOptions(props.uiSchema);
return (
<div className={props.uiSchema.classNames}>
<div className={classNames}>
{props.canAdd && <button className='custom-array-add' />}
{props.items.map((element) => {
return (
Expand Down Expand Up @@ -101,7 +104,7 @@ describe('ArrayFieldTemplate', () => {

describe('with template globally configured', () => {
const uiSchema = {
classNames: 'custom-array',
'ui:classNames': 'custom-array',
};

beforeEach(() => {
Expand All @@ -117,7 +120,7 @@ describe('ArrayFieldTemplate', () => {
});
describe('with template configured in ui:ArrayFieldTemplate', () => {
const uiSchema = {
classNames: 'custom-array',
'ui:classNames': 'custom-array',
'ui:ArrayFieldTemplate': ArrayFieldTemplate,
};

Expand All @@ -132,7 +135,7 @@ describe('ArrayFieldTemplate', () => {
});
describe('with template configured globally being overriden in ui:ArrayFieldTemplate', () => {
const uiSchema = {
classNames: 'custom-array',
'ui:classNames': 'custom-array',
'ui:ArrayFieldTemplate': ArrayFieldTemplate,
};

Expand Down Expand Up @@ -162,7 +165,7 @@ describe('ArrayFieldTemplate', () => {

it('should render text input for each array item', () => {
expect(node.querySelectorAll('.custom-array-item .field input[type=text]')).to.have.length.of(
formData.length
formData.length,
);
});

Expand All @@ -188,7 +191,7 @@ describe('ArrayFieldTemplate', () => {

describe('with template globally configured', () => {
const uiSchema = {
classNames: 'custom-array',
'ui:classNames': 'custom-array',
};
beforeEach(() => {
node = createFormComponent({
Expand All @@ -203,7 +206,7 @@ describe('ArrayFieldTemplate', () => {

describe('with template configured in ui:ArrayFieldTemplate', () => {
const uiSchema = {
classNames: 'custom-array',
'ui:classNames': 'custom-array',
'ui:ArrayFieldTemplate': ArrayFieldTemplate,
};
beforeEach(() => {
Expand All @@ -217,7 +220,7 @@ describe('ArrayFieldTemplate', () => {
});
describe('with template configured globally being overriden in ui:ArrayFieldTemplate', () => {
const uiSchema = {
classNames: 'custom-array',
'ui:classNames': 'custom-array',
'ui:ArrayFieldTemplate': ArrayFieldTemplate,
};
beforeEach(() => {
Expand Down Expand Up @@ -246,7 +249,7 @@ describe('ArrayFieldTemplate', () => {

it('should render text input for each array item', () => {
expect(node.querySelectorAll('.custom-array-item .field input[type=text]')).to.have.length.of(
formData.length
formData.length,
);
});

Expand Down
Loading