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

feat: add more props to TransBtn #983

Merged

Conversation

RexSkz
Copy link
Contributor

@RexSkz RexSkz commented Sep 19, 2023

需求

在我们项目的 UI 需求中,需要通过 option 的 disabledvalue 来控制 icon 渲染,例如:

  • 对于 disabled 的条目,需要展示一个 disabled 的 checkbox
  • 对于特殊的 value,需要展示另一种 icon
  • 否则,通过 isSelected 展示正常的 checkbox

目前 menuItemSelectedIcon 支持传入一个函数,但其中的参数只有一个 { isSelected: boolean },这个 PR 将 valuedisabled添加进去,便于开发者使用。

如下图所示,第一条因为是 disabled 状态,所以右边的 icon 被设置为了 0.5 透明度。

image

影响面

  • 行为一致:均为新增字段,因此之前的行为不会变
  • 无需修改文档和类型:文档给的标注是 (props: MenuItemProps) => ReactNode,而 MenuItemProps 没有具体类型;ts 定义里面也没有固定类型

@vercel
Copy link

vercel bot commented Sep 19, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
select ❌ Failed (Inspect) Sep 19, 2023 8:13am

src/OptionList.tsx Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Sep 19, 2023

Codecov Report

Merging #983 (70ec9a4) into master (b5fccbd) will not change coverage.
The diff coverage is n/a.

❗ Current head 70ec9a4 differs from pull request most recent head a9d115f. Consider uploading reports for the commit a9d115f to get more accurate results

@@           Coverage Diff           @@
##           master     #983   +/-   ##
=======================================
  Coverage   99.78%   99.78%           
=======================================
  Files          38       38           
  Lines        1373     1373           
  Branches      400      393    -7     
=======================================
  Hits         1370     1370           
  Misses          3        3           
Files Changed Coverage Δ
src/OptionList.tsx 99.33% <ø> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

src/OptionList.tsx Outdated Show resolved Hide resolved
@zombieJ zombieJ merged commit 0ce4e3f into react-component:master Sep 19, 2023
8 of 9 checks passed
@RexSkz RexSkz deleted the rex/pass-more-props-to-trans-btn branch September 19, 2023 08:52
@zombieJ
Copy link
Member

zombieJ commented Sep 20, 2023

+ rc-select@14.9.0

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