feat(bulk): reorganize context menu with sections and submenu for workflow actions

Group 15 flat menu items into 5 logical sections (Workflow, Metadata,
Attributes, Organize, Download) with section headers to reduce cognitive
load. Nest the three workflow-related actions (Append, Replace, Copy
Syntax) into a single "Send to Workflow" hover-triggered submenu.

Add submenu infrastructure to BaseContextMenu with mouseover/mouseout
boundary detection, 250ms close delay, and viewport-aware positioning.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Will Miao
2026-05-11 21:06:47 +08:00
parent ab6100f596
commit 75f74d54d8
14 changed files with 316 additions and 53 deletions

View File

@@ -51,6 +51,14 @@ export class BulkContextMenu extends BaseContextMenu {
if (copyAllItem) {
copyAllItem.style.display = config.copyAll ? 'flex' : 'none';
}
// Submenu parent visibility
const sendToWorkflowSubmenu = this.menu.querySelector('[data-has-submenu="send-to-workflow"]');
if (sendToWorkflowSubmenu) {
const hasWorkflowActions = config.sendToWorkflow || config.copyAll;
sendToWorkflowSubmenu.style.display = hasWorkflowActions ? 'flex' : 'none';
}
if (refreshAllItem) {
refreshAllItem.style.display = config.refreshAll ? 'flex' : 'none';
}
@@ -148,6 +156,14 @@ export class BulkContextMenu extends BaseContextMenu {
);
}
}
// Hide empty sections
this.menu.querySelectorAll('.context-menu-section').forEach(section => {
const items = Array.from(section.querySelectorAll('.context-menu-item'))
.filter(item => !item.closest('.context-submenu'));
const allHidden = items.length > 0 && items.every(item => item.style.display === 'none');
section.style.display = allHidden ? 'none' : '';
});
}
updateSelectedCountHeader() {