Skip to content

Commit c40f4e6

Browse files
Fixed ESM issue with validator-ajv8 (#4522)
* Fixed ESM issue with validator-ajv8 There is another place where the ESM build needs an update to for proper import of AJV standalone code. - Added a new `ajvReplacer` that adds `/index.js` to the end of `ajv/dist/standalone` - Updated `@rjsf/validator-ajv8` to add the `ajvReplacer` to the `tsconfig.replacer.json` and `tsc.build.json` - Also fixed up some formatting around imports in a few files - Updated `.gitignore` to add `ajvReplacer.js` - Updated `formTests.ts` to add tests for the fix in [#4519](#4519) - Updated the snapshots for these new tests - Updated the `CHANGELOG.md` accordingly * - Fixed comment
1 parent db2462f commit c40f4e6

File tree

20 files changed

+3480
-407
lines changed

20 files changed

+3480
-407
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,5 @@ out/
142142
*.tsbuildinfo
143143
lodashReplacer.js
144144
muiReplacer.js
145+
ajvReplacer.js
145146

CHANGELOG.md

+14
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,20 @@ it according to semantic versioning. For example, if your PR adds a breaking cha
1515
should change the heading of the (upcoming) version to include a major version bump.
1616
1717
-->
18+
# 5.24.8
19+
20+
## @rjsf/antd
21+
22+
- Fixed the total disable of the `RadioWidget`, fixing [#4481](https://github.com/rjsf-team/react-jsonschema-form/issues/4481)
23+
24+
## @rjsf/validator-ajv8
25+
26+
- Fixed up the ESM build to properly handle ESM imports for `compileSchemaValidatorsCode()` by adding a new `ajvReplacer.ts` and using it
27+
28+
## Dev / docs / playground
29+
30+
- Updated `snapshot-tests` to add validation of disable `RadioWidget` via the `Form` prop as well as `uiSchema`
31+
1832
# 5.24.7
1933

2034
## Dev / docs / playground

packages/antd/test/__snapshots__/Form.test.tsx.snap

+220
Original file line numberDiff line numberDiff line change
@@ -3554,6 +3554,116 @@ exports[`single fields select field single choice enumDisabled using radio widge
35543554
</form>
35553555
`;
35563556

3557+
exports[`single fields select field single choice form disabled using radio widget 1`] = `
3558+
<form
3559+
className="rjsf"
3560+
noValidate={false}
3561+
onSubmit={[Function]}
3562+
>
3563+
<div
3564+
className="form-group field field-string"
3565+
>
3566+
<div
3567+
className="ant-form-item css-dev-only-do-not-override-1b0bdye"
3568+
>
3569+
<div
3570+
className="ant-row ant-form-item-row css-dev-only-do-not-override-1b0bdye"
3571+
style={
3572+
{
3573+
"rowGap": undefined,
3574+
}
3575+
}
3576+
>
3577+
<div
3578+
className="ant-col ant-col-24 ant-form-item-control css-dev-only-do-not-override-1b0bdye"
3579+
style={{}}
3580+
>
3581+
<div
3582+
className="ant-form-item-control-input"
3583+
>
3584+
<div
3585+
className="ant-form-item-control-input-content"
3586+
>
3587+
<div
3588+
aria-describedby="root__error root__description root__help"
3589+
className="ant-radio-group ant-radio-group-outline css-dev-only-do-not-override-1b0bdye"
3590+
id="root"
3591+
onBlur={[Function]}
3592+
onFocus={[Function]}
3593+
>
3594+
<label
3595+
className="ant-radio-wrapper ant-radio-wrapper-disabled ant-radio-wrapper-in-form-item css-dev-only-do-not-override-1b0bdye"
3596+
style={{}}
3597+
>
3598+
<span
3599+
className="ant-radio ant-wave-target ant-radio-disabled"
3600+
>
3601+
<input
3602+
autoFocus={false}
3603+
checked={false}
3604+
className="ant-radio-input"
3605+
disabled={true}
3606+
id="root-0"
3607+
name="root"
3608+
onChange={[Function]}
3609+
type="radio"
3610+
value="0"
3611+
/>
3612+
<span
3613+
className="ant-radio-inner"
3614+
/>
3615+
</span>
3616+
<span>
3617+
foo
3618+
</span>
3619+
</label>
3620+
<label
3621+
className="ant-radio-wrapper ant-radio-wrapper-disabled ant-radio-wrapper-in-form-item css-dev-only-do-not-override-1b0bdye"
3622+
style={{}}
3623+
>
3624+
<span
3625+
className="ant-radio ant-wave-target ant-radio-disabled"
3626+
>
3627+
<input
3628+
autoFocus={false}
3629+
checked={false}
3630+
className="ant-radio-input"
3631+
disabled={true}
3632+
id="root-1"
3633+
name="root"
3634+
onChange={[Function]}
3635+
type="radio"
3636+
value="1"
3637+
/>
3638+
<span
3639+
className="ant-radio-inner"
3640+
/>
3641+
</span>
3642+
<span>
3643+
bar
3644+
</span>
3645+
</label>
3646+
</div>
3647+
</div>
3648+
</div>
3649+
</div>
3650+
</div>
3651+
</div>
3652+
</div>
3653+
<button
3654+
className="ant-btn css-dev-only-do-not-override-1b0bdye ant-btn-submit"
3655+
disabled={true}
3656+
onClick={[Function]}
3657+
style={{}}
3658+
type="submit"
3659+
>
3660+
<span>
3661+
Submit
3662+
</span>
3663+
</button>
3664+
</form>
3665+
`;
3666+
35573667
exports[`single fields select field single choice formData 1`] = `
35583668
<form
35593669
className="rjsf"
@@ -3697,6 +3807,116 @@ exports[`single fields select field single choice formData 1`] = `
36973807
</form>
36983808
`;
36993809

3810+
exports[`single fields select field single choice uiSchema disabled using radio widget 1`] = `
3811+
<form
3812+
className="rjsf"
3813+
noValidate={false}
3814+
onSubmit={[Function]}
3815+
>
3816+
<div
3817+
className="form-group field field-string"
3818+
>
3819+
<div
3820+
className="ant-form-item css-dev-only-do-not-override-1b0bdye"
3821+
>
3822+
<div
3823+
className="ant-row ant-form-item-row css-dev-only-do-not-override-1b0bdye"
3824+
style={
3825+
{
3826+
"rowGap": undefined,
3827+
}
3828+
}
3829+
>
3830+
<div
3831+
className="ant-col ant-col-24 ant-form-item-control css-dev-only-do-not-override-1b0bdye"
3832+
style={{}}
3833+
>
3834+
<div
3835+
className="ant-form-item-control-input"
3836+
>
3837+
<div
3838+
className="ant-form-item-control-input-content"
3839+
>
3840+
<div
3841+
aria-describedby="root__error root__description root__help"
3842+
className="ant-radio-group ant-radio-group-outline css-dev-only-do-not-override-1b0bdye"
3843+
id="root"
3844+
onBlur={[Function]}
3845+
onFocus={[Function]}
3846+
>
3847+
<label
3848+
className="ant-radio-wrapper ant-radio-wrapper-disabled ant-radio-wrapper-in-form-item css-dev-only-do-not-override-1b0bdye"
3849+
style={{}}
3850+
>
3851+
<span
3852+
className="ant-radio ant-wave-target ant-radio-disabled"
3853+
>
3854+
<input
3855+
autoFocus={false}
3856+
checked={false}
3857+
className="ant-radio-input"
3858+
disabled={true}
3859+
id="root-0"
3860+
name="root"
3861+
onChange={[Function]}
3862+
type="radio"
3863+
value="0"
3864+
/>
3865+
<span
3866+
className="ant-radio-inner"
3867+
/>
3868+
</span>
3869+
<span>
3870+
foo
3871+
</span>
3872+
</label>
3873+
<label
3874+
className="ant-radio-wrapper ant-radio-wrapper-disabled ant-radio-wrapper-in-form-item css-dev-only-do-not-override-1b0bdye"
3875+
style={{}}
3876+
>
3877+
<span
3878+
className="ant-radio ant-wave-target ant-radio-disabled"
3879+
>
3880+
<input
3881+
autoFocus={false}
3882+
checked={false}
3883+
className="ant-radio-input"
3884+
disabled={true}
3885+
id="root-1"
3886+
name="root"
3887+
onChange={[Function]}
3888+
type="radio"
3889+
value="1"
3890+
/>
3891+
<span
3892+
className="ant-radio-inner"
3893+
/>
3894+
</span>
3895+
<span>
3896+
bar
3897+
</span>
3898+
</label>
3899+
</div>
3900+
</div>
3901+
</div>
3902+
</div>
3903+
</div>
3904+
</div>
3905+
</div>
3906+
<button
3907+
className="ant-btn css-dev-only-do-not-override-1b0bdye ant-btn-submit"
3908+
disabled={false}
3909+
onClick={[Function]}
3910+
style={{}}
3911+
type="submit"
3912+
>
3913+
<span>
3914+
Submit
3915+
</span>
3916+
</button>
3917+
</form>
3918+
`;
3919+
37003920
exports[`single fields slider field 1`] = `
37013921
<form
37023922
className="rjsf"

0 commit comments

Comments
 (0)