diff --git a/src/components/fileupload/FileUpload.d.ts b/src/components/fileupload/FileUpload.d.ts index c41fc199b..1e53b833d 100755 --- a/src/components/fileupload/FileUpload.d.ts +++ b/src/components/fileupload/FileUpload.d.ts @@ -30,6 +30,7 @@ declare class FileUpload { $emit(eventName: 'error', e: { originalEvent: Event, files: any }): this; $emit(eventName: 'before-send', e: { xhr: XMLHttpRequest, formData: any }): this; $emit(eventName: 'clear'): this; + $emit(eventName: 'remove', e: { file: File, files: File[] }): this; } export default FileUpload; diff --git a/src/components/fileupload/FileUpload.vue b/src/components/fileupload/FileUpload.vue index 22d5fced6..bbd4cf3ca 100755 --- a/src/components/fileupload/FileUpload.vue +++ b/src/components/fileupload/FileUpload.vue @@ -48,7 +48,7 @@ import Ripple from 'primevue/ripple'; export default { name: 'FileUpload', - emits: ['select', 'uploader', 'before-upload', 'progress', 'upload', 'error', 'before-send', 'clear'], + emits: ['select', 'uploader', 'before-upload', 'progress', 'upload', 'error', 'before-send', 'clear', 'remove'], props: { name: { type: String, @@ -357,8 +357,12 @@ export default { }, remove(index) { this.clearInputElement(); - this.files.splice(index, 1); + let removedFile = this.files.splice(index, 1)[0]; this.files = [...this.files]; + this.$emit('remove', { + file: removedFile, + files: this.files + }); }, clearInputElement() { this.$refs.fileInput.value = ''; diff --git a/src/views/fileupload/FileUploadDoc.vue b/src/views/fileupload/FileUploadDoc.vue index 418670b45..3d060f22b 100755 --- a/src/views/fileupload/FileUploadDoc.vue +++ b/src/views/fileupload/FileUploadDoc.vue @@ -223,61 +223,67 @@ myUploader(event) {
Name | -Parameters | -Description | -
---|---|---|
Name | +Parameters | +Description | +
before-upload | -event.xhr: XmlHttpRequest instance. - event.formData: FormData object. |
- Callback to invoke before file upload begins to customize the request - such as post parameters before the files. | -
before-send | -event.xhr: XmlHttpRequest instance. - event.formData: FormData object. |
- Callback to invoke before file send begins to customize the request - such as adding headers. | -
upload | -event.xhr: XmlHttpRequest instance. - event.files: Uploaded files. |
- Callback to invoke when file upload is complete. | -
error | -event.xhr: XmlHttpRequest instance. - event.files: Files that are not uploaded. |
- Callback to invoke if file upload fails. | -
clear | --. | -Callback to invoke when files in queue are removed without uploading. | -
select | -event.originalEvent: Original browser event. - event.files: List of selected files. |
- Callback to invoke when file upload is complete. | -
progress | -event.originalEvent: Original browser event. - event.progress: Calculated progress value. |
- Callback to invoke when files are selected. | -
uploader | -event.files: List of selected files. | -Callback to invoke to implement a custom upload. | -
before-upload | +event.xhr: XmlHttpRequest instance. + event.formData: FormData object. |
+ Callback to invoke before file upload begins to customize the request + such as post parameters before the files. | +
before-send | +event.xhr: XmlHttpRequest instance. + event.formData: FormData object. |
+ Callback to invoke before file send begins to customize the request + such as adding headers. | +
upload | +event.xhr: XmlHttpRequest instance. + event.files: Uploaded files. |
+ Callback to invoke when file upload is complete. | +
error | +event.xhr: XmlHttpRequest instance. + event.files: Files that are not uploaded. |
+ Callback to invoke if file upload fails. | +
clear | +-. | +Callback to invoke when files in queue are removed without uploading. | +
select | +event.originalEvent: Original browser event. + event.files: List of selected files. |
+ Callback to invoke when file upload is complete. | +
progress | +event.originalEvent: Original browser event. + event.progress: Calculated progress value. |
+ Callback to invoke when files are selected. | +
uploader | +event.files: List of selected files. | +Callback to invoke to implement a custom upload. | +
remove | +event.file: Remove filed + event.files: Remaining files to be uploaded. |
+ Callback to invoke when a singe file is removed from the list. | +