@paris-ias/list 1.0.10 → 1.0.13

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 (89) hide show
  1. package/README.md +71 -51
  2. package/dist/module.d.mts +8 -0
  3. package/dist/module.json +9 -0
  4. package/dist/module.mjs +64 -0
  5. package/dist/runtime/components/events/Badges.vue +5 -7
  6. package/dist/runtime/components/events/DateTimePlace.vue +11 -13
  7. package/dist/runtime/components/events/DenseItem.vue +7 -6
  8. package/dist/runtime/components/events/ExpandedItem.vue +3 -5
  9. package/dist/runtime/components/events/ListContainer.vue +6 -6
  10. package/dist/runtime/components/events/RegisterModal.vue +4 -5
  11. package/dist/runtime/components/events/RelatedItem.vue +6 -7
  12. package/dist/runtime/components/events/RowsItem.vue +12 -11
  13. package/dist/runtime/components/events/View.vue +10 -13
  14. package/dist/runtime/components/fellowships/Badges.vue +12 -15
  15. package/dist/runtime/components/fellowships/DenseItem.vue +7 -7
  16. package/dist/runtime/components/fellowships/RegisterModal.vue +3 -2
  17. package/dist/runtime/components/fellowships/RowsItem.vue +19 -21
  18. package/dist/runtime/components/fellowships/View.vue +43 -49
  19. package/dist/runtime/components/list/atoms/FiltersMenu.vue +6 -8
  20. package/dist/runtime/components/list/atoms/SearchInput.vue +42 -50
  21. package/dist/runtime/components/list/atoms/SearchItem.vue +14 -14
  22. package/dist/runtime/components/list/atoms/SearchString.vue +6 -7
  23. package/dist/runtime/components/list/atoms/SortMenu.vue +23 -40
  24. package/dist/runtime/components/list/atoms/ViewMenu.vue +14 -22
  25. package/dist/runtime/components/list/inputs/AutoComplete.vue +9 -9
  26. package/dist/runtime/components/list/inputs/BooleanSwitch.vue +9 -9
  27. package/dist/runtime/components/list/inputs/Checkbox.vue +11 -11
  28. package/dist/runtime/components/list/inputs/Select.vue +11 -11
  29. package/dist/runtime/components/list/molecules/Filters.vue +27 -42
  30. package/dist/runtime/components/list/molecules/Header.vue +5 -7
  31. package/dist/runtime/components/list/molecules/Pagination.vue +60 -102
  32. package/dist/runtime/components/list/organisms/List.vue +28 -36
  33. package/dist/runtime/components/list/views/Dense.vue +1 -14
  34. package/dist/runtime/components/list/views/Grid.vue +3 -3
  35. package/dist/runtime/components/list/views/Rows.vue +3 -3
  36. package/dist/runtime/components/list/views/Table.vue +3 -3
  37. package/dist/runtime/components/misc/atoms/CountUp.vue +89 -144
  38. package/dist/runtime/components/misc/atoms/DateStamp.vue +42 -46
  39. package/dist/runtime/components/misc/atoms/ImageContainer.vue +14 -22
  40. package/dist/runtime/components/misc/atoms/ShareMenu.vue +9 -11
  41. package/dist/runtime/components/misc/atoms/Socials.vue +46 -52
  42. package/dist/runtime/components/misc/molecules/ChipContainer.vue +7 -11
  43. package/dist/runtime/components/misc/molecules/Related.vue +9 -11
  44. package/dist/runtime/components/misc/molecules/RelatedItems.vue +7 -9
  45. package/dist/runtime/components/misc/molecules/SearchItem.vue +2 -2
  46. package/dist/runtime/components/news/DenseItem.vue +15 -15
  47. package/dist/runtime/components/news/ExpandedItem.vue +40 -50
  48. package/dist/runtime/components/news/Header.vue +3 -5
  49. package/dist/runtime/components/news/RelatedItem.vue +6 -7
  50. package/dist/runtime/components/news/RowsItem.vue +14 -16
  51. package/dist/runtime/components/news/View.vue +9 -20
  52. package/dist/runtime/components/people/DenseItem.vue +9 -8
  53. package/dist/runtime/components/people/ExpandedItem.vue +4 -6
  54. package/dist/runtime/components/people/GroupBadges.vue +6 -8
  55. package/dist/runtime/components/people/RelatedItem.vue +6 -7
  56. package/dist/runtime/components/people/RowsItem.vue +12 -19
  57. package/dist/runtime/components/people/View.vue +7 -7
  58. package/dist/runtime/components/projects/ExpandedItem.vue +4 -6
  59. package/dist/runtime/components/projects/RelatedItem.vue +6 -7
  60. package/dist/runtime/components/projects/RowsItem.vue +21 -26
  61. package/dist/runtime/components/projects/View.vue +8 -8
  62. package/dist/runtime/components/publications/RelatedItem.vue +6 -7
  63. package/dist/runtime/components/publications/RowsItem.vue +20 -22
  64. package/dist/runtime/components/publications/View.vue +9 -15
  65. package/dist/runtime/composables/useFetchItem.d.ts +6 -0
  66. package/dist/runtime/composables/useFetchItem.js +49 -0
  67. package/dist/runtime/composables/useIcons.d.ts +1 -0
  68. package/dist/runtime/composables/useIcons.js +30 -0
  69. package/dist/runtime/composables/useUtils.d.ts +12 -0
  70. package/dist/runtime/composables/useUtils.js +47 -0
  71. package/dist/runtime/plugins/pinia.d.ts +2 -0
  72. package/dist/runtime/plugins/pinia.js +69 -0
  73. package/dist/runtime/plugins/vuetify.d.ts +2 -0
  74. package/dist/runtime/server/tsconfig.json +3 -0
  75. package/dist/runtime/stores/factory.d.ts +1 -0
  76. package/dist/runtime/stores/{factory.ts → factory.js} +9 -9
  77. package/dist/runtime/stores/root.d.ts +34 -0
  78. package/dist/runtime/stores/root.js +227 -0
  79. package/dist/types.d.mts +3 -0
  80. package/package.json +55 -26
  81. package/dist/runtime/composables/useFetchItem.ts +0 -64
  82. package/dist/runtime/composables/useIcons.ts +0 -30
  83. package/dist/runtime/composables/useUtils.ts +0 -75
  84. package/dist/runtime/plugins/pinia.ts +0 -88
  85. package/dist/runtime/stores/root.ts +0 -353
  86. package/example/.env.example +0 -3
  87. package/example/nuxt.config.ts +0 -19
  88. package/example/pages/index.vue +0 -27
  89. package/index.ts +0 -119
