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: resolve #20728 customize header checkbox labels in Transfer #21139

Merged

Conversation

morenyang
Copy link
Contributor

@morenyang morenyang commented Jan 29, 2020

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / document update
  • Component style update
  • TypeScript definition update
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

close #20728

💡 Background and solution

  • Add a new prop: selectAllLabels
export type SelectAllLabel =
  | React.ReactNode
  | ((info: { selectedCount: number; totalCount: number }) => React.ReactNode);

export interface TransferProps {
  // ...
  selectAllLabels?: SelectAllLabel[];
}
  • Render checkbox label if use provide content or rendering function.
if (selectAllLabel) {
  return typeof selectAllLabel === 'function'
    ? selectAllLabel({ selectedCount, totalCount })
    : selectAllLabel;
}

📝 Changelog

Language Changelog
🇺🇸 English Add selectAllLabels prop in Transfer component, allow users to customize header checkbox labels in Transfer.
🇨🇳 Chinese

☑️ Self Check before Merge

  • 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

View rendered components/transfer/index.en-US.md
View rendered components/transfer/index.zh-CN.md

Copy link

@tests-checker tests-checker bot left a comment

Choose a reason for hiding this comment

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

Could you please add tests to make sure this change works as expected?

@morenyang morenyang changed the base branch from master to feature January 29, 2020 15:27
@ant-design-bot
Copy link
Contributor

ant-design-bot commented Jan 29, 2020

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jan 29, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 4e8a2d6:

Sandbox Source
antd reproduction template Configuration

@codecov
Copy link

codecov bot commented Jan 29, 2020

Codecov Report

Merging #21139 into feature will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           feature   #21139      +/-   ##
===========================================
+ Coverage    97.45%   97.45%   +<.01%     
===========================================
  Files          296      296              
  Lines         6912     6920       +8     
  Branches      1918     1912       -6     
===========================================
+ Hits          6736     6744       +8     
  Misses         176      176
Impacted Files Coverage Δ
components/transfer/list.tsx 100% <100%> (ø) ⬆️
components/transfer/index.tsx 95.52% <100%> (+0.03%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5fcd73c...4e8a2d6. Read the comment docs.

@zombieJ
Copy link
Member

zombieJ commented Feb 3, 2020

  • checkboxLabel => selectAllLabels
  • Add .md demo for this and mark as debug

@afc163 afc163 removed the enhancement label Feb 3, 2020
@morenyang
Copy link
Contributor Author

  • Add .md demo for this and mark as debug

Should I change the base branch to master?

@yoyo837
Copy link
Contributor

yoyo837 commented Feb 3, 2020

  • Add .md demo for this and mark as debug

Should I change the base branch to master?

No, continue adding demo in current branch.

@morenyang morenyang force-pushed the feature-transfer-checkbox-label branch from 483d54a to c64eae4 Compare February 3, 2020 05:23
@zombieJ
Copy link
Member

zombieJ commented Feb 4, 2020

LGTM
cc @afc163 @yoyo837 @shaodahong

@zombieJ zombieJ merged commit 347fea6 into ant-design:feature Feb 4, 2020
@morenyang morenyang deleted the feature-transfer-checkbox-label branch May 21, 2020 09:34
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.

6 participants