@paris-ias/list 1.0.136 → 1.0.138

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.
Files changed (78) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/actions/DenseItem.vue +64 -0
  3. package/dist/runtime/components/actions/ExpandedItem.vue +17 -10
  4. package/dist/runtime/components/actions/RowsItem.vue +57 -7
  5. package/dist/runtime/components/actions/View.vue +5 -17
  6. package/dist/runtime/components/affiliation/DenseItem.vue +26 -6
  7. package/dist/runtime/components/affiliation/ExpandedItem.vue +4 -0
  8. package/dist/runtime/components/affiliation/RowsItem.vue +27 -7
  9. package/dist/runtime/components/affiliation/View.vue +4 -4
  10. package/dist/runtime/components/apps/DenseItem.vue +26 -6
  11. package/dist/runtime/components/apps/ExpandedItem.vue +5 -1
  12. package/dist/runtime/components/apps/RowsItem.vue +27 -7
  13. package/dist/runtime/components/apps/View.vue +4 -4
  14. package/dist/runtime/components/disciplines/DenseItem.vue +26 -6
  15. package/dist/runtime/components/disciplines/ExpandedItem.vue +4 -0
  16. package/dist/runtime/components/disciplines/RowsItem.vue +27 -7
  17. package/dist/runtime/components/disciplines/View.vue +4 -4
  18. package/dist/runtime/components/events/Badges.vue +8 -12
  19. package/dist/runtime/components/events/DenseItem.vue +26 -16
  20. package/dist/runtime/components/events/ExpandedItem.vue +4 -0
  21. package/dist/runtime/components/events/RelatedItem.vue +4 -13
  22. package/dist/runtime/components/events/RowsItem.vue +20 -20
  23. package/dist/runtime/components/events/SlidingItem.vue +39 -47
  24. package/dist/runtime/components/events/View.vue +1 -1
  25. package/dist/runtime/components/fellowships/Badges.vue +15 -11
  26. package/dist/runtime/components/fellowships/DenseItem.vue +22 -11
  27. package/dist/runtime/components/fellowships/ExpandedItem.vue +8 -1
  28. package/dist/runtime/components/fellowships/RowsItem.vue +22 -15
  29. package/dist/runtime/components/fellowships/View.vue +2 -2
  30. package/dist/runtime/components/files/DenseItem.vue +26 -6
  31. package/dist/runtime/components/files/ExpandedItem.vue +4 -0
  32. package/dist/runtime/components/files/RowsItem.vue +27 -7
  33. package/dist/runtime/components/files/View.vue +4 -4
  34. package/dist/runtime/components/list/atoms/FiltersMenu.vue +9 -0
  35. package/dist/runtime/components/list/atoms/PerPage.vue +3 -2
  36. package/dist/runtime/components/list/atoms/ResetButton.vue +5 -1
  37. package/dist/runtime/components/list/atoms/SearchInput.vue +15 -2
  38. package/dist/runtime/components/list/atoms/SearchString.vue +169 -133
  39. package/dist/runtime/components/list/atoms/SortMenu.vue +22 -18
  40. package/dist/runtime/components/list/atoms/ViewMenu.vue +26 -14
  41. package/dist/runtime/components/list/molecules/Filters.vue +8 -8
  42. package/dist/runtime/components/list/molecules/Header.vue +10 -19
  43. package/dist/runtime/components/list/molecules/Pagination.vue +51 -48
  44. package/dist/runtime/components/list/organisms/List.vue +104 -69
  45. package/dist/runtime/components/mailing/DenseItem.vue +4 -0
  46. package/dist/runtime/components/mailing/ExpandedItem.vue +4 -0
  47. package/dist/runtime/components/mailing/RowsItem.vue +27 -7
  48. package/dist/runtime/components/mailing/View.vue +4 -4
  49. package/dist/runtime/components/misc/atoms/ImageContainer.vue +3 -45
  50. package/dist/runtime/components/misc/molecules/Related.vue +1 -1
  51. package/dist/runtime/components/news/DenseItem.vue +63 -54
  52. package/dist/runtime/components/news/ExpandedItem.vue +11 -17
  53. package/dist/runtime/components/news/RelatedItem.vue +4 -13
  54. package/dist/runtime/components/news/RowsItem.vue +21 -42
  55. package/dist/runtime/components/news/View.vue +7 -7
  56. package/dist/runtime/components/people/DenseItem.vue +16 -20
  57. package/dist/runtime/components/people/RelatedItem.vue +4 -14
  58. package/dist/runtime/components/people/RowsItem.vue +14 -23
  59. package/dist/runtime/components/projects/DenseItem.vue +17 -17
  60. package/dist/runtime/components/projects/RelatedItem.vue +4 -13
  61. package/dist/runtime/components/projects/RowsItem.vue +16 -16
  62. package/dist/runtime/components/projects/View.vue +6 -6
  63. package/dist/runtime/components/publications/DenseItem.vue +17 -15
  64. package/dist/runtime/components/publications/RelatedItem.vue +4 -13
  65. package/dist/runtime/components/publications/RowsItem.vue +18 -18
  66. package/dist/runtime/components/tags/DenseItem.vue +4 -0
  67. package/dist/runtime/components/tags/ExpandedItem.vue +4 -0
  68. package/dist/runtime/components/tags/RowsItem.vue +24 -7
  69. package/dist/runtime/components/tags/View.vue +4 -4
  70. package/dist/runtime/components/users/DenseItem.vue +24 -6
  71. package/dist/runtime/components/users/ExpandedItem.vue +5 -1
  72. package/dist/runtime/components/users/RowsItem.vue +25 -7
  73. package/dist/runtime/components/users/View.vue +4 -4
  74. package/dist/runtime/composables/useUtils.js +1 -1
  75. package/dist/runtime/plugins/pinia.js +5 -2
  76. package/dist/runtime/stores/root.d.ts +10 -9
  77. package/dist/runtime/stores/root.js +83 -119
  78. package/package.json +3 -4