@@ -149,62 +149,56 @@
149
149
  </template>
150
150
 
151
151
  <script setup>
152
- import { useDisplay } from "vuetify"
153
-
154
- const { name } = useDisplay()
155
- const accordeon = ref(-1)
152
+ import { useDisplay } from "vuetify";
153
+ const { name } = useDisplay();
154
+ const accordeon = ref(-1);
156
155
  const props = defineProps({
157
156
  item: {
158
157
  type: Object,
159
- required: true,
158
+ required: true
160
159
  },
161
160
  loading: {
162
161
  type: Boolean,
163
162
  default: false,
164
- required: true,
165
- },
166
- })
167
-
168
- const view = ref(true)
163
+ required: true
164
+ }
165
+ });
166
+ const view = ref(true);
169
167
  onMounted(() => {
170
- /* console.log("fellowship item", props.item.value) */
171
- })
172
-
168
+ });
173
169
  const renderedDetails = {
174
- ...(props.item?.fellowshipDetails?.type && {
175
- type: props.item?.fellowshipDetails?.type,
176
- }),
177
- ...(props.item?.fellowshipDetails?.fundingPeriod && {
178
- fundingPeriod: props.item?.fellowshipDetails?.fundingPeriod,
179
- }),
180
- ...(props.item?.fellowshipDetails?.profile && {
181
- profile: props.item?.fellowshipDetails?.profile,
182
- }),
183
- ...(props.item?.fellowshipDetails?.tasks && {
184
- tasks: props.item?.fellowshipDetails?.tasks,
185
- }),
186
- ...(props.item?.fellowshipDetails?.location && {
187
- location: props.item?.fellowshipDetails?.location,
188
- }),
189
- ...(props.item?.fellowshipDetails?.funding && {
190
- funding: props.item?.fellowshipDetails?.funding,
191
- }),
192
- ...(props.item?.fellowshipDetails?.housing && {
193
- housing: props.item?.fellowshipDetails?.housing,
194
- }),
195
- ...(props.item?.fellowshipDetails?.meals && {
196
- meals: props.item?.fellowshipDetails?.meals,
197
- }),
198
- ...(props.item?.fellowshipDetails?.applicationMaterials && {
199
- applicationMaterials: props.item?.fellowshipDetails?.applicationMaterials,
200
- }),
201
- ...(props.item?.fellowshipDetails?.selectionProcess && {
202
- selectionProcess: props.item?.fellowshipDetails?.selectionProcess,
203
- }),
204
- ...(props.item?.fellowshipDetails?.researchProcess && {
205
- researchProcess: props.item?.fellowshipDetails?.researchProcess,
206
- }),
207
- }
170
+ ...props.item?.fellowshipDetails?.type && {
171
+ type: props.item?.fellowshipDetails?.type
172
+ },
173
+ ...props.item?.fellowshipDetails?.fundingPeriod && {
174
+ fundingPeriod: props.item?.fellowshipDetails?.fundingPeriod
175
+ },
176
+ ...props.item?.fellowshipDetails?.profile && {
177
+ profile: props.item?.fellowshipDetails?.profile
178
+ },
179
+ ...props.item?.fellowshipDetails?.tasks && {
180
+ tasks: props.item?.fellowshipDetails?.tasks
181
+ },
182
+ ...props.item?.fellowshipDetails?.location && {
183
+ location: props.item?.fellowshipDetails?.location
184
+ },
185
+ ...props.item?.fellowshipDetails?.funding && {
186
+ funding: props.item?.fellowshipDetails?.funding
187
+ },
188
+ ...props.item?.fellowshipDetails?.housing && {
189
+ housing: props.item?.fellowshipDetails?.housing
190
+ },
191
+ ...props.item?.fellowshipDetails?.meals && {
192
+ meals: props.item?.fellowshipDetails?.meals
193
+ },
194
+ ...props.item?.fellowshipDetails?.applicationMaterials && {
195
+ applicationMaterials: props.item?.fellowshipDetails?.applicationMaterials
196
+ },
197
+ ...props.item?.fellowshipDetails?.selectionProcess && {
198
+ selectionProcess: props.item?.fellowshipDetails?.selectionProcess
199
+ },
200
+ ...props.item?.fellowshipDetails?.researchProcess && {
201
+ researchProcess: props.item?.fellowshipDetails?.researchProcess
202
+ }
203
+ };
208
204
  </script>
