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

Suggestion: The handleChange would be useful as a prop for the contentExplorer #3839

Open
Lukortech opened this issue Jan 11, 2025 · 1 comment

Comments

@Lukortech
Copy link

I am working with Box Api using the scaffolding and building the appliction from different elements.
My suggestion would be to add an event that'd allow developers to control the selection of contentUploader via props passed down or at least be able to hook onto an event that's exposed at the top level.

I went through the docs and was really surprised not to see a simple code to work;

this.currentContentExplorer = new Box.ContentExplorer();
this.currentContentExplorer.on('chooseFiles', (files: Entry[]) => {
  if(customValidation(files)) this.attachmentsService.upload(files);
});

OR

this.currentContentExplorer = new Box.ContentExplorer();
this.contentExplorerProps = {
  contentUploaderProps: {
    onSelection: (selectedFiles: Entries[]) => boolean; // tells if the files selected are valid to be displayed in the list
  }
}
this.currentContentExplorer.show(
  this.getCurrentFolderId(),
  this.ssoService.refreshedToken),
  this.contentExplorerProps
);
devin-ai-integration bot pushed a commit that referenced this issue Jan 13, 2025
Co-Authored-By: gregorywong@box.com <gregorywong@box.com>
devin-ai-integration bot added a commit that referenced this issue Jan 13, 2025
Co-Authored-By: gregorywong@box.com <gregorywong@box.com>
@Lukortech
Copy link
Author

There's the issue with DroppableContent that it passes down onSelect but it doesn't accept it from any other place and it makes it rather difficult to provide other means to react to user selection.
onSelect={handleSelectFiles}

Here we see that there are props taken into account but nothing about injecting any validation.
https://github.com/Lukortech/box-ui-elements/blob/master/src/elements/content-uploader/ContentUploader.tsx#L1082

Davis seems to have two PRs open one of which even deleted the unused handleChange

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

No branches or pull requests

1 participant