Skip to content

Commit 23d202a

Browse files
Fix 4938 to support slotProps and InputProps with endAdornment already specified (#4940)
Fixes #4938 by updating the `@rjsf/mui` `BaseInputTemplate` to properly handle existing `endAdornment`s when the `allowClearTextInputs` flag is true - In `@rjsf/mui`, updated `BaseInputTemplate` to properly handle `slotProps` and `InputProps` with existing `endAdornment`s when the `allowClearTextInputs` flag is true - In `snapshot-tests` added tests for `allowClearTextInputs` with data as well as readonly to test the feature - Updated the snapshots accordingly - Updated the `uiSchema.md` to add documetation for `allowClearTextInputs` - Updated `CHANGELOG.md` accordingly
1 parent 8b7a58c commit 23d202a

15 files changed

Lines changed: 3646 additions & 970 deletions

File tree

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,17 @@ should change the heading of the (upcoming) version to include a major version b
1616
1717
-->
1818

19+
# 6.2.5
20+
21+
## @rjsf/mui
22+
23+
- Updated `BaseInputTemplate` to properly handle `slotProps` and `InputProps` (deprecated by MUI) with existing `endAdornment`s when the `allowClearTextInputs` flag is true, fixing [#4938](https://github.com/rjsf-team/react-jsonschema-form/issues/4938)
24+
25+
## Dev / docs / playground
26+
27+
- Updated `uiSchema.md` to add documentation for `allowClearTextInputs`
28+
- Updated the `formTests.tsx` in `snapshot-tests` to render string fields with the `allowClearTextInputs` flag enabled, with data and readonly to test the new feature
29+
1930
# 6.2.4
2031

2132
## Dev / docs / playground

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

Lines changed: 149 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16567,7 +16567,155 @@ exports[`single fields string field required field with markdown help 1`] = `
1656716567
</DocumentFragment>
1656816568
`;
1656916569

16570-
exports[`single fields string field with placeholder 1`] = `
16570+
exports[`single fields string field string field with allowClearTextInputs and readonly 1`] = `
16571+
<DocumentFragment>
16572+
<form
16573+
class="rjsf"
16574+
>
16575+
<div
16576+
class="rjsf-field rjsf-field-string"
16577+
>
16578+
<div
16579+
class="ant-form-item css-dev-only-do-not-override-ac2jek ant-form-item-horizontal"
16580+
>
16581+
<div
16582+
class="ant-row ant-form-item-row css-dev-only-do-not-override-ac2jek"
16583+
>
16584+
<div
16585+
class="ant-col ant-col-24 ant-form-item-control css-dev-only-do-not-override-ac2jek"
16586+
>
16587+
<div
16588+
class="ant-form-item-control-input"
16589+
>
16590+
<div
16591+
class="ant-form-item-control-input-content"
16592+
>
16593+
<span
16594+
class="ant-input-affix-wrapper ant-input-disabled ant-input-affix-wrapper-disabled css-dev-only-do-not-override-ac2jek ant-input-outlined"
16595+
style="width: 100%;"
16596+
>
16597+
<input
16598+
aria-describedby="root__error root__description root__help"
16599+
class="ant-input ant-input-disabled css-dev-only-do-not-override-ac2jek"
16600+
disabled=""
16601+
id="root"
16602+
name="root"
16603+
placeholder=""
16604+
type="text"
16605+
value="foo"
16606+
/>
16607+
<span
16608+
class="ant-input-suffix"
16609+
/>
16610+
</span>
16611+
</div>
16612+
</div>
16613+
</div>
16614+
</div>
16615+
</div>
16616+
</div>
16617+
<button
16618+
class="ant-btn css-dev-only-do-not-override-ac2jek ant-btn-submit"
16619+
type="submit"
16620+
>
16621+
<span>
16622+
Submit
16623+
</span>
16624+
</button>
16625+
</form>
16626+
</DocumentFragment>
16627+
`;
16628+
16629+
exports[`single fields string field string field with allowClearTextInputs and value 1`] = `
16630+
<DocumentFragment>
16631+
<form
16632+
class="rjsf"
16633+
>
16634+
<div
16635+
class="rjsf-field rjsf-field-string"
16636+
>
16637+
<div
16638+
class="ant-form-item css-dev-only-do-not-override-ac2jek ant-form-item-horizontal"
16639+
>
16640+
<div
16641+
class="ant-row ant-form-item-row css-dev-only-do-not-override-ac2jek"
16642+
>
16643+
<div
16644+
class="ant-col ant-col-24 ant-form-item-control css-dev-only-do-not-override-ac2jek"
16645+
>
16646+
<div
16647+
class="ant-form-item-control-input"
16648+
>
16649+
<div
16650+
class="ant-form-item-control-input-content"
16651+
>
16652+
<span
16653+
class="ant-input-affix-wrapper css-dev-only-do-not-override-ac2jek ant-input-outlined"
16654+
style="width: 100%;"
16655+
>
16656+
<input
16657+
aria-describedby="root__error root__description root__help"
16658+
class="ant-input css-dev-only-do-not-override-ac2jek"
16659+
id="root"
16660+
name="root"
16661+
placeholder=""
16662+
type="text"
16663+
value="foo"
16664+
/>
16665+
<span
16666+
class="ant-input-suffix"
16667+
/>
16668+
</span>
16669+
<button
16670+
class="ant-btn css-dev-only-do-not-override-ac2jek ant-btn-link ant-btn-color-link ant-btn-variant-link ant-btn-icon-only"
16671+
style="padding-top: 4px;"
16672+
title="clear input"
16673+
type="button"
16674+
>
16675+
<span
16676+
class="ant-btn-icon"
16677+
>
16678+
<span
16679+
aria-label="close"
16680+
class="anticon anticon-close"
16681+
role="img"
16682+
>
16683+
<svg
16684+
aria-hidden="true"
16685+
data-icon="close"
16686+
fill="currentColor"
16687+
fill-rule="evenodd"
16688+
focusable="false"
16689+
height="1em"
16690+
viewBox="64 64 896 896"
16691+
width="1em"
16692+
>
16693+
<path
16694+
d="M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z"
16695+
/>
16696+
</svg>
16697+
</span>
16698+
</span>
16699+
</button>
16700+
</div>
16701+
</div>
16702+
</div>
16703+
</div>
16704+
</div>
16705+
</div>
16706+
<button
16707+
class="ant-btn css-dev-only-do-not-override-ac2jek ant-btn-submit"
16708+
type="submit"
16709+
>
16710+
<span>
16711+
Submit
16712+
</span>
16713+
</button>
16714+
</form>
16715+
</DocumentFragment>
16716+
`;
16717+
16718+
exports[`single fields string field string field with placeholder 1`] = `
1657116719
<DocumentFragment>
1657216720
<form
1657316721
class="rjsf"

0 commit comments

Comments
 (0)