@@ -12,6 +12,8 @@
12
12
  v-bind="tooltip"
13
13
  prepend-icon="mdi-tune-variant"
14
14
  :append-icon="open ? 'mdi-chevron-down' : 'mdi-chevron-up'"
15
+ :loading="$stores[type] && $stores[type].loading"
16
+ :disabled="$stores[type] && $stores[type].loading"
15
17
  @click="$emit('open', !open)"
16
18
  >
17
19
  <!-- <v-icon>mdi-tune-variant</v-icon> -->
@@ -26,6 +28,8 @@
26
28
 
27
29
  <script setup>
28
30
  import { useDisplay } from "vuetify"
31
+ import { useNuxtApp } from "#imports"
32
+ const { $stores } = useNuxtApp()
29
33
  const {
30
34
  name: nameDisplay,
31
35
  xs: isXsDisplay,
@@ -40,6 +44,11 @@ const props = defineProps({
40
44
  required: false,
41
45
  default: false,
42
46
  },
47
+ type: {
48
+ type: String,
49
+ required: false,
50
+ default: "",
51
+ },
43
52
  })
44
53
  </script>
45
54
 
@@ -1,12 +1,13 @@
1
1
  <template>
2
2
  <v-select
3
+ :id="'per-page-select' + type"
3
4
  v-model="itemsPerPage"
4
5
  class="perPageSelect"
5
- density="compact"
6
6
  variant="outlined"
7
7
  :items="itemsPerPageArray"
8
8
  hide-details
9
- :loading="$rootStore.loading"
9
+ density="compact"
10
+ :loading="$stores[type] && $stores[type].loading"
10
11
  @update:model-value="
