@motor-cms/ui-admin 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/pages/search.vue +15 -4
- package/package.json +2 -2
package/app/pages/search.vue
CHANGED
|
@@ -30,7 +30,7 @@ watch(() => route.query.search, (newSearch) => {
|
|
|
30
30
|
if (val !== searchInput.value) {
|
|
31
31
|
searchInput.value = val
|
|
32
32
|
page.value = 1
|
|
33
|
-
doSearch()
|
|
33
|
+
doSearch(true)
|
|
34
34
|
}
|
|
35
35
|
})
|
|
36
36
|
|
|
@@ -52,7 +52,13 @@ const facetTabs = computed(() => {
|
|
|
52
52
|
return tabs
|
|
53
53
|
})
|
|
54
54
|
|
|
55
|
-
async function
|
|
55
|
+
async function refreshFacets() {
|
|
56
|
+
if (!searchInput.value || searchInput.value.length < 2) return
|
|
57
|
+
const fetcher = fetchSearchGrid(t, undefined, client)
|
|
58
|
+
await fetcher({ page: 1, per_page: 1, search: searchInput.value })
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async function doSearch(updateFacets = false) {
|
|
56
62
|
if (!searchInput.value || searchInput.value.length < 2) {
|
|
57
63
|
results.value = []
|
|
58
64
|
meta.value = null
|
|
@@ -62,6 +68,11 @@ async function doSearch() {
|
|
|
62
68
|
loading.value = true
|
|
63
69
|
try {
|
|
64
70
|
const activeModule = moduleFilter.value === ALL_MODULES ? undefined : moduleFilter.value
|
|
71
|
+
|
|
72
|
+
if (updateFacets && activeModule) {
|
|
73
|
+
await refreshFacets()
|
|
74
|
+
}
|
|
75
|
+
|
|
65
76
|
const fetcher = fetchSearchGrid(t, activeModule, client)
|
|
66
77
|
const response: PaginatedResponse<SearchGridRow> = await fetcher({
|
|
67
78
|
page: page.value,
|
|
@@ -80,7 +91,7 @@ async function doSearch() {
|
|
|
80
91
|
|
|
81
92
|
watchDebounced(searchInput, () => {
|
|
82
93
|
page.value = 1
|
|
83
|
-
doSearch()
|
|
94
|
+
doSearch(true)
|
|
84
95
|
router.replace({ query: { ...route.query, search: searchInput.value || undefined } })
|
|
85
96
|
}, { debounce: 300 })
|
|
86
97
|
|
|
@@ -133,7 +144,7 @@ async function handleCardAction(key: string, id: number | string | null, meta: R
|
|
|
133
144
|
}
|
|
134
145
|
|
|
135
146
|
onMounted(() => {
|
|
136
|
-
if (searchInput.value) doSearch()
|
|
147
|
+
if (searchInput.value) doSearch(true)
|
|
137
148
|
})
|
|
138
149
|
</script>
|
|
139
150
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@motor-cms/ui-admin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./nuxt.config.ts",
|
|
6
6
|
"files": [
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@vueuse/core": "^14.0.0",
|
|
18
18
|
"sortablejs": "^1.15.0",
|
|
19
19
|
"zod": "^4.0.0",
|
|
20
|
-
"@motor-cms/ui-core": "1.
|
|
20
|
+
"@motor-cms/ui-core": "1.2.0"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"nuxt": "^4.0.0",
|