209
-
210
- <style lang="scss" scoped></style>
@@ -25,22 +25,20 @@
25
25
  </template>
26
26
 
27
27
  <script setup>
28
- import { useDisplay } from "vuetify"
28
+ import { useDisplay } from "vuetify";
29
29
  const {
30
30
  name: nameDisplay,
31
31
  xs: isXsDisplay,
32
32
  mobile: isMobileDisplay,
33
33
  smAndUp,
34
34
  lgAndUp,
35
- smAndDown,
36
- } = useDisplay()
35
+ smAndDown
36
+ } = useDisplay();
37
37
  const props = defineProps({
38
38
  open: {
39
39
  type: Boolean,
40
40
  required: false,
41
- default: false,
42
- },
43
- })
41
+ default: false
42
+ }
43
+ });
44
44
  </script>
45
-
46
- <style lang="scss" scoped></style>
@@ -63,67 +63,59 @@
63
63
  </template>
64
64
 
65
65
  <script setup>
66
- import { useDebounceFn } from "@vueuse/core"
67
- import { useRootStore } from "../../../stores/root"
68
- const { locale, t } = useI18n()
69
- const rootStore = useRootStore()
70
- const { $stores } = useNuxtApp()
66
+ import { useDebounceFn } from "@vueuse/core";
67
+ import { useRootStore } from "../../../stores/root";
68
+ const { locale, t } = useI18n();
69
+ const rootStore = useRootStore();
70
+ const { $stores } = useNuxtApp();
71
71
  const props = defineProps({
72
72
  type: {
73
73
  type: String,
74
- required: true,
74
+ required: true
75
75
  },
76
76
  loading: {
77
77
  type: Boolean,
78
- default: false,
79
- },
80
- })
78
+ default: false
79
+ }
80
+ });
81
81
  const results = computed(() => {
82
- const storeRst = rootStore.results
83
- const rst =
84
- (Object.keys(storeRst).length &&
85
- Object.keys(storeRst)
86
- .sort((a, b) => {
87
- return storeRst[b]?.items?.length - storeRst[a]?.items?.length
88
- })
89
- .reduce((acc, key, index) => {
90
- const items = storeRst[key]?.items
91
- const total = storeRst[key]?.total
92
- if (total === 0 && index === 0) {
93
- acc.push({ type: "no-result" })
94
- return acc
95
- }
96
- if (items?.length) {
97
- acc.push({ type: "subheader", name: t("items." + key, 2) })
98
- acc.push(
99
- ...items.map((item) => ({
100
- prependAvatar: item?.image?.url || "mdi-square",
101
- title: item.name || item.firstname + " " + item.lastname,
102
- subtitle: item.summary || item.biography,
103
- id: item.id,
104
- type: key,
105
- }))
106
- )
107
- }
108
- acc.push({ type: "divider" })
109
- return acc
110
- }, [])) ||
111
- {}
112
-
113
- return rst
114
- })
82
+ const storeRst = rootStore.results;
83
+ const rst = Object.keys(storeRst).length && Object.keys(storeRst).sort((a, b) => {
84
+ return storeRst[b]?.items?.length - storeRst[a]?.items?.length;
85
+ }).reduce((acc, key, index) => {
86
+ const items = storeRst[key]?.items;
87
+ const total = storeRst[key]?.total;
88
+ if (total === 0 && index === 0) {
89
+ acc.push({ type: "no-result" });
90
+ return acc;
91
+ }
92
+ if (items?.length) {
93
+ acc.push({ type: "subheader", name: t("items." + key, 2) });
94
+ acc.push(
95
+ ...items.map((item) => ({
96
+ prependAvatar: item?.image?.url || "mdi-square",
97
+ title: item.name || item.firstname + " " + item.lastname,
98
+ subtitle: item.summary || item.biography,
99
+ id: item.id,
100
+ type: key
101
+ }))
102
+ );
103
+ }
104
+ acc.push({ type: "divider" });
105
+ return acc;
106
+ }, []) || {};
107
+ return rst;
108
+ });
115
109
  const search = computed({
116
110
  get() {
117
- return props.type === "all" ? rootStore.search : $stores[props.type].search
111
+ return props.type === "all" ? rootStore.search : $stores[props.type].search;
118
112
  },
119
- set: await useDebounceFn(async function (v) {
113
+ set: await useDebounceFn(async function(v) {
120
114
  await rootStore.updateSearch({
121
115
  type: props.type,
122
116
  search: v || "",
123
- lang: locale.value,
124
- })
125
- }, 300),
126
- })
117
+ lang: locale.value
118
+ });
119
+ }, 300)
120
+ });
127
121
  </script>