11
12
  $rootStore.updateItemsPerPage({
12
13
  value: $event,
@@ -9,7 +9,7 @@
9
9
  icon
10
10
  class="ml-auto"
11
11
  v-bind="tooltip"
12
- @click="rootStore.resetState(props.type, locale)"
12
+ @click="resetState(props.type)"
13
13
  >
14
14
  <v-icon>mdi-restore</v-icon>
15
15
  </v-btn>
@@ -30,5 +30,9 @@ const props = defineProps({
30
30
  required: true,
31
31
  },
32
32
  })
33
+ const resetState = (type) => {
34
+ rootStore.resetState(type, locale.value)
35
+ rootStore.updateRouteQuery(type)
36
+ }
33
37
  </script>
34
38
  <style lang="scss"></style>
@@ -2,6 +2,7 @@
2
2
  <div class="d-flex flex-grow-1 flex-column">
3
3
  <v-text-field
4
4
  v-model.trim="search"
5
+ :id="inputId"
5
6
  :placeholder="$t('list.search-type', [$t('items.' + type, 2)])"
6
7
  :append-icon="type === 'all' ? 'mdi-magnify' : ''"
7
8
  prepend-inner-icon="mdi-magnify"
@@ -12,7 +13,7 @@
12
13
  clearable
13
14
  tile
14
15
  type="search"
15
- :loading="rootStore.loading"
16
+ :loading="isLoading"
16
17
  >
17
18
  <!-- :loading="$nuxt.loading || $store.state.loading" :class="{ 'mt-3':
18
19
  $store.state.scrolled }" -->
@@ -46,14 +47,20 @@ const props = defineProps({
46
47
  type: Boolean,
47
48
  default: false,
48
49
  },
50
+ id: {
51
+ type: String,
52
+ required: false,
53
+ default: "",
54
+ },
49
55
  })
