Skip to content

Commit

Permalink
Fixed #2974 - FileUpload | new content slot
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Sep 15, 2022
1 parent 3ec3989 commit 3a762a3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
6 changes: 5 additions & 1 deletion api-generator/components/fileupload.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,13 @@ const FileUploadEvents = [
];

const FileUploadSlots = [
{
name: 'content',
description: 'Custom uploaded content template.'
},
{
name: 'empty',
description: 'Custom content when there is no selected file'
description: 'Custom content when there is no selected file.'
}
];

Expand Down
6 changes: 5 additions & 1 deletion src/components/fileupload/FileUpload.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,11 @@ export interface FileUploadProps {

export interface FileUploadSlots {
/**
* Custom empty template.
* Custom uploaded content template.
*/
content: () => VNode[];
/**
* Custom content when there is no selected file.
*/
empty: () => VNode[];
}
Expand Down
7 changes: 5 additions & 2 deletions src/components/fileupload/FileUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
</div>
</div>
</div>
<div v-if="$slots.content && !hasFiles">
<slot name="content"></slot>
</div>
<div v-if="$slots.empty && !hasFiles" class="p-fileupload-empty">
<slot name="empty"></slot>
</div>
Expand All @@ -41,10 +44,10 @@

<script>
import Button from 'primevue/button';
import ProgressBar from 'primevue/progressbar';
import Message from 'primevue/message';
import { DomHandler } from 'primevue/utils';
import ProgressBar from 'primevue/progressbar';
import Ripple from 'primevue/ripple';
import { DomHandler } from 'primevue/utils';
export default {
name: 'FileUpload',
Expand Down

0 comments on commit 3a762a3

Please sign in to comment.