Skip to content

launcherDesktopContextMenuSpecs

Launcher 桌面/云盘/文件夹上下文菜单项 spec 构建器。

函数签名

typescript
function buildLauncherDesktopContextMenuSpecs(canPaste: boolean): ImUiContextMenuItemSpec[]
function buildLauncherDesktopSortMenuSpecs(selectedKey: LauncherDesktopNodeSortKey): ImUiContextMenuItemSpec[]
function buildLauncherCloudDiskNodeContextMenuSpecs(): ImUiContextMenuItemSpec[]
function buildLauncherFolderPaneContextMenuSpecs(canPaste: boolean): ImUiContextMenuItemSpec[]
function buildLauncherFolderExplorerViewModeMenuSpecs(viewMode: LauncherFolderExplorerViewMode): ImUiContextMenuItemSpec[]
function launcherFolderExplorerViewModeToolbarIcon(viewMode: LauncherFolderExplorerViewMode): string
function isLauncherDesktopNodeSortKey(key: string): key is LauncherDesktopNodeSortKey

const LAUNCHER_DESKTOP_SORT_MENU_ITEMS: { key, label }[]
const LAUNCHER_NEW_FOLDER_MENU_ICON: string

参数

函数参数说明
buildLauncherDesktopContextMenuSpecscanPaste控制「粘贴」是否 disabled
buildLauncherDesktopSortMenuSpecsselectedKey当前排序键,对应项 selected: true
buildLauncherFolderPaneContextMenuSpecscanPaste文件夹窗格空白处菜单
buildLauncherFolderExplorerViewModeMenuSpecsviewMode'details' | 'icons' 视图模式
launcherFolderExplorerViewModeToolbarIconviewMode工具栏图标名

返回值

类型说明
ImUiContextMenuItemSpec[]可直接交给 IM UI 上下文菜单渲染的 spec 列表
string视图模式工具栏 iconfont 名

工作原理

  1. build* 函数返回静态菜单结构:keylabelicon,以及 disabled / selected / dividerAfter / danger 等标记。
  2. 桌面主菜单包含新建文件夹、粘贴、更改壁纸、排序方式、整理桌面;排序子菜单来自 LAUNCHER_DESKTOP_SORT_MENU_ITEMS
  3. 云盘节点菜单提供剪切/复制/重命名/移到废纸篓;文件夹窗格仅新建与粘贴。
  4. isLauncherDesktopNodeSortKey 收窄排序键为 name | date | type | size