pqina / vue-filepond

πŸ”Œ A handy FilePond adapter component for Vue
https://pqina.nl/filepond
MIT License
1.94k stars 128 forks source link

Expose interface to use Filepond as a UI element #14

Closed JoaquimLey closed 6 years ago

JoaquimLey commented 6 years ago

Hi there, first of all, thank you so much for the plugin and the wrappers! Really helps!

My request/question is if you are thinking about exposing an interface to handle the UI states of the component.


For clarification, my use case is using firebase as the backend, so I would like to use the component as a ui-only element, it would be great if I could manipulate the ui state(s), something along the lines of


// self explanatory
pond.getFile(file).uploadStarted()

// self explanatory
pond.getFile(file).setProgress(someValue) 

// sets the 'greenish' state for given file
pond.getFile(file).uploadComplete()  

// sets the 'redish' state for given file
pond.getFile(file).uploadError(error)  

// cancel button was tapped, this is so I could cancel the upload for my call, 
// the ui behavior would be the same (remove from the element)
pond.onCancelUpload(file) 

(...)

Of course the naming and methods could be improved, but these would be utility methods to control the component, I'm aware of the advanced server configuration but I wasn't able to do what I wanted, I found the documentation a little confusing, I'm quite noobish on JS/Vue πŸ‘‹.

I tried to search for similar issues but couldn't really find one, also if there's an easy way to do this with the Server configuration could you try to explain a little further?


I really appreciate your work, and I want to thank you for your time, on developing & maintaining!

rikschennink commented 6 years ago

@JoaquimLey Hi! Thanks! Glad you like it :-)

I currently have no plans to detach the UI from the file processing, it's rather tightly coupled at the moment and detaching it would take considerable effort. There's also the matter of animation timing where state changes happen based on the various interactions and file states, for instance, some will be queued till the interface is in idle state to allow for smooth transitions. Controlling this from the outside will probably result in a less than optimal visualisation.

Know that the advanced server config is set up to allow for fine control over uploading while still having the benefits of the FilePond UI. Feel free to add an issue about the advanced server config, I'm happy to help, and will try to improve the docs ( always learning ). Also, if you have suggestions, pull requests on the docs repository are most welcome.

https://github.com/pqina/filepond-docs

Will close this issue for now as I think we can resolve the problem by correctly setting up the server config.

rikschennink commented 6 years ago

@JoaquimLey I forgot to thank you for the detailed and well thought out issue description, it's very much appreciated.

JoaquimLey commented 6 years ago

Thank you for the very detailed response, I've now opened the new issue πŸ‘† hopefully, it is still possible to find a good enough solution :).

You are very welcome! It is the least I can do, by asking for your generous time, I don't want you to try and guess what my issue is hehe πŸ’ͺ.