@paris-ias/list 1.0.99 → 1.0.101
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/dist/module.json +1 -1
- package/dist/runtime/components/events/SlidingItem.vue +1 -12
- package/dist/runtime/components/list/molecules/Filters.vue +8 -1
- package/dist/runtime/components/list/molecules/Pagination.vue +0 -9
- package/dist/runtime/components/list/organisms/List.vue +1 -0
- package/dist/runtime/plugins/pinia.js +15 -0
- package/dist/runtime/stores/root.d.ts +3 -2
- package/dist/runtime/stores/root.js +19 -6
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<v-sheet
|
|
3
|
-
v-motion
|
|
4
|
-
class="d-flex sliding-item flex-md-row flex-column px-6"
|
|
5
|
-
:initial="{
|
|
6
|
-
opacity: 0,
|
|
7
|
-
x: 100,
|
|
8
|
-
}"
|
|
9
|
-
:enter="{
|
|
10
|
-
opacity: 1,
|
|
11
|
-
x: 0,
|
|
12
|
-
}"
|
|
13
|
-
>
|
|
2
|
+
<v-sheet v-motion class="d-flex sliding-item flex-md-row flex-column px-6">
|
|
14
3
|
<MiscAtomsDateStamp
|
|
15
4
|
:date-start="item.start"
|
|
16
5
|
:date-stop="item.stop"
|
|
@@ -48,7 +48,7 @@ import { useI18n } from "vue-i18n";
|
|
|
48
48
|
const { smAndDown } = useDisplay();
|
|
49
49
|
const i18n = useI18n();
|
|
50
50
|
const { locale, messages } = useI18n();
|
|
51
|
-
const { $stores } = useNuxtApp();
|
|
51
|
+
const { $stores, $filters } = useNuxtApp();
|
|
52
52
|
const rootStore = useRootStore();
|
|
53
53
|
const props = defineProps(["type", "expanded"]);
|
|
54
54
|
const ComponentName = (name) => {
|
|
@@ -60,6 +60,13 @@ const getItems = (name) => {
|
|
|
60
60
|
if ($stores[props.type].filters[name].type === "Checkbox") {
|
|
61
61
|
return [];
|
|
62
62
|
}
|
|
63
|
+
if ($filters?.[props.type]?.[name]) {
|
|
64
|
+
console.log("filters found for ", name, $filters[props.type][name]);
|
|
65
|
+
return $filters[props.type][name].filter((key) => key !== "label").map((item) => ({
|
|
66
|
+
title: i18n.t(`list.filters.${props.type}.${name}.${item}`),
|
|
67
|
+
value: item
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
63
70
|
if (messages.value[locale.value].list.filters[props.type][name] === void 0) {
|
|
64
71
|
console.log("name not found, no item for this filmter: ", name);
|
|
65
72
|
return [];
|
|
@@ -184,15 +184,6 @@ const getGapPage = (index) => {
|
|
|
184
184
|
renderPages.value[index - 1].key + ((renderPages.value[index + 1].key || props.totalPages) - renderPages.value[index - 1].key) / 2
|
|
185
185
|
);
|
|
186
186
|
};
|
|
187
|
-
watch(
|
|
188
|
-
() => route.query.page,
|
|
189
|
-
(newPage) => {
|
|
190
|
-
if (newPage) {
|
|
191
|
-
props.currentPage = Number.parseInt(newPage, 10);
|
|
192
|
-
}
|
|
193
|
-
},
|
|
194
|
-
{ immediate: true }
|
|
195
|
-
);
|
|
196
187
|
</script>
|
|
197
188
|
|
|
198
189
|
<style>
|
|
@@ -83,6 +83,7 @@ const itemTemplate = computed(
|
|
|
83
83
|
const numberOfPages = computed(() => $stores[props.type].numberOfPages);
|
|
84
84
|
const page = computed(() => +$stores[props.type].page);
|
|
85
85
|
const items = computed(() => $stores[props.type].items);
|
|
86
|
+
rootStore.initializePageFromRoute();
|
|
86
87
|
try {
|
|
87
88
|
await rootStore.update(props.type, locale.value);
|
|
88
89
|
} catch (error) {
|
|
@@ -107,6 +107,20 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
107
107
|
const stores = {};
|
|
108
108
|
const queries = {};
|
|
109
109
|
const models = {};
|
|
110
|
+
let builtFilters = {};
|
|
111
|
+
try {
|
|
112
|
+
const filtersResponse = await fetch(
|
|
113
|
+
"https://cdn-yggdrasil-dev.s3.eu-west-2.amazonaws.com/iea/filters.json"
|
|
114
|
+
);
|
|
115
|
+
if (filtersResponse.ok) {
|
|
116
|
+
builtFilters = await filtersResponse.json();
|
|
117
|
+
console.log("Filters loaded successfully:", builtFilters);
|
|
118
|
+
} else {
|
|
119
|
+
console.warn("Failed to load filters, using empty object");
|
|
120
|
+
}
|
|
121
|
+
} catch (error) {
|
|
122
|
+
console.error("Error loading filters:", error);
|
|
123
|
+
}
|
|
110
124
|
console.log("INITIALIZING STORES");
|
|
111
125
|
await Promise.all(
|
|
112
126
|
appConfig.list.modules.map(async (type) => {
|
|
@@ -129,4 +143,5 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
129
143
|
nuxtApp.provide("rootStore", rootStore);
|
|
130
144
|
nuxtApp.provide("stores", stores);
|
|
131
145
|
nuxtApp.provide("queries", queries);
|
|
146
|
+
nuxtApp.provide("filters", builtFilters);
|
|
132
147
|
});
|
|
@@ -45,10 +45,11 @@ export declare const useRootStore: import("pinia").StoreDefinition<"rootStore",
|
|
|
45
45
|
value: number;
|
|
46
46
|
type: string;
|
|
47
47
|
}): void;
|
|
48
|
-
updatePage({ page, type }: {
|
|
48
|
+
updatePage({ page, type, }: {
|
|
49
49
|
page: number;
|
|
50
50
|
type: string;
|
|
51
|
-
}): void
|
|
51
|
+
}): Promise<void>;
|
|
52
|
+
initializePageFromRoute(): void;
|
|
52
53
|
updateSearch({ type, search, lang, }: {
|
|
53
54
|
type: string;
|
|
54
55
|
search: string;
|
|
@@ -185,13 +185,26 @@ export const useRootStore = defineStore("rootStore", {
|
|
|
185
185
|
}
|
|
186
186
|
this.update(type);
|
|
187
187
|
},
|
|
188
|
-
updatePage({
|
|
189
|
-
|
|
188
|
+
async updatePage({
|
|
189
|
+
page,
|
|
190
|
+
type
|
|
191
|
+
}) {
|
|
190
192
|
const router = useRouter();
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
const currentQuery = router.currentRoute.value.query;
|
|
194
|
+
const newQuery = { ...currentQuery };
|
|
195
|
+
if (page > 1) {
|
|
196
|
+
newQuery.page = page.toString();
|
|
197
|
+
} else {
|
|
198
|
+
delete newQuery.page;
|
|
199
|
+
}
|
|
200
|
+
this.page = page;
|
|
201
|
+
await router.replace({ query: newQuery });
|
|
202
|
+
await this.update(type);
|
|
203
|
+
},
|
|
204
|
+
initializePageFromRoute() {
|
|
205
|
+
const { query } = useRouter().currentRoute.value;
|
|
206
|
+
const page = Number.parseInt(query.page, 10);
|
|
207
|
+
this.page = isNaN(page) || page < 1 ? 1 : page;
|
|
195
208
|
},
|
|
196
209
|
async updateSearch({
|
|
197
210
|
type = "all",
|