mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 20:19:34 +01:00
feat(CommandPalette): handle static groups (#1458)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
@@ -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
|
||||
]
|
||||
})
|
||||
|
||||
|
||||
@@ -24,5 +24,6 @@ export interface Group {
|
||||
commands?: Command[]
|
||||
search?: Function
|
||||
filter?: Function
|
||||
static?: Boolean
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user