128
-
129
- <style lang="scss" scoped></style>
@@ -20,38 +20,38 @@
20
20
  </template>
21
21
  </v-list-item>
22
22
  </template>
23
+
23
24
  <script setup>
24
- // import { useDisplay } from "vuetify"
25
- // const { smAndUp } = useDisplay()
26
- const localePath = useLocalePath()
25
+ const localePath = useLocalePath();
27
26
  const props = defineProps({
28
27
  item: {
29
28
  type: Object,
30
- required: true,
29
+ required: true
31
30
  },
32
31
  type: {
33
32
  type: String,
34
- required: true,
33
+ required: true
35
34
  },
36
35
  index: {
37
36
  type: Number,
38
- required: true,
39
- },
40
- })
37
+ required: true
38
+ }
39
+ });
41
40
  const getPath = (id) => {
42
41
  switch (props.item.type) {
43
42
  case "projects":
44
- return "/activities/projects/" + id
43
+ return "/activities/projects/" + id;
45
44
  case "publications":
46
- return "/activities/publications/" + id
45
+ return "/activities/publications/" + id;
47
46
  case "fellowship":
48
- return "/activities/fellowships/" + id
47
+ return "/activities/fellowships/" + id;
49
48
  default:
50
- return `/${props.type}/${id}`
49
+ return `/${props.type}/${id}`;
51
50
  }
52
- }
51
+ };
53
52
  </script>
54
- <style lang="scss">
53
+
54
+ <style>
55
55
  .search-item {
56
56
  align-items: center;
57
57
  height: 100%;
@@ -147,15 +147,14 @@
147
147
  <!-- and sorted by X -->
148
148
  </div>
149
149
  </template>
150
+
150
151
  <script setup>
151
- const { $stores } = useNuxtApp()
152
+ const { $stores } = useNuxtApp();
152
153
  const props = defineProps({
153
154
  type: {
154
155
  type: String,
155
- required: true,
156
- },
157
- })
158
- const feminine = ref(["news", "publications", "people"].includes(props.type))
156
+ required: true
157
+ }
158
+ });
159
+ const feminine = ref(["news", "publications", "people"].includes(props.type));
159
160
  </script>
