node_modules

This commit is contained in:
saeid
2019-07-15 13:07:31 +04:30
parent d3735c6d30
commit ce1a3ebf9c
35713 changed files with 3639219 additions and 1 deletions
+72
View File
@@ -0,0 +1,72 @@
![](https://img.shields.io/npm/v/vuetify-upload-component.svg)
![](https://img.shields.io/github/size/avrtau/vuetify_upload_component/src/Vuetify_upload_component.vue.svg)
# Vuetify Upload Component
This is a simple upload component for [Vuetify](https://vuetifyjs.com/en/).
### Install:
```
npm i vuetify-upload-component -s
```
### Props:
*`accept <String>`:* Limit accepted file-types. [default: "\*"] [More information...](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-accept)
*`multiple <Boolean>`:* Set to accept multiple files. [default: "false"]
*`label <String>`:* Header text. [default: "Attachments"]
### Usage examples:
#### Template:
##### Component with defaults:
```html
<template>
<v-upload v-model="files"></v-upload>
</template>
```
##### Allow multiple files:
```html
<template>
<v-upload v-model="files" multiple></v-upload>
</template>
```
##### Accept only image files:
```html
<template>
<v-upload v-model="files" accept="image/*"></v-upload>
</template>
```
#### Script:
```javascript
<script>
import VUpload from "vuetify-upload-component";
export default {
components: { VUpload },
data: () => ({
files: [] // An array of files received from the vuetify_upload_component
}),
methods: {
doSomethingWithFiles: () => {
if (this.files) {
this.files.forEach(file => {
const reader = new FileReader();
reader.onload = () => {
/*
* Do something with the file
*/
}
reader.readAsBinaryString(file);
}
}
}
}
}
</script>
```
## Useful links:
[FileReader API Example](https://developer.mozilla.org/en-US/docs/Web/API/File/Using_files_from_web_applications#Handling_the_upload_process_for_a_file)
+114
View File
@@ -0,0 +1,114 @@
<template>
<div class="cust_uploader">
<input
type="file"
ref="fileInput"
:accept="accept"
:multiple="multiple"
@change="onFileChange"
>
<v-layout row>
<v-flex>
<v-card>
<v-toolbar color="white">
<v-btn right absolute fab @click="activateFilePrompt" color="primary" small>
<v-icon>add</v-icon>
</v-btn>
<v-toolbar-title>
<v-icon>attach_file</v-icon> {{ label }}
</v-toolbar-title>
</v-toolbar>
<v-list>
<v-list-tile v-for="(item, index) in files" :key="item.name" @click="">
<v-list-tile-action>
<v-icon>insert_drive_file</v-icon>
</v-list-tile-action>
<v-list-tile-content>
<v-list-tile-title v-text="item.name"></v-list-tile-title>
</v-list-tile-content>
<v-list-tile-action @click="deleteAttachment(index)">
<v-icon>delete_forever</v-icon>
</v-list-tile-action>
</v-list-tile>
</v-list>
</v-card>
</v-flex>
</v-layout>
</div>
</template>
<script>
export default {
props: {
accept: {
type: String,
default: '*'
},
label: {
type: String,
default: 'Attachments'
},
multiple: {
type: Boolean,
default: false
}
},
data () {
return {
files: [],
defaultAttachment: {
action: this.deleteAtachment,
title: '',
icon_pre: "insert_drive_file",
icon_post: "delete_forever"
}
}
},
methods: {
activateFilePrompt () {
this.$refs.fileInput.click();
},
onFileChange (event) {
// https://stackoverflow.com/questions/3144419/how-do-i-remove-a-file-from-the-filelist
// FileList --> Array
let inputFiles = [];
Array.prototype.push.apply(inputFiles, this.$refs.fileInput.files);
if (inputFiles.length > 0) {
inputFiles = inputFiles
.filter(inputFile => {
const isDuplicate = this.files.find(file => file.name === inputFile.name) !== undefined;
return !isDuplicate;
});
if (this.multiple) {
inputFiles.forEach(inputFile => { this.files.push(inputFile) });
}
else {
this.files = [];
this.files.push(inputFiles[0]);
}
}
this.$emit('input', this.files);
},
deleteAttachment (itemIndex) {
this.files.splice(itemIndex, 1);
this.$refs.fileInput.value = null;
this.$emit('input', this.files);
}
}
}
</script>
<style scoped>
input[type=file] {
position: absolute;
left: -99999px;
}
</style>
+51
View File
@@ -0,0 +1,51 @@
{
"_args": [
[
"vuetify-upload-component@1.0.6",
"D:\\Atom\\Git\\CSSD"
]
],
"_from": "vuetify-upload-component@1.0.6",
"_id": "vuetify-upload-component@1.0.6",
"_inBundle": false,
"_integrity": "sha512-7g4VjnacxPDAiaKWu+GikqmcLXqlFk6G+SirgajXQHnBgkOP0U0RLqPLU/sdtmcQCfj0l5RjiXTT5RZPDWRpNg==",
"_location": "/vuetify-upload-component",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "vuetify-upload-component@1.0.6",
"name": "vuetify-upload-component",
"escapedName": "vuetify-upload-component",
"rawSpec": "1.0.6",
"saveSpec": null,
"fetchSpec": "1.0.6"
},
"_requiredBy": [
"/"
],
"_resolved": "https://registry.npmjs.org/vuetify-upload-component/-/vuetify-upload-component-1.0.6.tgz",
"_spec": "1.0.6",
"_where": "D:\\Atom\\Git\\CSSD",
"author": {
"name": "Avraham Tauberman",
"url": "https://github.com/avrtau"
},
"bugs": {
"url": "https://github.com/avrtau/vuetify_upload_component/issues"
},
"description": "A simple upload component for Vuetify.",
"homepage": "https://github.com/avrtau/vuetify_upload_component#readme",
"keywords": [
"vuetify",
"upload"
],
"license": "MIT",
"main": "Vuetify_upload_component.vue",
"name": "vuetify-upload-component",
"repository": {
"type": "git",
"url": "git+https://github.com/avrtau/vuetify_upload_component.git"
},
"version": "1.0.6"
}