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

DragDropFiles Control and integration with ListView and FilePicker v3 #861

Merged
merged 3 commits into from
Apr 11, 2021

Conversation

aaclage
Copy link
Contributor

@aaclage aaclage commented Apr 3, 2021

Q A
Bug fix? [x]
New feature? [x]
New sample? [ ]
Related issues? mentioned in #856

What's in this Pull Request?

Update to V3 version.
This new control allows to drag and drop files in pre defined areas.
This control has High impact in following controls ListView and FilePicker since they were changed/added to adapt this new control.
If additional tests or revision need to be made please advise.

This control has the following features that provide enhance and adaptability to existing controls.

  • Include drag and drop of file in pre defined area of existing controls.
  • Add custom Label on Upload Area.
  • Add custom icon based on Office UI Fabric Icons.
  • Enable or disable Control.
  • Manage the output Files from custom Method "onDrop"
  • dropEffect manages the action after drop the file.
    - https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/dropEffect
  • Integration of DragDropFiles in existing Controls ListView and FilePicker > new Tab "Upload Files".
  • Control allow drag and drop of Folders with files, only File[] are return with new property "fullPath" in file.
    - New property "fullPath" was included in file object to allow identify dropped files based on Folders, this allow users to create associated folder path by code (defensive code included https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem/webkitGetAsEntry)

Sample code:

<DragDropFiles 
          dropEffect="copy" 
          enable={true}  
          onDrop={this._getDropFiles}
          iconName="Upload"
          labelMessage= "My custom upload File"
          >
  {/* Specify the components to load where Drag and drop area should work */}
</DragDropFiles>

Simple Sample view:
image

Embedded and integrated with ListView:
image

Embedded and integrated with FilePicker:
image

@aaclage
Copy link
Contributor Author

aaclage commented Apr 6, 2021

Hi @AJIXuMuK receive message the branch was changed,
is this solution under revision? or should not be consider for this version?

Thank you for your attention.

@AJIXuMuK
Copy link
Collaborator

AJIXuMuK commented Apr 6, 2021

Hi @aaclage,

The branch has been changed as I merged a PR into the branch.

So your PR is still valid and valuable for v3 version as well.

I believe @joelfmrodrigues reviewed your PR for v2 so I will pass the review of this one to him as well :)

@aaclage
Copy link
Contributor Author

aaclage commented Apr 6, 2021

Thank you @AJIXuMuK for the feedback.
I was thinking did something incorrect.

@joelfmrodrigues
Copy link
Collaborator

@aaclage just some minor things:
I just noticed that you named one of the controls MultiUploadFilePicket and not MultiUploadFilePicker (notice the last character). Any chance you could fix the name? (I'm assuming it was a typo)

private displayFileNames = (filesResult) => {
const result = [];
for (var i = 0; i < filesResult.length; i++) {
result.push(<div className={styles.localTabFilename}>{filesResult[i].name}</div>);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This loop is generating a warning in the browser console as the repeated elements don't have a key property

Suggested change
result.push(<div className={styles.localTabFilename}>{filesResult[i].name}</div>);
result.push(<div key={i.toString()} className={styles.localTabFilename}>{filesResult[i].name}</div>);

Copy link
Collaborator

Choose a reason for hiding this comment

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

@aaclage I have just added the key property to the version in dev-v2 branch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@joelfmrodrigues already making the changes.

@aaclage
Copy link
Contributor Author

aaclage commented Apr 7, 2021

@aaclage just some minor things:
I just noticed that you named one of the controls MultiUploadFilePicket and not MultiUploadFilePicker (notice the last character). Any chance you could fix the name? (I'm assuming it was a typo)

yes, making the change.

@aaclage
Copy link
Contributor Author

aaclage commented Apr 7, 2021

@joelfmrodrigues updated "Rename to MultipleUploadFilePickerTab" version for revision.

@joelfmrodrigues joelfmrodrigues merged commit a418d66 into pnp:dev Apr 11, 2021
@joelfmrodrigues
Copy link
Collaborator

@aaclage this is now merged. Many thanks!

@aaclage
Copy link
Contributor Author

aaclage commented Apr 12, 2021

Thank you @joelfmrodrigues :), one small missing detail is to include PR in "Milestone" 3.1.0 .

@AJIXuMuK AJIXuMuK added this to the 3.1.0 milestone Apr 12, 2021
@AJIXuMuK
Copy link
Collaborator

@aaclage it won't be missed without milestone anyway :)
Thank you for the contribution!

@estruyf estruyf mentioned this pull request May 5, 2021
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

3 participants