6767 />
6868 </div >
6969 <!-- Content -->
70- <div v-else class =" relative size-full" >
70+ <div v-else class =" relative size-full" @click = " handleEmptySpaceClick " >
7171 <VirtualGrid
7272 :items =" mediaAssetsWithKey"
7373 :grid-style =" {
9797 <template #footer >
9898 <div
9999 v-if =" hasSelection"
100- class =" flex h-18 w-full items-center justify-between px-4 "
100+ class =" flex gap-1 h-18 w-full items-center justify-between"
101101 >
102- <div >
102+ <div ref = " selectionCountButtonRef " class = " flex-1 pl-4 " >
103103 <TextButton
104- v-if =" isHoveringSelectionCount"
105- :label =" $t('mediaAsset.selection.deselectAll')"
104+ :label ="
105+ isHoveringSelectionCount
106+ ? $t('mediaAsset.selection.deselectAll')
107+ : $t('mediaAsset.selection.selectedCount', {
108+ count: totalOutputCount
109+ })
110+ "
106111 type =" transparent"
107112 @click =" handleDeselectAll"
108- @mouseleave =" isHoveringSelectionCount = false"
109113 />
110- <span
111- v-else
112- role =" button"
113- tabindex =" 0"
114- :aria-label =" $t('mediaAsset.selection.deselectAll')"
115- class =" cursor-pointer px-3 text-sm focus:ring-2 focus:ring-primary focus:outline-none"
116- @mouseenter =" isHoveringSelectionCount = true"
117- @keydown.enter =" handleDeselectAll"
118- @keydown.space.prevent =" handleDeselectAll"
119- >
120- {{
121- $t('mediaAsset.selection.selectedCount', { count: selectedCount })
122- }}
123- </span >
124114 </div >
125- <div class =" flex gap-2" >
115+ <div class =" flex gap-2 pr-4 " >
126116 <IconTextButton
127117 v-if =" shouldShowDeleteButton"
128118 :label =" $t('mediaAsset.selection.deleteSelected')"
155145</template >
156146
157147<script setup lang="ts">
158- import { useDebounceFn } from ' @vueuse/core'
148+ import { useDebounceFn , useElementHover } from ' @vueuse/core'
159149import ProgressSpinner from ' primevue/progressspinner'
160150import { useToast } from ' primevue/usetoast'
161151import { computed , onMounted , onUnmounted , ref , watch } from ' vue'
@@ -223,7 +213,6 @@ const {
223213 isSelected,
224214 handleAssetClick,
225215 hasSelection,
226- selectedCount,
227216 clearSelection,
228217 getSelectedAssets,
229218 activate : activateSelection,
@@ -232,8 +221,15 @@ const {
232221
233222const { downloadMultipleAssets, deleteMultipleAssets } = useMediaAssetActions ()
234223
235- // Hover state for selection count
236- const isHoveringSelectionCount = ref (false )
224+ // Hover state for selection count button
225+ const selectionCountButtonRef = ref <HTMLElement | null >(null )
226+ const isHoveringSelectionCount = useElementHover (selectionCountButtonRef )
227+
228+ // Total output count for all selected assets
229+ const totalOutputCount = computed (() => {
230+ const selectedAssets = getSelectedAssets (displayAssets .value )
231+ return selectedAssets .reduce ((sum , asset ) => sum + getOutputCount (asset ), 0 )
232+ })
237233
238234const currentAssets = computed (() =>
239235 activeTab .value === ' input' ? inputAssets : outputAssets
@@ -400,7 +396,6 @@ const exitFolderView = () => {
400396 folderExecutionTime .value = undefined
401397 folderAssets .value = []
402398 searchQuery .value = ' '
403- clearSelection ()
404399}
405400
406401onMounted (() => {
@@ -413,7 +408,12 @@ onUnmounted(() => {
413408
414409const handleDeselectAll = () => {
415410 clearSelection ()
416- isHoveringSelectionCount .value = false
411+ }
412+
413+ const handleEmptySpaceClick = () => {
414+ if (hasSelection ) {
415+ clearSelection ()
416+ }
417417}
418418
419419const copyJobId = async () => {
0 commit comments