Fixed #821 - File Upload cant disable and hide Upload & Cancel

pull/880/head
Cagatay Civici 2021-01-20 12:53:31 +03:00
parent 3b295a16d8
commit 1d0192813c
3 changed files with 24 additions and 2 deletions

View File

@ -18,6 +18,8 @@ declare class FileUpload extends Vue {
uploadLabel?: string; uploadLabel?: string;
cancelLabel?: string; cancelLabel?: string;
customUpload?: boolean; customUpload?: boolean;
showUploadButton?: boolean;
showCancelButton?: boolean;
$emit(eventName: 'select', e: { originalEvent: Event, files: any }): this; $emit(eventName: 'select', e: { originalEvent: Event, files: any }): this;
$emit(eventName: 'before-upload', e: { xhr: XMLHttpRequest, formData: any }): this; $emit(eventName: 'before-upload', e: { xhr: XMLHttpRequest, formData: any }): this;
$emit(eventName: 'progress', e: { originalEvent: Event, progress: any }): this; $emit(eventName: 'progress', e: { originalEvent: Event, progress: any }): this;

View File

@ -6,8 +6,8 @@
<span class="p-button-icon p-button-icon-left pi pi-fw pi-plus"></span> <span class="p-button-icon p-button-icon-left pi pi-fw pi-plus"></span>
<span class="p-button-label">{{chooseButtonLabel}}</span> <span class="p-button-label">{{chooseButtonLabel}}</span>
</span> </span>
<FileUploadButton :label="uploadButtonLabel" icon="pi pi-upload" @click="upload" :disabled="uploadDisabled" /> <FileUploadButton :label="uploadButtonLabel" icon="pi pi-upload" @click="upload" :disabled="uploadDisabled" v-if="showUploadButton" />
<FileUploadButton :label="cancelButtonLabel" icon="pi pi-times" @click="clear" :disabled="cancelDisabled" /> <FileUploadButton :label="cancelButtonLabel" icon="pi pi-times" @click="clear" :disabled="cancelDisabled" v-if="showCancelButton" />
</div> </div>
<div ref="content" class="p-fileupload-content" @dragenter="onDragEnter" @dragover="onDragOver" @dragleave="onDragLeave" @drop="onDrop"> <div ref="content" class="p-fileupload-content" @dragenter="onDragEnter" @dragover="onDragOver" @dragleave="onDragLeave" @drop="onDrop">
<FileUploadProgressBar :value="progress" v-if="hasFiles" /> <FileUploadProgressBar :value="progress" v-if="hasFiles" />
@ -116,6 +116,14 @@ export default {
customUpload: { customUpload: {
type: Boolean, type: Boolean,
default: false default: false
},
showUploadButton: {
type: Boolean,
default: true
},
showCancelButton: {
type: Boolean,
default: true
} }
}, },
duplicateIEEvent: false, duplicateIEEvent: false,

View File

@ -215,6 +215,18 @@ myUploader(event) {
<td>false</td> <td>false</td>
<td>Whether to use the default upload or a manual implementation defined in uploadHandler callback. Defaults to PrimeVue <router-link to="/locale">Locale</router-link> configuration.</td> <td>Whether to use the default upload or a manual implementation defined in uploadHandler callback. Defaults to PrimeVue <router-link to="/locale">Locale</router-link> configuration.</td>
</tr> </tr>
<tr>
<td>showUploadButton</td>
<td>boolean</td>
<td>true</td>
<td>Whether to show the upload button.</td>
</tr>
<tr>
<td>showCancelButton</td>
<td>boolean</td>
<td>true</td>
<td>Whether to show the cancel button.</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>