From 9e0edc27abff867bfd74226c2077b038f032c7b1 Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Mon, 18 Jul 2022 14:31:23 +0200 Subject: [PATCH] chore(CommandPalette): improve component --- .../components/navigation/CommandPalette.vue | 3 +- .../navigation/CommandPaletteGroup.vue | 31 ++++++++++++++----- src/runtime/types/command-palette.d.ts | 17 +++++----- 3 files changed, 31 insertions(+), 20 deletions(-) diff --git a/src/runtime/components/navigation/CommandPalette.vue b/src/runtime/components/navigation/CommandPalette.vue index f8ddf492..4149c656 100644 --- a/src/runtime/components/navigation/CommandPalette.vue +++ b/src/runtime/components/navigation/CommandPalette.vue @@ -91,8 +91,7 @@ const fuse = props.groups.reduce((acc, group) => { const groups = computed(() => props.groups.map((group) => { return { - key: group.key, - label: group.label, + ...group, commands: fuse[group.key].results.value.map(result => result.item).slice(0, group.options?.resultLimit || options.value.resultLimit) } }).filter(group => group.commands.length)) diff --git a/src/runtime/components/navigation/CommandPaletteGroup.vue b/src/runtime/components/navigation/CommandPaletteGroup.vue index 42dc7aef..24bc5144 100644 --- a/src/runtime/components/navigation/CommandPaletteGroup.vue +++ b/src/runtime/components/navigation/CommandPaletteGroup.vue @@ -13,14 +13,29 @@ :disabled="command.disabled" as="template" > -
  • -
    -
  • +
    +
    + + {{ command.suffix }} + + {{ shortcut }} +
  • @@ -30,11 +45,11 @@