diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b908b85d9..8954158503 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.6 + +## @rjsf/antd + +- Fix disabled property of options in CheckboxesWidget and RadioWidget ([#4216](https://github.com/rjsf-team/react-jsonschema-form/pull/4216)) + # 5.18.5 ## @rjsf/antd diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md index b2606d29e9..d9836abdd3 100644 --- a/PULL_REQUEST_TEMPLATE.md +++ b/PULL_REQUEST_TEMPLATE.md @@ -11,7 +11,7 @@ If your PR is non-trivial and you'd like to schedule a synchronous review, pleas - [ ] **I'm updating documentation** - [ ] I've [checked the rendering](https://rjsf-team.github.io/react-jsonschema-form/docs/contributing) of the Markdown text I've added - [ ] **I'm adding or updating code** - - [ ] I've added and/or updated tests. I've run `npm run test:update` to update snapshots, if needed. + - [ ] I've added and/or updated tests. I've run `npx nx run-many --target=build --exclude=@rjsf/docs && npm run test:update` to update snapshots, if needed. - [ ] I've updated [docs](https://rjsf-team.github.io/react-jsonschema-form/docs) if needed - [ ] I've updated the [changelog](https://github.com/rjsf-team/react-jsonschema-form/blob/main/CHANGELOG.md) with a description of the PR - [ ] **I'm adding a new feature** diff --git a/packages/antd/src/widgets/CheckboxesWidget/index.tsx b/packages/antd/src/widgets/CheckboxesWidget/index.tsx index 6fd6f8e8b8..1d6b8b0c45 100644 --- a/packages/antd/src/widgets/CheckboxesWidget/index.tsx +++ b/packages/antd/src/widgets/CheckboxesWidget/index.tsx @@ -61,7 +61,7 @@ export default function CheckboxesWidget< id={optionId(id, i)} name={id} autoFocus={i === 0 ? autofocus : false} - disabled={Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1} + disabled={Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1} value={String(i)} > {option.label} diff --git a/packages/antd/src/widgets/RadioWidget/index.tsx b/packages/antd/src/widgets/RadioWidget/index.tsx index 4f32fb7b5c..ea59a9b56b 100644 --- a/packages/antd/src/widgets/RadioWidget/index.tsx +++ b/packages/antd/src/widgets/RadioWidget/index.tsx @@ -61,7 +61,7 @@ export default function RadioWidget diff --git a/packages/antd/test/__snapshots__/Form.test.tsx.snap b/packages/antd/test/__snapshots__/Form.test.tsx.snap index dfb63ca9c3..b30d98564c 100644 --- a/packages/antd/test/__snapshots__/Form.test.tsx.snap +++ b/packages/antd/test/__snapshots__/Form.test.tsx.snap @@ -2674,6 +2674,181 @@ exports[`single fields select field multiple choice enumDisabled 1`] = ` `; +exports[`single fields select field multiple choice enumDisabled using checkboxes 1`] = ` +
+
+
+
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
+
+
+
+
+ +
+`; + exports[`single fields select field multiple choice formData 1`] = `
`; +exports[`single fields select field single choice enumDisabled using radio widget 1`] = ` + +
+
+
+
+
+
+
+ + +
+
+
+
+
+
+
+ +
+`; + exports[`single fields select field single choice formData 1`] = `
`; +exports[`single fields select field multiple choice enumDisabled using checkboxes 1`] = ` + +
+
+
+
+
+ +
+
+`; + exports[`single fields select field multiple choice formData 1`] = `
`; +exports[`single fields select field single choice enumDisabled using radio widget 1`] = ` + +
+
+
+
+
+ +
+
+`; + exports[`single fields select field single choice formData 1`] = `
`; +exports[`single fields select field multiple choice enumDisabled using checkboxes 1`] = ` +.emotion-1 { + margin-bottom: 1px; +} + +.emotion-2 { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; +} + +.emotion-2>*:not(style)~*:not(style) { + margin-top: 0.5rem; + -webkit-margin-end: 0px; + margin-inline-end: 0px; + margin-bottom: 0px; + -webkit-margin-start: 0px; + margin-inline-start: 0px; +} + +.emotion-3 { + cursor: pointer; + display: -webkit-inline-box; + display: -webkit-inline-flex; + display: -ms-inline-flexbox; + display: inline-flex; + -webkit-align-items: center; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + vertical-align: top; + position: relative; +} + +.emotion-4 { + display: -webkit-inline-box; + display: -webkit-inline-flex; + display: -ms-inline-flexbox; + display: inline-flex; + -webkit-align-items: center; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + -webkit-box-pack: center; + -ms-flex-pack: center; + -webkit-justify-content: center; + justify-content: center; + vertical-align: top; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + -webkit-flex-shrink: 0; + -ms-flex-negative: 0; + flex-shrink: 0; +} + +.emotion-5 { + -webkit-margin-start: 0.5rem; + margin-inline-start: 0.5rem; +} + +.emotion-19 { + margin-top: 3px; +} + +.emotion-20 { + display: -webkit-inline-box; + display: -webkit-inline-flex; + display: -ms-inline-flexbox; + display: inline-flex; + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + appearance: none; + -webkit-align-items: center; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + -webkit-box-pack: center; + -ms-flex-pack: center; + -webkit-justify-content: center; + justify-content: center; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + position: relative; + white-space: nowrap; + vertical-align: middle; + outline: 2px solid transparent; + outline-offset: 2px; + width: auto; +} + + +
+
+
+
+ + + + +
+
+
+
+
+ +
+
+`; + exports[`single fields select field multiple choice formData 1`] = ` .emotion-1 { margin-bottom: 1px; @@ -4390,6 +4749,246 @@ exports[`single fields select field single choice enumDisabled 1`] = ` `; +exports[`single fields select field single choice enumDisabled using radio widget 1`] = ` +.emotion-1 { + margin-bottom: 1px; +} + +.emotion-3 { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; +} + +.emotion-3>*:not(style)~*:not(style) { + margin-top: 0.5rem; + -webkit-margin-end: 0px; + margin-inline-end: 0px; + margin-bottom: 0px; + -webkit-margin-start: 0px; + margin-inline-start: 0px; +} + +.emotion-4 { + display: -webkit-inline-box; + display: -webkit-inline-flex; + display: -ms-inline-flexbox; + display: inline-flex; + -webkit-align-items: center; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + vertical-align: top; + cursor: pointer; +} + +.emotion-5 { + display: -webkit-inline-box; + display: -webkit-inline-flex; + display: -ms-inline-flexbox; + display: inline-flex; + -webkit-align-items: center; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + -webkit-box-pack: center; + -ms-flex-pack: center; + -webkit-justify-content: center; + justify-content: center; + -webkit-flex-shrink: 0; + -ms-flex-negative: 0; + flex-shrink: 0; +} + +.emotion-6 { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + -webkit-margin-start: 0.5rem; + margin-inline-start: 0.5rem; +} + +.emotion-10 { + margin-top: 3px; +} + +.emotion-11 { + display: -webkit-inline-box; + display: -webkit-inline-flex; + display: -ms-inline-flexbox; + display: inline-flex; + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + appearance: none; + -webkit-align-items: center; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + -webkit-box-pack: center; + -ms-flex-pack: center; + -webkit-justify-content: center; + justify-content: center; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + position: relative; + white-space: nowrap; + vertical-align: middle; + outline: 2px solid transparent; + outline-offset: 2px; + width: auto; +} + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ +
+
+`; + exports[`single fields select field single choice formData 1`] = ` .emotion-1 { margin-bottom: 1px; diff --git a/packages/core/test/__snapshots__/FormSnap.test.jsx.snap b/packages/core/test/__snapshots__/FormSnap.test.jsx.snap index 2f5dc571f7..2bc49762b8 100644 --- a/packages/core/test/__snapshots__/FormSnap.test.jsx.snap +++ b/packages/core/test/__snapshots__/FormSnap.test.jsx.snap @@ -1074,6 +1074,129 @@ exports[`single fields select field multiple choice enumDisabled 1`] = ` `; +exports[`single fields select field multiple choice enumDisabled using checkboxes 1`] = ` +
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+ +
+
+`; + exports[`single fields select field multiple choice formData 1`] = `
`; +exports[`single fields select field single choice enumDisabled using radio widget 1`] = ` + +
+
+
+ +
+
+ +
+
+
+
+ +
+
+`; + exports[`single fields select field single choice formData 1`] = `