Skip to content
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

refactor: Select deprecated showArrow prop #43520

Merged
merged 8 commits into from Jul 19, 2023

Conversation

MuxinFeng
Copy link
Contributor

@MuxinFeng MuxinFeng commented Jul 12, 2023

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Internationalization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Workflow
  • Other (about what?)

🔗 Related issue link

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English Select & Tree-Select & Cascader component deprecated showArrow prop
🇨🇳 Chinese Select & Tree-Select & Cascader 组件废弃 showArrow 属性

☑️ Self-Check before Merge

⚠️ Please check all items below before requesting a reviewing. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

🚀 Summary

🤖 Generated by Copilot at c983312

This pull request refactors the Select component to use the suffixIcon prop instead of the showArrow and inputIcon props. This simplifies the API and allows more customization of the select appearance. It also updates the demos and the documentation to reflect the new prop name and default value.

🔍 Walkthrough

🤖 Generated by Copilot at c983312

  • Deprecate showArrow prop and replace it with suffixIcon prop in Select component and related components (link, link, link, link, link, link, link, link, link, link, link, link, link)
  • Remove showArrow prop from Select component in custom-tag-render demo and update documentation to reflect default value of suffixIcon prop (link, link, link)
  • Add deprecation warning to showArrow prop in InternalSelectProps interface in components/select/index.tsx (link)
  • Rename mergedShowArrow variable to showSuffixIcon and change useShowArrow hook to accept suffixIcon prop in InternalSelect value or function in components/select/index.tsx (link)
  • Replace showArrow prop with showSuffixIcon prop in useSelect hook call and RcSelect component call in InternalSelect value or function in components/select/index.tsx (link, link, link)
  • Change useShowArrow hook logic to return true if suffixIcon prop is not null in components/select/useShowArrow.ts (link)
  • Rename showArrow prop to showSuffixIcon prop and replace it with showSuffixIcon prop in getSuffixIconNode function call in iconUtil function in components/select/utils/iconUtil.tsx (link, link, link)
  • Remove unused inputIcon prop from SelectProps interface and RcSelect component call in components/select/index.tsx (link, link)
  • Replace showArrow prop with suffixIcon prop set to null to hide arrow icon in Select component in search-box demo (link)

@stackblitz
Copy link

stackblitz bot commented Jul 12, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 12, 2023

@MuxinFeng MuxinFeng changed the title refactor: remove showArrow prop refactor: Select deprecated showArrow prop Jul 12, 2023
@socket-security
Copy link

socket-security bot commented Jul 17, 2023

Updated and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Packages Version New capabilities Transitives Size Publisher
rc-cascader 3.12.1...3.13.0 None +0/-1 166 kB madccc

🚮 Removed packages: rc-select@14.5.2, rc-tree-select@5.9.0

@argos-ci
Copy link

argos-ci bot commented Jul 17, 2023

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) 👍 Changes approved 1 change Jul 19, 2023, 11:59 AM

@codecov
Copy link

codecov bot commented Jul 17, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (c377457) 100.00% compared to head (ebaf914) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##           feature    #43520   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          657       658    +1     
  Lines        11077     11091   +14     
  Branches      2998      2998           
=========================================
+ Hits         11077     11091   +14     
Impacted Files Coverage Δ
components/auto-complete/index.tsx 100.00% <ø> (ø)
components/cascader/index.tsx 100.00% <100.00%> (ø)
components/select/index.tsx 100.00% <100.00%> (ø)
components/select/useShowArrow.ts 100.00% <100.00%> (ø)
components/select/utils/iconUtil.tsx 100.00% <100.00%> (ø)
components/tree-select/index.tsx 100.00% <100.00%> (ø)

... and 65 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -131,7 +136,7 @@ const InternalSelect = <
}, [props.mode]);

const isMultiple = mode === 'multiple' || mode === 'tags';
const mergedShowArrow = useShowArrow(showArrow);
const showSuffixIcon = useShowArrow(props.suffixIcon);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

要兼容 showArrow,留个 test case 保证废弃的 api 也有效

@@ -221,6 +227,12 @@ const InternalSelect = <
'Select',
'`dropdownMatchSelectWidth` is deprecated. Please use `popupMatchSelectWidth` instead.',
);

warning(
showArrow === undefined,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
showArrow === undefined,
!('showArrow' in props),

@MadCcc MadCcc merged commit 084f234 into ant-design:feature Jul 19, 2023
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants