From d2054c8fa7760c82ce0d6aed2dd2efab41946b64 Mon Sep 17 00:00:00 2001 From: KingMario Date: Wed, 12 Jun 2024 15:32:58 +0800 Subject: [PATCH 1/5] fix: disabled property of options in CheckboxesWidget and RadioWidget of antd theme --- packages/antd/src/widgets/CheckboxesWidget/index.tsx | 2 +- packages/antd/src/widgets/RadioWidget/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 From c013f503b51fedb7583908d0a61111139777940b Mon Sep 17 00:00:00 2001 From: KingMario Date: Wed, 12 Jun 2024 16:19:01 +0800 Subject: [PATCH 2/5] chore: update CHANGELOG.md for #4216 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b908b85d9..ed895e7762 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 RadioWidgep ([#4216](https://github.com/rjsf-team/react-jsonschema-form/pull/4216)) + # 5.18.5 ## @rjsf/antd From 726b28b5bb8a72f3104e63eb4cace82d5a036896 Mon Sep 17 00:00:00 2001 From: Changyu Geng Date: Thu, 27 Jun 2024 07:24:18 +0800 Subject: [PATCH 3/5] chore: update formTests --- .../test/__snapshots__/Form.test.tsx.snap | 285 +++ .../test/__snapshots__/Form.test.tsx.snap | 216 ++ .../test/__snapshots__/Form.test.tsx.snap | 599 ++++++ .../test/__snapshots__/FormSnap.test.jsx.snap | 198 ++ .../test/__snapshots__/Form.test.tsx.snap | 560 ++++- .../test/__snapshots__/Form.test.tsx.snap | 254 ++- .../test/__snapshots__/Form.test.tsx.snap | 533 ++++- .../mui/test/__snapshots__/Form.test.tsx.snap | 1895 +++++++++++++---- .../test/__snapshots__/Form.test.tsx.snap | 252 +++ packages/snapshot-tests/src/formTests.tsx | 30 + 10 files changed, 4249 insertions(+), 573 deletions(-) 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`] = `