npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dropzone-vue-next

v0.2.1

Published

Vue 3 Library Component for seamless file upload

Downloads

1

Readme

dropzone-vue-next

NPM Downloads Snyk Vulnerabilities for npm package NPM License NPM Version npm collaborators

Vue 3 Library Component for seamless file upload.

:rocket: Features

  • Typescript support
  • No dependencies
  • Drag and drop file uploads
  • Custom accepted file types
  • XHR custom: Header, url, method and form data.
  • Parallel upload with different request
  • Multiple upload files in a single request
  • Chunking
  • Custom styling
  • Events
  • Provide your own markup for drop, error and success message

Install and basic usage

$ pnpm add dropzone-vue-next
$ npm install dropzone-vue-next

Register the component

import DropZone from 'dropzone-vue-next'
import 'dropzone-vue-next/dist/style.css'

createApp(App).use(DropZone).mount('#app')

Now your component inside a code:

<template>
    <DropZone :max-files="10000000000" :upload-on-drop="false" :multiple-upload="true" :accepted-files="['image/*']" :parallel-upload="3">
        <template #default="{ files }">
            <div v-for="(item, id) in files" :key="id">
                <img :src="item.thumbnail" alt="thumbnail" width="100" />
                {{ item.file.name }}
            </div>
        </template>
    </DropZone>
</template>

Props

url

Type: String Required: false Default: window.localtion

Upload url

<DropZone url="http://endpoint/upload"></DropZone>

method

Type: String Required: false Default: POST

Upload method can be POST or PUT

<DropZone method="PUT"></DropZone>

headers

Type: Object Required: false Default: {}

Send additional headers to the server.

<DropZone :headers="{"header1": "value"}">

param-name

Type: String Required: false Default: file

Formdata key for file upload request

<DropZone param-name="test"></DropZone>

xhr-timeout

Type: number Required: false Default: 60000

The timeout for the XHR requests in milliseconds

<DropZone :xhr-timeout="500"></DropZone>

with-credentials

Type: boolean Required: false Default: false

with-credentials option for XHR requests

<DropZone :with-credentials="true"></DropZone>

upload-on-drop

Type: boolean Required: false Default: true

Process the upload automatically on drop or on file selection if it's set to true

<DropZone :upload-on-drop="true"></DropZone>

if it's set to false, the upload can be triggered with:

<DropZone ref="dropzone" :upload-on-drop="true"></DropZone>
dropzone.value.processQueue()

retry-on-error

Type: boolean Required: false Default: false

Retry an upload if it fail.

<DropZone :retry-on-error="true"></DropZone>

multiple-upload

Type: boolean Required: false Default: false

Send more items in one request, this is disabled in case of the prop chunking is true.

<DropZone :multiple-upload="true"></DropZone>

parallel-upload

Type: number Required: false Default: 3

Parallel request upload to be processed

<DropZone :parallel-upload="6"></DropZone>

max-files

Type: number Required: false Default: null

Max files number accepted by the DropZone, if it not set there is no limit.

<DropZone :max-files="6"></DropZone>

max-file-size

Type: number Required: false Default: 1000000

Bytes value for the max upload size allowed, default 1mb

<DropZone :max-file-size="600000000"></DropZone>

clickable

Type: boolean Required: false Default: true

If active enable the dropzone to be clickable and show the files selection

<DropZone :clickable="false"></DropZone>

accepted-files

Type: string | array Required: false Default: null

Array that contains the accepted file types, if it's null all files are accepted

<DropZone :accepted-files="['exe']"></DropZone>

chunking

Type: boolean Required: false Default: false

Enable the upload chunking feature, if this is active the multiple-upload for request will be set to false.

<DropZone :chunking="true"></DropZone>

number-of-chunks

Type: number Required: false Default: 10

If the chunking mode is active this property represents the number of chunks with which the file will be split

<DropZone :number-of-chunks="5"></DropZone>

Events

config-update

Parameters:

  • config config object with the new values

Called when a props is changed

<DropZone @config-update="onUpdateConfig"></DropZone>

change

Parameters:

  • item {id: 'fileid', file: File}

Called when a file is valid ( type and size ) and added to the queue.

<DropZone @change="onFileAdd"></DropZone>

remove

Parameters:

  • item {id: 'fileid', status: "DONE|ERROR|QUEUE", file: File}

Called when a file is removed.

<DropZone @remove="onFileRemove"></DropZone>

uploaded

Parameters:

  • items [{file: File}]

Called when a file or files are uploaded.

<DropZone @uploaded="uploaded"></DropZone>

upload-error

Parameters:

  • error {ids: Array(['fileid']), errorType: "error type"}

Called when a file or files uploads fail.

<DropZone @upload-error="onErrorUpload"></DropZone>

sending

Parameters:

  • files Array(File)
  • xhr XMLHttpRequest
  • formData FormData

Called when a file is going to be uploaded.

<DropZone @sending="sending"></DropZone>

error

Parameters:

  • files Array(File)
  • error String {'INVALID_TYPE'|'MAX_FILE'|'MAX_FILE_SIZE'}

Called when a file is not added for one of this reason

  • invalid type
  • max file size
  • max file number inside the dropzone
<DropZone @error="onError"></DropZone>

Thanks ❤️

Project is a fork of https://github.com/darknessnerd/drop-zone by @darknessnerd