fix(command): add generic
This commit is contained in:
parent
0ee23fb53d
commit
1830363294
|
|
@ -92,7 +92,7 @@ const selectedTeam = ref<Team>(groups[0].teams[0])
|
||||||
</Button>
|
</Button>
|
||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
<PopoverContent class="w-[200px] p-0">
|
<PopoverContent class="w-[200px] p-0">
|
||||||
<Command :filter-function="(list, term) => list.filter(i => i.label?.toLowerCase()?.includes(term)) ">
|
<Command :filter-function="(list:typeof groups, term:string) => list.filter(i => i.label?.toLowerCase()?.includes(term)) ">
|
||||||
<CommandList>
|
<CommandList>
|
||||||
<CommandInput placeholder="Search team..." />
|
<CommandInput placeholder="Search team..." />
|
||||||
<CommandEmpty>No team found.</CommandEmpty>
|
<CommandEmpty>No team found.</CommandEmpty>
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,15 @@
|
||||||
<script setup lang="ts">
|
<script lang="ts">
|
||||||
|
type AcceptableValue = string | number | boolean | Record<string, any>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script setup lang="ts" generic="T extends AcceptableValue">
|
||||||
import { type HTMLAttributes, computed } from 'vue'
|
import { type HTMLAttributes, computed } from 'vue'
|
||||||
import type { ComboboxRootEmits, ComboboxRootProps } from 'radix-vue'
|
import type { ComboboxRootEmits, ComboboxRootProps } from 'radix-vue'
|
||||||
import { ComboboxRoot, useForwardPropsEmits } from 'radix-vue'
|
import { ComboboxRoot, useForwardPropsEmits } from 'radix-vue'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
|
|
||||||
const props = withDefaults(defineProps<ComboboxRootProps & { class?: HTMLAttributes['class'] }>(), {
|
const props = withDefaults(defineProps<ComboboxRootProps<T> & { class?: HTMLAttributes['class'] }>(), {
|
||||||
open: true,
|
open: true,
|
||||||
modelValue: '',
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const emits = defineEmits<ComboboxRootEmits>()
|
const emits = defineEmits<ComboboxRootEmits>()
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,15 @@
|
||||||
<script setup lang="ts">
|
<script lang="ts">
|
||||||
|
type AcceptableValue = string | number | boolean | Record<string, any>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script setup lang="ts" generic="T extends AcceptableValue">
|
||||||
import { type HTMLAttributes, computed } from 'vue'
|
import { type HTMLAttributes, computed } from 'vue'
|
||||||
import type { ComboboxRootEmits, ComboboxRootProps } from 'radix-vue'
|
import type { ComboboxRootEmits, ComboboxRootProps } from 'radix-vue'
|
||||||
import { ComboboxRoot, useForwardPropsEmits } from 'radix-vue'
|
import { ComboboxRoot, useForwardPropsEmits } from 'radix-vue'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
|
|
||||||
const props = withDefaults(defineProps<ComboboxRootProps & { class?: HTMLAttributes['class'] }>(), {
|
const props = withDefaults(defineProps<ComboboxRootProps<T> & { class?: HTMLAttributes['class'] }>(), {
|
||||||
open: true,
|
open: true,
|
||||||
modelValue: '',
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const emits = defineEmits<ComboboxRootEmits>()
|
const emits = defineEmits<ComboboxRootEmits>()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user