160
-
161
- <style lang="scss" scoped></style>
@@ -43,55 +43,38 @@
43
43
  </template>
44
44
 
45
45
  <script setup>
46
- import { useRootStore } from "../../../stores/root"
47
- import { mergeProps } from "vue"
48
- import { useDisplay } from "vuetify"
49
- const { $stores } = useNuxtApp()
50
- const { xs: isXsDisplay } = useDisplay()
51
-
52
- const rootStore = useRootStore()
53
-
46
+ import { useRootStore } from "../../../stores/root";
47
+ import { mergeProps } from "vue";
48
+ import { useDisplay } from "vuetify";
49
+ const { $stores } = useNuxtApp();
50
+ const { xs: isXsDisplay } = useDisplay();
51
+ const rootStore = useRootStore();
54
52
  const props = defineProps({
55
53
  type: {
56
54
  type: String,
57
55
  default: "articles",
58
- required: true,
59
- },
60
- })
61
- const items = ref($stores[props.type].sort)
56
+ required: true
57
+ }
58
+ });
59
+ const items = ref($stores[props.type].sort);
62
60
  const defaultSort = ref(
63
- $stores[props.type].sort[
64
- Object.keys($stores[props.type].sort).find(
65
- (item) => $stores[props.type].sort[item].default === true
66
- )
67
- ]
68
- )
69
-
61
+ $stores[props.type].sort[Object.keys($stores[props.type].sort).find(
62
+ (item) => $stores[props.type].sort[item].default === true
63
+ )]
64
+ );
70
65
  const current = computed(() => {
71
66
  try {
72
- return $stores[props.type].sort[
73
- Object.keys($stores[props.type].sort).find((item) => {
74
- return (
75
- $stores[props.type].sort[item].value[0] ===
76
- $stores[props.type].sortBy[0] &&
77
- $stores[props.type].sort[item].value[1] ===
78
- $stores[props.type].sortDesc[0]
79
- )
80
- })
81
- ]
67
+ return $stores[props.type].sort[Object.keys($stores[props.type].sort).find((item) => {
68
+ return $stores[props.type].sort[item].value[0] === $stores[props.type].sortBy[0] && $stores[props.type].sort[item].value[1] === $stores[props.type].sortDesc[0];
69
+ })];
82
70
  } catch (error) {
83
- console.log("error: ", error)
84
- return items[Object.keys(items).find((item) => item.default)]
71
+ console.log("error: ", error);
72
+ return items[Object.keys(items).find((item) => item.default)];
85
73
  }
86
- })
87
-
74
+ });
88
75
  const updateSort = async (value) => {
89
- await rootStore.updateSort({ value, type: props.type })
90
- }
91
-
76
+ await rootStore.updateSort({ value, type: props.type });
77
+ };
92
78
  onMounted(() => {
93
- // Add any logic needed on component mount
94
- })
79
+ });
95
80
  </script>
96
-
97
- <style lang="scss"></style>
@@ -40,32 +40,24 @@
40
40
  </template>
41
41
 
42
42
  <script setup>
43
- import { useRootStore } from "../../../stores/root"
44
- import { mergeProps } from "vue"
45
- import { useDisplay } from "vuetify"
46
- const { $stores } = useNuxtApp()
47
-
43
+ import { useRootStore } from "../../../stores/root";
44
+ import { mergeProps } from "vue";
45
+ import { useDisplay } from "vuetify";
46
+ const { $stores } = useNuxtApp();
48
47
  const props = defineProps({
49
48
  type: {
50
49
  type: String,
51
50
  default: "articles",
52
- required: true,
53
- },
54
- })
55
- const { xs: isXsDisplay } = useDisplay()
56
-
57
- const rootStore = useRootStore()
58
- const items = ref($stores[props.type].views)
59
-
60
- const current = ref($stores[props.type].view)
61
-
51
+ required: true
52
+ }
53
+ });
54
+ const { xs: isXsDisplay } = useDisplay();
55
+ const rootStore = useRootStore();
56
+ const items = ref($stores[props.type].views);
57
+ const current = ref($stores[props.type].view);
62
58
  const updateView = async (value) => {
63
- await rootStore.updateView({ value, type: props.type })
64
- }
65
-
59
+ await rootStore.updateView({ value, type: props.type });
60
+ };
66
61
  onMounted(() => {
67
- // Add any logic needed on component mount
68
- })
62
+ });
69
63
  </script>
