diff --git a/src/runtime/components/navigation/CommandPalette.vue b/src/runtime/components/navigation/CommandPalette.vue index d27e650c..3e186d34 100644 --- a/src/runtime/components/navigation/CommandPalette.vue +++ b/src/runtime/components/navigation/CommandPalette.vue @@ -216,7 +216,7 @@ export default defineComponent({ const commands = computed(() => { const commands: Command[] = [] for (const group of props.groups) { - if (!group.search) { + if (!group.search && !group.static) { commands.push(...(group.commands?.map(command => ({ ...command, group: group.key })) || [])) } } @@ -274,9 +274,14 @@ export default defineComponent({ return getGroupWithCommands(group, [...commands]) }) + const staticGroups: Group[] = props.groups.filter((group) => group.static && group.commands?.length).map((group) => { + return getGroupWithCommands(group, group.commands) + }) + return [ ...groups, - ...searchGroups + ...searchGroups, + ...staticGroups ] }) diff --git a/src/runtime/types/command-palette.ts b/src/runtime/types/command-palette.ts index 4a46f5f1..d08acfc5 100644 --- a/src/runtime/types/command-palette.ts +++ b/src/runtime/types/command-palette.ts @@ -24,5 +24,6 @@ export interface Group { commands?: Command[] search?: Function filter?: Function + static?: Boolean [key: string]: any }