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

add 'drop-auto-hide-time' to take control of 'dropActive' property #449

Open
wants to merge 2 commits into
base: vue2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions dist/vue-upload-component.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/vue-upload-component.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/vue-upload-component.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/vue-upload-component.min.js.map

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions dist/vue-upload-component.part.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/vue-upload-component.part.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/dist/index.js.map

Large diffs are not rendered by default.

47 changes: 31 additions & 16 deletions docs/docs/en.md
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ Custom upload method

* **Default:** `undefined`

* **Details:**
* **Details:**

`custom-action` priority than `put-action, post-action`

Expand Down Expand Up @@ -764,21 +764,21 @@ All the options to handle chunk uploads
* **Type:** `Object`

* **Default:**
```js
{
headers: {
'Content-Type': 'application/json'
},
action: '',
minSize: 1048576,
maxActive: 3,
maxRetries: 5,

// This is the default Handler implemented in this package
// you can use your own handler if your protocol is different
handler: ChunkUploadDefaultHandler
}
```
```js
{
headers: {
'Content-Type': 'application/json'
},
action: '',
minSize: 1048576,
maxActive: 3,
maxRetries: 5,

// This is the default Handler implemented in this package
// you can use your own handler if your protocol is different
handler: ChunkUploadDefaultHandler
}
```

### drop

Expand All @@ -799,7 +799,22 @@ Drag and drop upload
<file-upload :drop="true"></file-upload>
```

### drop-auto-hide-time

Specify the seconds to automatically set `dropActive` to false.

* **Type:** `Number`

* **Default:** `1000`

* **Details:**

If this property is set to `0` the `dropActive` will keep `true` until the user drop the file or leave the drop area. If set to a positive number then the `dropActive` will be set to `false` after the time specified in this property in seconds.

* **Usage:**
```html
<file-upload :drop-auto-hide-time="0"></file-upload>
```



Expand Down
2 changes: 2 additions & 0 deletions docs/views/examples/Full.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
:headers="headers"
:data="data"
:drop="drop"
:drop-auto-hide-time="dropAutoHideTime"
:drop-directory="dropDirectory"
:add-index="addIndex"
v-model="files"
Expand Down Expand Up @@ -401,6 +402,7 @@ export default {
multiple: true,
directory: false,
drop: true,
dropAutoHideTime: 2000,
dropDirectory: true,
addIndex: false,
thread: 3,
Expand Down
13 changes: 11 additions & 2 deletions src/FileUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ export default {
default: false,
},

dropAutoHideTime: {
type: Number,
default: 1000
},

dropDirectory: {
type: Boolean,
default: true,
Expand Down Expand Up @@ -297,7 +302,7 @@ export default {
this.$parent.$forceUpdate()
}
},


drop(value) {
this.watchDrop(value)
Expand Down Expand Up @@ -1308,6 +1313,10 @@ export default {
},

watchDropActive(newDropActive, oldDropActive) {
if (this.dropAutoHideTime === 0) {
return
}

if (newDropActive === oldDropActive) {
return
}
Expand All @@ -1316,7 +1325,7 @@ export default {
this.dropTimeout = null
}
if (newDropActive) {
this.dropTimeout = setTimeout(this.onDocumentDrop, 1000);
this.dropTimeout = setTimeout(this.onDocumentDrop, this.dropAutoHide)
}
},

Expand Down