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

Add ability to call own methods on resource item events #210

Merged
merged 6 commits into from
Aug 1, 2018
Merged

Add ability to call own methods on resource item events #210

merged 6 commits into from
Aug 1, 2018

Conversation

thedevelobear
Copy link
Contributor

This PR could add the ability to add own handlers to resource items events. For example if you want to open your own image viewer by double clicking on image file in FileManager it would be impossible. You could only use onSelectionChange, which fires on single click.

Release notes

Add the ability to call click, doubleClick and rightClick events handles through props, so that the user can call own actions on those events.

@kvolkovich-sc
Copy link
Contributor

kvolkovich-sc commented Aug 1, 2018

@jakubszewczyk, thanks for PR!

Please add new properties to FileNavigator documentation.

Please create an issue (you can partially copy-paste PR description) and refer to this PR.

@thedevelobear
Copy link
Contributor Author

@kvolkovich-sc Done 🙂

@kvolkovich-sc
Copy link
Contributor

@jakubszewczyk, thanks. I'll merge and release it a little later.

@thedevelobear
Copy link
Contributor Author

I'm glad. Keep up the good work!

@kvolkovich-sc
Copy link
Contributor

You can avoid if (this.props.onResourceItemClick) {...-like checks by adding onResourceItemClick: () => {} to defaultProps.

@kvolkovich-sc kvolkovich-sc merged commit a2731cf into OpusCapita:master Aug 1, 2018
kvolkovich-sc pushed a commit that referenced this pull request Aug 1, 2018
Client React API changes
=====

FileNavigator component now support these callback props:

- onResourceItemClick
- onResourceItemDoubleClick
- onResourceItemRightClick

Co-authored-by: jakubszewczyk <jakub.szewczykk@gmail.com>
Co-authored-by: kvolkovich-sc <kirill.volkovich@opuscapita.com>
@kvolkovich-sc
Copy link
Contributor

@jakubszewczyk, some of your stuff didn't work. So, I added some modifications to WithSelectionHOC. a1849b3#diff-1122c248c97aac9b8058d4b8723927d2

@thedevelobear
Copy link
Contributor Author

@kvolkovich-sc That's right, thanks for the tip.
I'm sorry to hear that something went wrong - it did work in my case of simply firing a function using props, but I probably didn't think about other possibilities. I'm glad you took care of this code. 🙂

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.

2 participants