70
-
71
- <style lang="scss"></style>
@@ -5,18 +5,18 @@
5
5
  :multiple="$stores[type].filters[name]?.multiple || false"
6
6
  />
7
7
  </template>
8
+
8
9
  <script setup>
9
- import { useRootStore } from "../../../stores/root"
10
- const rootStore = useRootStore()
11
- const { $stores } = useNuxtApp()
12
- const props = defineProps(["type", "items", "name"])
10
+ import { useRootStore } from "../../../stores/root";
11
+ const rootStore = useRootStore();
12
+ const { $stores } = useNuxtApp();
13
+ const props = defineProps(["type", "items", "name"]);
13
14
  const val = computed({
14
15
  get() {
15
- return $stores[props.type].filters[props.name]?.value || []
16
+ return $stores[props.type].filters[props.name]?.value || [];
16
17
  },
17
18
  set(value) {
18
- return rootStore.updateFilter(props.name, value, props.type)
19
- },
20
- })
19
+ return rootStore.updateFilter(props.name, value, props.type);
20
+ }
21
+ });
21
22
  </script>
22
- <style lang="scss"></style>
@@ -1,18 +1,18 @@
1
1
  <template>
2
2
  <v-switch v-model="val" />
3
3
  </template>
4
+
4
5
  <script setup>
5
- import { useRootStore } from "../../../stores/root"
6
- const rootStore = useRootStore()
7
- const props = defineProps(["type", "items", "name"])
8
- const { $stores } = useNuxtApp()
6
+ import { useRootStore } from "../../../stores/root";
7
+ const rootStore = useRootStore();
8
+ const props = defineProps(["type", "items", "name"]);
9
+ const { $stores } = useNuxtApp();
9
10
  const val = computed({
10
11
  get() {
11
- return $stores[props.type].filters[props.name]?.value
12
+ return $stores[props.type].filters[props.name]?.value;
12
13
  },
13
14
  set(value) {
14
- rootStore.updateFilter(props.name, value, props.type)
15
- },
16
- })
15
+ rootStore.updateFilter(props.name, value, props.type);
16
+ }
17
+ });
17
18
  </script>
18
- <style lang="scss"></style>
@@ -1,21 +1,21 @@
1
1
  <template>
2
2
  <v-checkbox v-model="val" />
3
3
  </template>
4
+
4
5
  <script setup>
5
- import { useRootStore } from "../../../stores/root"
6
- const rootStore = useRootStore()
7
- const props = defineProps(["type", "items", "name"])
8
- const { $stores } = useNuxtApp()
6
+ import { useRootStore } from "../../../stores/root";
7
+ const rootStore = useRootStore();
8
+ const props = defineProps(["type", "items", "name"]);
9
+ const { $stores } = useNuxtApp();
9
10
  const val = computed({
10
11
  get() {
11
- return $stores[props.type].filters[props.name]?.value
12
+ return $stores[props.type].filters[props.name]?.value;
12
13
  },
13
14
  set(value) {
14
- rootStore.updateFilter(props.name, value, props.type)
15
- },
16
- })
15
+ rootStore.updateFilter(props.name, value, props.type);
16
+ }
17
+ });
17
18
  onMounted(() => {
18
- console.log(props.data)
19
- })
19
+ console.log(props.data);
20
+ });
20
21
  </script>
21
- <style lang="scss"></style>
@@ -5,21 +5,21 @@
5
5
  :multiple="$stores[type].filters[name]?.multiple || false"
6
6
  />
7
7
  </template>
8
+
8
9
  <script setup>
