Skip to content

feat(NcFilePicker): add picker component to select local files #7097

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

susnux
Copy link
Contributor

@susnux susnux commented Jun 26, 2025

☑️ Resolves

This can be used e.g. to upload files, for example in the forms app but also for the files or photos app.
It is more universal than the upload picker from nc-upload as it is not bound to webdav uploader.

🏁 Checklist

  • ⛑️ Tests are included or are not applicable
  • 📘 Component documentation has been extended, updated or is not applicable
  • 2️⃣ Backport to stable8 for maintained Vue 2 version or not applicable

@susnux susnux requested review from ShGKme and Antreesy June 26, 2025 10:56
@susnux susnux added enhancement New feature or request 3. to review Waiting for reviews labels Jun 26, 2025
@susnux susnux force-pushed the feat/nc-file-picker branch from b222280 to 4d458d1 Compare June 26, 2025 11:29
@susnux susnux marked this pull request as ready for review June 26, 2025 11:46
<input ref="input"
:accept="accept?.join(', ')"
:multiple="multiple"
class="hidden-visually"
Copy link
Contributor

Choose a reason for hiding this comment

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

It should have a different class, to be visually hidden, but stays in the same position, like with the hidden input in NcCheckboxRadioSwitch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

why does it needs to stay in that position? Was not a problem in files and photos

Copy link
Contributor

Choose a reason for hiding this comment

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

For the same reason as in <NcCheckboxRadioSwitch> - assistive technologies may focus on an actual input. Unlike visually hidden text, it is still a part of the tab sequence. And then, if the input is moved away, focusing it moves scrolling containers and users with assistive technologies far away.

But now, while writing it, I think it makes less sense for the file input because it is never used directly (like a checkbox does).

Comment on lines +214 to +237
<!-- App defined upload actions -->
<slot name="actions" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add an option to include default 'apps/files/api/v1/templates' actions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Where would this be used?
Files has its own way to register "new"-menu entries and it is not really related to an local-files picker?

Copy link
Contributor

Choose a reason for hiding this comment

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

Everywhere where Filepicker is used to pick a file that is to share, and where it can also be a new file.

Very similar: Files, Talk

image

A bit similar (with a way to select from files, and files templates seem to be missing)

Notes (text):

image

Calendar:

image

Copy link
Contributor

Choose a reason for hiding this comment

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

it is not really related to an local-files picker?

As files are stored in Nextcloud, it often makes sense to also be able to share a file from Nextcloud apart from uploading a new one.

For example, currently 4 different apps have it but name it differently.

Copy link
Contributor

@ShGKme ShGKme Jun 27, 2025

Choose a reason for hiding this comment

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

So it makes sense to me to have a shared component for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So it makes sense to me to have a shared component for it.

Yes but in this case I wanted to first have a file input component, which we could reuse for that.
Because e.g. my use case in forms does not need this. It only needs to pick files from local computer.

Maybe add an option to include default 'apps/files/api/v1/templates' actions?

But here my question was more like that this is apps specific as the files UI does not use this API but instead uses the actions registered on the frontend:
https://nextcloud-libraries.github.io/nextcloud-files/functions/index.getNewFileMenuEntries.html

@susnux susnux force-pushed the feat/nc-file-picker branch from b9da927 to 7ba4e9e Compare June 26, 2025 16:19
@susnux susnux force-pushed the feat/nc-file-picker branch from b6f04d0 to d11a3ab Compare July 8, 2025 15:27
@susnux susnux requested a review from ShGKme July 8, 2025 15:27
inputElement.value!.webkitdirectory = uploadFolders
}

// Wait for <reason to wait>
Copy link
Contributor

Choose a reason for hiding this comment

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

<reason to wait> 👀

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are too fast ;)
Reason was to wait for the DOM to be updated after the <why>

Copy link
Contributor

Choose a reason for hiding this comment

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

You are too fast ;)

You force pushed and requested my review :P

Reason was to wait for the DOM to be updated after the

But you updated DOM via direct DOM manipulation, not via Vue rendering...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well two things its the reset and the DOM - updated the comment

This can be used e.g. to upload files, for example in the forms app but
also for the files or photos app.

Co-authored-by: Ferdinand Thiessen <[email protected]>
Co-authored-by: Grigorii K. Shartsev <[email protected]>
Signed-off-by: Ferdinand Thiessen <[email protected]>
@susnux susnux force-pushed the feat/nc-file-picker branch from d11a3ab to f7320bd Compare July 8, 2025 15:40
@susnux susnux requested a review from ShGKme July 8, 2025 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants