New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: RangePicker allowClear does not disable the clear button #44015
fix: RangePicker allowClear does not disable the clear button #44015
Conversation
Run & review this pull request in StackBlitz Codeflow. |
fd7e757
to
70d79af
Compare
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #44015 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 658 658
Lines 11178 11186 +8
Branches 3027 3029 +2
=========================================
+ Hits 11178 11186 +8
☔ View full report in Codecov by Sentry. |
d50dc55
to
c7f5643
Compare
bae3fa7
to
025ada1
Compare
This comment was marked as resolved.
This comment was marked as resolved.
reflects actual desired outcome when allowClear is false
025ada1
to
8c66709
Compare
8c66709
to
853089c
Compare
This comment was marked as resolved.
This comment was marked as resolved.
It doesn't matter! That maybe a bug of argos! |
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
Fix #44012
💡 Background and solution
A regression was introduced in 24697bb that results in
generatePicker
andgenerateRangePicker
building the finalallowClear
prop solely from theclearIcon
prop, without respectingallowClear===false
. This makes it impossible for the library user to make a date picker non-clearable.The proposed solution uses
allowClear
, as provided to the date picker, when it isfalse
or an object bearingclearIcon
. Otherwise, the finalallowClear
prop is built from theclearIcon
prop.The proposed solution skips building an icon-bearingallowClear
prop, when theallowClear
prop on the date picker is set tofalse
, and theclearIcon
prop on the date picker is undefined.📝 Changelog
☑️ Self-Check before Merge
🚀 Summary
🤖 Generated by Copilot at 025ada1
The pull request adds a new feature to the
DatePicker
andRangePicker
components that allows users to customize the clear icon. The pull request also improves the testing of these components by using new modules, components, and utilities. The pull request modifies the filescomponents/date-picker/generatePicker/generateRangePicker.tsx
,components/date-picker/generatePicker/generateSinglePicker.tsx
,components/date-picker/util.ts
,components/date-picker/__tests__/DatePicker.test.tsx
,components/date-picker/__tests__/RangePicker.test.tsx
, andcomponents/date-picker/__tests__/utils.ts
.🔍 Walkthrough
🤖 Generated by Copilot at 025ada1
allowClear
prop to theDatePicker
andRangePicker
components, which can be a boolean or an object that specifies theclearIcon
(link, link, link, link, link)mergeAllowClear
function from theutil.ts
module in thegenerateSinglePicker.tsx
andgenerateRangePicker.tsx
modules, which handles the logic of theallowClear
prop (link, link, link)allowClear
prop in theDatePicker.test.tsx
andRangePicker.test.tsx
modules, which verify the existence and appearance of the clear icon (link, link)userEvent
,screen
,waitFor
, andCloseCircleFilled
in theDatePicker.test.tsx
andRangePicker.test.tsx
modules, and use them in the new test cases (link, link, link)utils.ts
module, and use them in the new test cases (link)