9
- import { useRootStore } from "../../../stores/root"
10
- const rootStore = useRootStore()
11
- const { $stores } = useNuxtApp()
12
- const props = defineProps(["type", "items", "name"])
10
+ import { useRootStore } from "../../../stores/root";
11
+ const rootStore = useRootStore();
12
+ const { $stores } = useNuxtApp();
13
+ const props = defineProps(["type", "items", "name"]);
13
14
  const val = computed({
14
15
  get() {
15
- return $stores[props.type].filters[props.name]?.value || []
16
+ return $stores[props.type].filters[props.name]?.value || [];
16
17
  },
17
18
  set(value) {
18
- rootStore.updateFilter(props.name, value, props.type)
19
- },
20
- })
19
+ rootStore.updateFilter(props.name, value, props.type);
20
+ }
21
+ });
21
22
  onMounted(() => {
22
- console.log(props)
23
- })
23
+ console.log(props);
24
+ });
24
25
  </script>
25
- <style lang="scss"></style>
@@ -34,64 +34,49 @@
34
34
  </template>
35
35
 
36
36
  <script setup>
37
- import { useRootStore } from "../../../stores/root"
38
- import { useDisplay } from "vuetify"
39
- const { smAndDown } = useDisplay()
40
- const i18n = useI18n()
41
- const { locale, messages } = useI18n()
42
- const { $stores } = useNuxtApp()
43
- const rootStore = useRootStore()
44
- const props = defineProps(["type", "expanded"])
45
-
37
+ import { useRootStore } from "../../../stores/root";
38
+ import { useDisplay } from "vuetify";
39
+ const { smAndDown } = useDisplay();
40
+ const i18n = useI18n();
41
+ const { locale, messages } = useI18n();
42
+ const { $stores } = useNuxtApp();
43
+ const rootStore = useRootStore();
44
+ const props = defineProps(["type", "expanded"]);
46
45
  const ComponentName = (name) => {
47
46
  return resolveComponent(
48
47
  "ListInputs" + capitalize($stores[props.type].filters[name].type)
49
- )
50
- }
48
+ );
49
+ };
51
50
  const getItems = (name) => {
52
51
  if ($stores[props.type].filters[name].type === "Checkbox") {
53
- return []
52
+ return [];
54
53
  }
55
- if (
56
- messages.value[locale.value].list.filters[props.type][name] === undefined
57
- ) {
58
- console.log("name not found, no item for this filmter: ", name)
59
- return []
54
+ if (messages.value[locale.value].list.filters[props.type][name] === void 0) {
55
+ console.log("name not found, no item for this filmter: ", name);
56
+ return [];
60
57
  }
61
- // TODO replace with package based values
62
58
  return Object.keys(
63
59
  messages.value[locale.value].list.filters[props.type][name]
64
- )
65
- .filter((key) => key !== "label")
66
- .map((item) => ({
67
- title: i18n.t(`list.filters.${props.type}.${name}.${item}`),
68
- value: item,
69
- }))
70
- }
60
+ ).filter((key) => key !== "label").map((item) => ({
61
+ title: i18n.t(`list.filters.${props.type}.${name}.${item}`),
62
+ value: item
63
+ }));
64
+ };
71
65
  onMounted(() => {
72
- rootStore.loadRouteQuery(props.type)
73
- })
74
-
66
+ rootStore.loadRouteQuery(props.type);
67
+ });
75
68
  const computeVisibility = (filterItem) => {
76
69
  return (
77
70
  // if anything is set in the visibility key
78
- !$stores[props.type].filters[filterItem].visibility ||
79
- $stores[props.type].filters[filterItem].visibility?.default ||
80
- $stores[props.type].filters[filterItem].visibility?.switchIf.find(
71
+ !$stores[props.type].filters[filterItem].visibility || $stores[props.type].filters[filterItem].visibility?.default || $stores[props.type].filters[filterItem].visibility?.switchIf.find(
81
72
  //for each of the rules set in the switchIf key
82
73
  (rule) => {
83
- // we check if each of the condition are fulfilled
84
74
  return Object.keys(rule).find((value, index, obj) => {
85
- return $stores[props.type].filters[value].multiple
86
- ? $stores[props.type].filters[value]?.value &&
87
- $stores[props.type].filters[value]?.value.includes(rule[value])
88
- : $stores[props.type].filters[value]?.value === rule[value]
89
- })
75
+ return $stores[props.type].filters[value].multiple ? $stores[props.type].filters[value]?.value && $stores[props.type].filters[value]?.value.includes(rule[value]) : $stores[props.type].filters[value]?.value === rule[value];
76
+ });
90
77
  }
91
78
  )
92
- )
93
- return true
94
- }
79
+ );
80
+ return true;
81
+ };
95
82
  </script>
96
-
97
- <style lang="scss" scoped></style>