mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-09 01:20:09 +00:00
rename event
update ref
This commit is contained in:
@@ -122,7 +122,7 @@
|
||||
@output-count-click="enterFolderView(item)"
|
||||
@context-menu-opened="openContextMenuId = item.id"
|
||||
@bulk-download="handleBulkDownload"
|
||||
@delete-assets="handleDeleteAssets"
|
||||
@bulk-delete="handleBulkDelete"
|
||||
/>
|
||||
</template>
|
||||
</VirtualGrid>
|
||||
@@ -200,8 +200,6 @@ import {
|
||||
onMounted,
|
||||
onUnmounted,
|
||||
ref,
|
||||
shallowRef,
|
||||
triggerRef,
|
||||
watch
|
||||
} from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
@@ -248,7 +246,7 @@ const isQueuePanelV2Enabled = computed(() =>
|
||||
const openContextMenuId = ref<string | null>(null)
|
||||
|
||||
// Track which assets are currently being deleted (for showing loading state)
|
||||
const deletingAssetIds = shallowRef(new Set<string>())
|
||||
const deletingAssetIds = ref(new Set<string>())
|
||||
|
||||
// Determine if delete button should be shown
|
||||
// Hide delete button when in input tab and not in cloud (OSS mode - files are from local folders)
|
||||
@@ -543,12 +541,13 @@ const handleDownloadSelected = () => {
|
||||
}
|
||||
|
||||
const setAssetsDeletingState = (assetIds: string[], isDeleting: boolean) => {
|
||||
assetIds.forEach((id) =>
|
||||
isDeleting
|
||||
? deletingAssetIds.value.add(id)
|
||||
: deletingAssetIds.value.delete(id)
|
||||
)
|
||||
triggerRef(deletingAssetIds)
|
||||
assetIds.forEach((id) => {
|
||||
if (isDeleting) {
|
||||
deletingAssetIds.value.add(id)
|
||||
} else {
|
||||
deletingAssetIds.value.delete(id)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const handleBulkDownload = (assets: AssetItem[]) => {
|
||||
@@ -557,9 +556,9 @@ const handleBulkDownload = (assets: AssetItem[]) => {
|
||||
}
|
||||
|
||||
const handleDeleteSelected = () =>
|
||||
handleDeleteAssets(getSelectedAssets(displayAssets.value))
|
||||
handleBulkDelete(getSelectedAssets(displayAssets.value))
|
||||
|
||||
const handleDeleteAssets = async (assets: AssetItem[]) => {
|
||||
const handleBulkDelete = async (assets: AssetItem[]) => {
|
||||
const assetIds = assets.map((a) => a.id)
|
||||
|
||||
await deleteMultipleAssets(assets, (isDeleting) =>
|
||||
|
||||
@@ -135,7 +135,7 @@
|
||||
:is-bulk-mode="hasSelection && (selectedAssets?.length ?? 0) > 1"
|
||||
@zoom="handleZoomClick"
|
||||
@bulk-download="emit('bulk-download', $event)"
|
||||
@delete-assets="emit('delete-assets', $event)"
|
||||
@bulk-delete="emit('bulk-delete', $event)"
|
||||
/>
|
||||
</template>
|
||||
|
||||
@@ -205,7 +205,7 @@ const emit = defineEmits<{
|
||||
'output-count-click': []
|
||||
'context-menu-opened': []
|
||||
'bulk-download': [assets: AssetItem[]]
|
||||
'delete-assets': [assets: AssetItem[]]
|
||||
'bulk-delete': [assets: AssetItem[]]
|
||||
}>()
|
||||
|
||||
const cardContainerRef = ref<HTMLElement>()
|
||||
|
||||
@@ -63,7 +63,7 @@ const {
|
||||
const emit = defineEmits<{
|
||||
zoom: []
|
||||
'bulk-download': [assets: AssetItem[]]
|
||||
'delete-assets': [assets: AssetItem[]]
|
||||
'bulk-delete': [assets: AssetItem[]]
|
||||
}>()
|
||||
|
||||
const contextMenu = ref<InstanceType<typeof ContextMenu>>()
|
||||
@@ -151,7 +151,7 @@ const contextMenuItems = computed<MenuItem[]>(() => {
|
||||
items.push({
|
||||
label: t('mediaAsset.selection.deleteSelectedAll'),
|
||||
icon: 'icon-[lucide--trash-2]',
|
||||
command: () => emit('delete-assets', selectedAssets)
|
||||
command: () => emit('bulk-delete', selectedAssets)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ const contextMenuItems = computed<MenuItem[]>(() => {
|
||||
items.push({
|
||||
label: t('mediaAsset.actions.delete'),
|
||||
icon: 'icon-[lucide--trash-2]',
|
||||
command: () => emit('delete-assets', [asset])
|
||||
command: () => emit('bulk-delete', [asset])
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user