forked from nuxt/devtools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ModuleInstallList.vue
53 lines (47 loc) · 1.09 KB
/
ModuleInstallList.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<script setup lang="ts">
// @ts-expect-error missing types
import { RecycleScroller } from 'vue-virtual-scroller'
import Fuse from 'fuse.js'
const collection = useModulesList()
const search = ref('')
const fuse = computed(() => new Fuse(collection.value || [], {
keys: [
'name',
'description',
'npm',
'category',
],
}))
const items = computed(() => {
if (!search.value)
return collection.value
return fuse.value.search(search.value).map(r => r.item)
})
</script>
<template>
<div h-full flex="~ col gap-4">
<NIconTitle
mx6 mt6
text-xl op75
icon="i-carbon-intent-request-create"
text="Install Module"
/>
<NTextInput
v-model="search"
placeholder="Search..."
icon="carbon-search" n="primary"
mx6 px-5 py-2
/>
<div flex-auto of-auto flex="~ col gap-2" pl6 pr4>
<RecycleScroller
v-slot="{ item }"
class="scroller"
:items="items"
:item-size="160"
key-field="name"
>
<ModuleItemInstall :item="item" />
</RecycleScroller>
</div>
</div>
</template>