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(transfer): add renderCustom props #1664

Merged
merged 1 commit into from
May 17, 2016
Merged

feat(transfer): add renderCustom props #1664

merged 1 commit into from
May 17, 2016

Conversation

jasonslyvia
Copy link
Contributor

First of all, thanks for your contribution! :-)

Please makes sure these boxes are checked before submitting your PR, thank you!

  • Make sure you follow antd's code convention.
  • Run npm run lint and fix those errors before submitting in order to keep consistent code style.
  • Rebase before creating a PR to keep commit history clear.
  • Add some descriptions and refer relative issues for you PR.

Add custom render support for Transfer component, for implementing features like this:

image

When you want to render custom element in Transfer while still have the filter support, you can pass both render and renderCustom props.

  • render will be used when rendering title or matching filters
  • renderCustom will be used for rendering the transfer item

I believe this change is backward-compatible.

@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @waywardmonkeys, @afc163 and @benjycui to be potential reviewers

@afc163
Copy link
Member

afc163 commented May 12, 2016

Maybe this will be better:

// return item.content should be backward-compatible.
render(item) {
  return {
    label: <div className="custom-item" style={{ color: 'red' }}>{item.content} - {item.description}</div>,   // for displayed item
    value: item.content,   // for title and filter matching
  };
}

@jasonslyvia
Copy link
Contributor Author

I'm okay with either way but it's up to you, so I've updated the PR, thoughts? @afc163

let renderedText;
let renderedEl;

if (typeof renderResult === 'object') {
Copy link
Member

@afc163 afc163 May 12, 2016

Choose a reason for hiding this comment

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

@jasonslyvia
Copy link
Contributor Author

Oops, missed that, a more solid check added.

@afc163
Copy link
Member

afc163 commented May 13, 2016

rebase 一下,回头放到 1.1 上。

@jasonslyvia
Copy link
Contributor Author

done

@jasonslyvia
Copy link
Contributor Author

Please inform me of when you're ready to merge and I will rebase upstream one more time :P

@superRaytin
Copy link
Contributor

Sorry for being late, please rebase and I will merge this PR

@jasonslyvia
Copy link
Contributor Author

done

@superRaytin
Copy link
Contributor

👍 👍

@superRaytin superRaytin merged commit d7a26ae into ant-design:master May 17, 2016
@afc163
Copy link
Member

afc163 commented May 17, 2016

对,文档要对应更新下。

@superRaytin
Copy link
Contributor

superRaytin commented May 17, 2016

感觉增加一个 demo 就好了

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

4 participants