box / box/box-ui-elements

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

Open
#3,839 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
551
Forks
351
Avg merge
5d 9h
Merged PRs (30d)
31

Description

https://github.com/box/box-ui-elements/blob/3ef104035f92441ba67c396641b3ab859c038bdd/src/elements/content-uploader/UploadInput.js#L10

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;

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

OR

```ts
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
);
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.