mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-01 11:10:00 +00:00
feat: add bulk context menu for multi-asset selection (#7923)
This commit is contained in:
@@ -88,6 +88,22 @@ export function useAssetSelection() {
|
||||
return allAssets.filter((asset) => selectionStore.isSelected(asset.id))
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the output count for a single asset
|
||||
* Same logic as in AssetsSidebarTab.vue
|
||||
*/
|
||||
function getOutputCount(item: AssetItem): number {
|
||||
const count = item.user_metadata?.outputCount
|
||||
return typeof count === 'number' && count > 0 ? count : 1
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the total output count for given assets
|
||||
*/
|
||||
function getTotalOutputCount(assets: AssetItem[]): number {
|
||||
return assets.reduce((sum, asset) => sum + getOutputCount(asset), 0)
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate key event listeners (when sidebar opens)
|
||||
*/
|
||||
@@ -116,6 +132,8 @@ export function useAssetSelection() {
|
||||
selectAll,
|
||||
clearSelection: () => selectionStore.clearSelection(),
|
||||
getSelectedAssets,
|
||||
getOutputCount,
|
||||
getTotalOutputCount,
|
||||
reset: () => selectionStore.reset(),
|
||||
|
||||
// Lifecycle management
|
||||
|
||||
Reference in New Issue
Block a user