56
+ const inputId = computed(() => props.id || `search-input-${props.type}`)
50
57
  const search = computed({
51
58
  get() {
52
59
  return props.type === "all"
53
60
  ? rootStore.search
54
61
  : $stores[props.type]?.search || ""
55
62
  },
56
- set: await useDebounceFn(async function (v) {
63
+ set: useDebounceFn(async (v) => {
57
64
  await rootStore.updateSearch({
58
65
  type: props.type,
59
66
  search: v || "",
@@ -61,6 +68,12 @@ const search = computed({
61
68
  })
62
69
  }, 300),
63
70
  })
71
+
72
+ const isLoading = computed(() =>
73
+ props.type === "all"
74
+ ? rootStore.loading
75
+ : Boolean($stores[props.type]?.loading),
76
+ )
64
77
  </script>
65
78
 
66
79
  <style lang="scss" scoped></style>
@@ -1,154 +1,161 @@
1
1
  <template>
2
2
  <div class="mt-4 font-weight-light">
3
- <template
4
- v-if="
5
- (!$stores[type].search || $stores[type].search.length === 0) &&
6
- $stores[type].filtersCount === 0
7
- "
8
- >
9
- {{
10
- feminine
11
- ? $t(
12
- "list.0-items-found-f",
13
- [
14
- $stores[type].total,
15
- $t("items." + props.type, $stores[type].total),
16
- ],
17
- $stores[type].total,
18
- )
19
- : $t(
20
- "list.0-items-found",
21
- [
22
- $stores[type].total,
23
- $t("items." + props.type, $stores[type].total),
24
- ],
25
- $stores[type].total,
26
- )
27
- }}
28
- </template>
29
- <!-- searching for "XXX" -->
30
- <template
31
- v-else-if="
32
- !(!$stores[type].search || $stores[type].search.length === 0) &&
33
- $stores[type].filtersCount === 0
34
- "
35
- >
36
- {{
37
- feminine
38
- ? $t(
39
- "list.0-items-found-searching-for-f",
40
- [
41
- $stores[type].total,
42
- $t(
43
- "items." + props.type,
3
+ <ClientOnly v-if="showSkeleton">
4
+ <v-skeleton-loader :type="isSmAndDown ? 'text@2' : 'text'" />
5
+ </ClientOnly>
6
+ <template v-else>
7
+ <template
8
+ v-if="
9
+ (!$stores[type].search || $stores[type].search.length === 0) &&
10
+ $stores[type].filtersCount === 0
11
+ "
12
+ >
13
+ {{
14
+ feminine
15
+ ? $t(
16
+ "list.0-items-found-f",
17
+ [
44
18
  $stores[type].total,
19
+ $t("items." + props.type, $stores[type].total),
20
+ ],
21
+ $stores[type].total,
22
+ )
23
+ : $t(
24
+ "list.0-items-found",
25
+ [
45
26
  $stores[type].total,
46
- ),
47
- $stores[type].search,
48
- ],
49
- $stores[type].total,
50
- )
51
- : $t(
52
- "list.0-items-found-searching-for",
53
- [
27
+ $t("items." + props.type, $stores[type].total),
28
+ ],
54
29
  $stores[type].total,
55
- $t(
56
- "items." + props.type,
30
+ )
31
+ }}
32
+ </template>
33
+ <!-- searching for "XXX" -->
34
+ <template
35
+ v-else-if="
36
+ !(!$stores[type].search || $stores[type].search.length === 0) &&
37
+ $stores[type].filtersCount === 0
38
+ "
39
+ >
40
+ {{
41
+ feminine
42
+ ? $t(
43
+ "list.0-items-found-searching-for-f",
44
+ [
57
45
  $stores[type].total,
46
+ $t(
47
+ "items." + props.type,
48
+ $stores[type].total,
49
+ $stores[type].total,
50
+ ),
51
+ $stores[type].search,
52
+ ],
53
+ $stores[type].total,
54
+ )
55
+ : $t(
56
+ "list.0-items-found-searching-for",
57
+ [
58
58
  $stores[type].total,
59
- ),
60
- $stores[type].search,
61
- ],
62
- $stores[type].total,
63
- )
64
- }}
65
- </template>
66
- <!-- with X filters -->
67
- <template
68
- v-else-if="
69
- (!$stores[type].search || $stores[type].search.length === 0) &&
70
- $stores[type].filtersCount > 0
71
- "
72
- >
73
- {{
74
- feminine
75
- ? $t(
76
- "list.0-items-found-with-1-filter-f",
77
- [
59
+ $t(
60
+ "items." + props.type,
61
+ $stores[type].total,
62
+ $stores[type].total,
63
+ ),
64
+ $stores[type].search,
65
+ ],
78
66
  $stores[type].total,
79
- $t(
80
- "items." + props.type,
67
+ )
68
+ }}
69
+ </template>
70
+ <!-- with X filters -->
71
+ <template
72
+ v-else-if="
73
+ (!$stores[type].search || $stores[type].search.length === 0) &&
74
+ $stores[type].filtersCount > 0
75
+ "
76
+ >
77
+ {{
78
+ feminine
79
+ ? $t(
80
+ "list.0-items-found-with-1-filter-f",
81
+ [
81
82
  $stores[type].total,
83
+ $t(
84
+ "items." + props.type,
85
+ $stores[type].total,
86
+ $stores[type].total,
87
+ ),
88
+ $stores[type].filtersCount,
89
+ $t("filters", $stores[type].filtersCount),
90
+ ],
91
+ $stores[type].total,
92
+ )
93
+ : $t(
94
+ "list.0-items-found-with-1-filter",
95
+ [
82
96
  $stores[type].total,
83
- ),
84
- $stores[type].filtersCount,
85
- $t("filters", $stores[type].filtersCount),
86
- ],
87
- $stores[type].total,
88
- )
89
- : $t(
90
- "list.0-items-found-with-1-filter",
91
- [
97
+ $t("items." + type, $stores[type].total, $stores[type].total),
98
+ $stores[type].filtersCount,
99
+ $t("filters", $stores[type].filtersCount),
100
+ ],
92
101
  $stores[type].total,
93
- $t("items." + type, $stores[type].total, $stores[type].total),
94
- $stores[type].filtersCount,
95
- $t("filters", $stores[type].filtersCount),
96
- ],
97
- $stores[type].total,
98
- )
99
- }}
100
- </template>
101
- <!-- searching for "XXX" with Y filters -->
102
- <template
103
- v-else-if="
104
- $stores[type].search &&
105
- $stores[type].search.length &&
106
- $stores[type].filtersCount > 0
107
- "
108
- >
109
- {{
110
- feminine
111
- ? $t(
112
- "list.0-items-found-searching-for-with-1-filter-f",
113
- [
102
+ )
103
+ }}
104
+ </template>
105
+ <!-- searching for "XXX" with Y filters -->
106
+ <template
107
+ v-else-if="
108
+ $stores[type].search &&
109
+ $stores[type].search.length &&
110
+ $stores[type].filtersCount > 0
111
+ "
112
+ >
113
+ {{
114
+ feminine
115
+ ? $t(
116
+ "list.0-items-found-searching-for-with-1-filter-f",
117
+ [
118
+ $stores[type].total,
119
+ $t("items." + type, $stores[type].total),
120
+ $stores[type].search,
121
+ $stores[type].filtersCount,
122
+ $t("filters", $stores[type].filtersCount),
123
+ ],
114
124
  $stores[type].total,
115
- $t("items." + type, $stores[type].total),
116
- $stores[type].search,
117
- $stores[type].filtersCount,
118
- $t("filters", $stores[type].filtersCount),
119
- ],
120
- $stores[type].total,
121
- )
122
- : $t(
123
- "list.0-items-found-searching-for-with-1-filter",
124
- [
125
+ )
126
+ : $t(
127
+ "list.0-items-found-searching-for-with-1-filter",
128
+ [
129
+ $stores[type].total,
130
+ $t("items." + type, $stores[type].total),
131
+ $stores[type].search,
132
+ $stores[type].filtersCount,
133
+ $t("filters", $stores[type].filtersCount),
134
+ ],
125
135
  $stores[type].total,
126
- $t("items." + type, $stores[type].total),
127
- $stores[type].search,
128
- $stores[type].filtersCount,
129
- $t("filters", $stores[type].filtersCount),
130
- ],
131
- $stores[type].total,
132
- )
133
- }}
136
+ )
137
+ }}
138
+ </template>
139
+ <template v-if="$stores[type].numberOfPages > 1">
140
+ <!-- // Page X of Y -->
141
+ {{
142
+ $t("list.page-0-of-1", [
143
+ $stores[type].page || 1,
144
+ $stores[type].numberOfPages || 1,
145
+ ])
146
+ }}
147
+ </template>
148
+ <!-- X items per page -->
149
+ <!-- displayed by X -->
150
+ <!-- and sorted by X -->
134
151
  </template>
135
- <template v-if="$stores[type].numberOfPages > 1">
136
- <!-- // Page X of Y -->
137
- {{
138
- $t("list.page-0-of-1", [
139
- $stores[type].page || 1,
140
- $stores[type].numberOfPages || 1,
141
- ])
142
- }}
143
- </template>
144
- <!-- X items per page -->
145
- <!-- displayed by X -->
146
- <!-- and sorted by X -->
147
152
  </div>
148
153
  </template>
149
154
 
150
155
  <script setup>
151
- import { useNuxtApp, ref } from "#imports"
156
+ import { useNuxtApp, ref, computed } from "#imports"
157
+ import { useDisplay } from "vuetify"
158
+ import { useRootStore } from "../../../stores/root"
152
159
 
153
160
  const { $stores } = useNuxtApp()
154
161
  const props = defineProps({
@@ -158,6 +165,35 @@ const props = defineProps({
158
165
  },
159
166
  })
160
167
  const feminine = ref(["news", "publications", "people"].includes(props.type))
168
+ const { smAndDown: isSmAndDown } = useDisplay()
169
+ const rootStore = useRootStore()
170
+
171
+ const isLoading = computed(() =>
172
+ Boolean($stores[props.type] && $stores[props.type].loading),
173
+ )
174
+ const isTypeSearchActive = computed(() => {
175
+ const s = $stores[props.type]?.search
176
+ return Boolean(s && s.length)
177
+ })
178
+ const isGlobalSearchActive = computed(
179
+ () => typeof rootStore.search === "string" && rootStore.search.length > 0,
180
+ )
181
+ const isAnySearchActive = computed(
182
+ () => isTypeSearchActive.value || isGlobalSearchActive.value,
183
+ )
184
+ const isZeroTotal = computed(
185
+ () => Number($stores[props.type]?.total || 0) === 0,
186
+ )
187
+ const itemsCount = computed(() =>
188
+ Array.isArray($stores[props.type]?.items)
189
+ ? $stores[props.type]?.items?.length || 0
190
+ : 0,
191
+ )
192
+ const showSkeleton = computed(
193
+ () =>
194
+ isLoading.value ||
195
+ (isZeroTotal.value && (isAnySearchActive.value || itemsCount.value > 0)),
196
+ )
161
197
  </script>
162
198
 
163
199
  <style lang="scss" scoped></style>
@@ -1,35 +1,39 @@
1
1
  <template>
2
- <v-menu>
2
+ <v-menu :disabled="$stores[type].loading">
3
3
  <template #activator="{ props: menu }">
4
4
  <v-tooltip location="top">
5
5
  <template #activator="{ props: tooltip }">
6
- <v-btn
7
- x-large
8
- outlined
9
- tile
10
- flat
11
- icon
12
- :class="{
13
- 'mt-3': isXsDisplay,
14
- }"
15
- v-bind="mergeProps(menu, tooltip)"
16
- >
17
- <v-icon>mdi-{{ current?.icon || defaultSort?.icon }}</v-icon>
18
- </v-btn>
6
+ <template v-if="$stores[type].loading">
7
+ <v-skeleton-loader type="button" :class="{ 'mt-3': isXsDisplay }" />
8
+ </template>
9
+ <template v-else>
10
+ <v-btn
11
+ x-large
12
+ outlined
13
+ tile
14
+ flat
15
+ icon
16
+ :class="{ 'mt-3': isXsDisplay }"
17
+ v-bind="mergeProps(menu, tooltip)"
18
+ >
19
+ <v-icon>mdi-{{ current?.icon || defaultSort?.icon }}</v-icon>
20
+ </v-btn>
21
+ </template>
19
22
  </template>
20
23
  <div
21
24
  v-html="
22
25
  $t('list.sort-mode') +
23
- $t('list.' + current.text || defaultSort.text)
26
+ $t('list.' + (current?.text || defaultSort?.text))
24
27
  "
25
28
  />
26
29
  </v-tooltip>
27
30
  </template>
28
31
  <v-list density="compact">
29
- <template v-for="(item, index) in items">
32
+ <template v-for="(item, index) in $stores[props.type].sort">
30
33
  <v-list-item
31
34
  v-if="item.text !== current.text"
32
35
  :key="index"
36
+ :disabled="$stores[type].loading"
33
37
  @click="updateSort(item.value)"
34
38
  >
35
39
  <template #prepend>
@@ -59,7 +63,7 @@ const props = defineProps({
59
63
  required: true,
60
64
  },
61
65
  })
62
- const items = ref($stores[props.type].sort)
66
+ const items = ref()
63
67
  const defaultSort = ref(
64
68
  $stores[props.type].sort[
65
69
  Object.keys($stores[props.type].sort).find(
@@ -87,7 +91,7 @@ const current = computed(() => {
87
91
  })
88
92
 
89
93
  const updateSort = async (value) => {
90
- await rootStore.updateSort({ value, type: props.type, lang: locale.value })
94
+ rootStore.updateSort({ value, type: props.type, lang: locale.value })
91
95
  }
92
96
  </script>
93
97
 
@@ -1,23 +1,26 @@
1
1
  <template>
2
- <v-menu>
2
+ <v-menu :disabled="$stores[type].loading">
3
3
  <template #activator="{ props: menu }">
4
4
  <v-tooltip location="top">
5
5
  <template #activator="{ props: tooltip }">
6
- <v-btn
7
- x-large
8
- tile
9
- flat
10
- :icon="'mdi-' + current?.icon || defaultView?.icon"
11
- :class="{
12
- 'mt-3': isXsDisplay,
13
- }"
14
- v-bind="mergeProps(menu, tooltip)"
15
- />
6
+ <template v-if="$stores[type].loading">
7
+ <v-skeleton-loader type="button" :class="{ 'mt-3': isXsDisplay }" />
8
+ </template>
9
+ <template v-else>
10
+ <v-btn
11
+ x-large
12
+ tile
13
+ flat
14
+ :icon="'mdi-' + (current?.icon || defaultView?.icon)"
15
+ :class="{ 'mt-3': isXsDisplay }"
16
+ v-bind="mergeProps(menu, tooltip)"
17
+ />
18
+ </template>
16
19
  </template>
17
20
  <div
18
21
  v-html="
19
22
  $t('list.view-mode') +
20
- $t('list.' + current.name || defaultView.name)
23
+ $t('list.' + (current?.name || defaultView?.name))
21
24
  "
22
25
  />
23
26
  </v-tooltip>
@@ -26,6 +29,7 @@
26
29
  <v-list-item
27
30
  v-for="(value, key, index) in items"
28
31
  :key="index"
32
+ :disabled="$stores[type].loading"
29
33
  @click="updateView(value.name || key)"
30
34
  >
31
35
  <template #prepend>
@@ -43,7 +47,7 @@
43
47
  import { mergeProps } from "vue"
44
48
  import { useDisplay } from "vuetify"
45
49
  import { useRootStore } from "../../../stores/root"
46
- import { useNuxtApp, ref, useI18n } from "#imports"
50
+ import { useNuxtApp, ref, useI18n, computed } from "#imports"
47
51
  const { locale } = useI18n()
48
52
  const { $stores } = useNuxtApp()
49
53
 
@@ -61,8 +65,16 @@ const items = ref($stores[props.type].views)
61
65
 
62
66
  const current = ref($stores[props.type].view)
63
67
 
68
+ const defaultView = ref(
69
+ $stores[props.type].views[
70
+ Object.keys($stores[props.type].views).find(
71
+ (k) => $stores[props.type].views[k]?.default === true,
72
+ )
73
+ ] || { name: "list", icon: "view-list" },
74
+ )
75
+
64
76
  const updateView = async (value) => {
65
- await rootStore.updateView({ value, type: props.type, lang: locale.value })
77
+ rootStore.updateView({ value, type: props.type, lang: locale.value })
66
78
  }
67
79
  </script>
68
80
 
@@ -1,15 +1,16 @@
1
1
  <template>
2
2
  <v-row>
3
- <template v-for="filterItem in Object.keys($stores[type].filters)">
3
+ <template v-for="(filterItem, index) in Object.keys($stores[type].filters)">
4
4
  <v-col
5
5
  v-if="computeVisibility(filterItem)"
6
- :key="type + filterItem"
6
+ :key="type + index + filterItem"
7
7
  cols="12"
8
8
  sm="6"
9
9
  md="4"
10
10
  >
11
11
  <component
12
12
  :is="ComponentName(filterItem)"
13
+ :id="type + index + filterItem"
13
14
  tile
14
15
  :name="filterItem"
15
16
  hide-details
@@ -44,7 +45,7 @@ const props = defineProps(["type", "expanded"])
44
45
 
45
46
  const ComponentName = (name) => {
46
47
  return resolveComponent(
47
- "ListInputs" + capitalize($stores[props.type].filters[name].type)
48
+ "ListInputs" + capitalize($stores[props.type].filters[name].type),
48
49
  )
49
50
  }
50
51
  const getItems = (name) => {
@@ -53,14 +54,13 @@ const getItems = (name) => {
53
54
  }
54
55
 
55
56
  if ($filters?.[props.type]?.[name]) {
56
- console.log("filters found for ", name, $filters[props.type][name])
57
57
  return $filters[props.type][name]
58
58
  .filter((key) => key !== "label")
59
59
  .map((item) => ({
60
60
  title: i18n.t(
61
61
  props.type === "people" && name === "vintage"
62
62
  ? item
63
- : `list.filters.${props.type}.${name}.${item}`
63
+ : `list.filters.${props.type}.${name}.${item}`,
64
64
  ),
65
65
  value: item,
66
66
  }))
@@ -68,12 +68,12 @@ const getItems = (name) => {
68
68
  if (
69
69
  messages.value[locale.value].list.filters[props.type][name] === undefined
70
70
  ) {
71
- console.log("name not found, no item for this filmter: ", name)
71
+ console.log("name not found, no item for this filter: ", name)
72
72
  return []
73
73
  }
74
74
  // TODO replace with package based values
75
75
  return Object.keys(
76
- messages.value[locale.value].list.filters[props.type][name]
76
+ messages.value[locale.value].list.filters[props.type][name],
77
77
  )
78
78
  .filter((key) => key !== "label")
79
79
  .map((item) => ({
@@ -97,7 +97,7 @@ const computeVisibility = (filterItem) => {
97
97
  $stores[props.type].filters[value]?.value.includes(rule[value])
98
98
  : $stores[props.type].filters[value]?.value === rule[value]
99
99
  })
100
- }
100
+ },
101
101
  )
102
102
  )
103
103
  }