|
74 | 74 | :name="t('files', 'Loading current folder')" /> |
75 | 75 |
|
76 | 76 | <!-- Empty content placeholder --> |
77 | | - <NcEmptyContent v-else-if="!loading && isEmptyDir" |
78 | | - :name="currentView?.emptyTitle || t('files', 'No files in here')" |
79 | | - :description="currentView?.emptyCaption || t('files', 'Upload some content or sync with your devices!')" |
80 | | - data-cy-files-content-empty> |
81 | | - <template v-if="directory !== '/'" #action> |
82 | | - <!-- Uploader --> |
83 | | - <UploadPicker v-if="currentFolder && canUpload && !isQuotaExceeded" |
84 | | - allow-folders |
85 | | - class="files-list__header-upload-button" |
86 | | - :content="getContent" |
87 | | - :destination="currentFolder" |
88 | | - :forbidden-characters="forbiddenCharacters" |
89 | | - multiple |
90 | | - @failed="onUploadFail" |
91 | | - @uploaded="onUpload" /> |
92 | | - <NcButton v-else |
93 | | - :aria-label="t('files', 'Go to the previous folder')" |
94 | | - :to="toPreviousDir" |
95 | | - type="primary"> |
96 | | - {{ t('files', 'Go back') }} |
97 | | - </NcButton> |
98 | | - </template> |
99 | | - <template #icon> |
100 | | - <NcIconSvgWrapper :svg="currentView.icon" /> |
101 | | - </template> |
102 | | - </NcEmptyContent> |
| 77 | + <template v-else-if="!loading && isEmptyDir"> |
| 78 | + <div v-if="currentView?.emptyView" class="files-list__empty-view-wrapper"> |
| 79 | + <div ref="customEmptyView" /> |
| 80 | + </div> |
| 81 | + <NcEmptyContent v-else |
| 82 | + :name="currentView?.emptyTitle || t('files', 'No files in here')" |
| 83 | + :description="currentView?.emptyCaption || t('files', 'Upload some content or sync with your devices!')" |
| 84 | + data-cy-files-content-empty> |
| 85 | + <template v-if="directory !== '/'" #action> |
| 86 | + <!-- Uploader --> |
| 87 | + <UploadPicker v-if="currentFolder && canUpload && !isQuotaExceeded" |
| 88 | + allow-folders |
| 89 | + class="files-list__header-upload-button" |
| 90 | + :content="getContent" |
| 91 | + :destination="currentFolder" |
| 92 | + :forbidden-characters="forbiddenCharacters" |
| 93 | + multiple |
| 94 | + @failed="onUploadFail" |
| 95 | + @uploaded="onUpload" /> |
| 96 | + <NcButton v-else |
| 97 | + :aria-label="t('files', 'Go to the previous folder')" |
| 98 | + :to="toPreviousDir" |
| 99 | + type="primary"> |
| 100 | + {{ t('files', 'Go back') }} |
| 101 | + </NcButton> |
| 102 | + </template> |
| 103 | + <template #icon> |
| 104 | + <NcIconSvgWrapper :svg="currentView.icon" /> |
| 105 | + </template> |
| 106 | + </NcEmptyContent> |
| 107 | + </template> |
103 | 108 |
|
104 | 109 | <!-- File list --> |
105 | 110 | <FilesListVirtual v-else |
@@ -391,9 +396,27 @@ export default defineComponent({ |
391 | 396 | filtersChanged() { |
392 | 397 | return this.filtersStore.filtersChanged |
393 | 398 | }, |
| 399 | +
|
| 400 | + showCustomEmptyView() { |
| 401 | + return !this.loading && this.isEmptyDir && this.currentView?.emptyView !== undefined |
| 402 | + } |
394 | 403 | }, |
395 | 404 |
|
396 | 405 | watch: { |
| 406 | + /** |
| 407 | + * Handle rendering the custom empty view |
| 408 | + * @param show The current state if the custom empty view should be rendered |
| 409 | + */ |
| 410 | + showCustomEmptyView(show: boolean) { |
| 411 | + if (show) { |
| 412 | + this.$nextTick(() => { |
| 413 | + const el = this.$refs.customEmptyView as HTMLDivElement |
| 414 | + // We can cast here because "showCustomEmptyView" assets that current view is set |
| 415 | + this.currentView!.emptyView!(el) |
| 416 | + }) |
| 417 | + } |
| 418 | + }, |
| 419 | +
|
397 | 420 | currentView(newView, oldView) { |
398 | 421 | if (newView?.id === oldView?.id) { |
399 | 422 | return |
@@ -679,6 +702,11 @@ export default defineComponent({ |
679 | 702 | } |
680 | 703 | } |
681 | 704 |
|
| 705 | + &__empty-view-wrapper { |
| 706 | + display: flex; |
| 707 | + height: 100%; |
| 708 | + } |
| 709 | +
|
682 | 710 | &__refresh-icon { |
683 | 711 | flex: 0 0 44px; |
684 | 712 | width: 44px; |
|
0 commit comments