@paris-ias/list 1.0.11 → 1.0.14
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/README.md +71 -51
- package/dist/module.d.mts +8 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +64 -0
- package/dist/runtime/components/events/Badges.vue +5 -7
- package/dist/runtime/components/events/DateTimePlace.vue +11 -13
- package/dist/runtime/components/events/DenseItem.vue +7 -6
- package/dist/runtime/components/events/ExpandedItem.vue +3 -5
- package/dist/runtime/components/events/ListContainer.vue +6 -6
- package/dist/runtime/components/events/RegisterModal.vue +4 -5
- package/dist/runtime/components/events/RelatedItem.vue +6 -7
- package/dist/runtime/components/events/RowsItem.vue +12 -11
- package/dist/runtime/components/events/View.vue +10 -13
- package/dist/runtime/components/fellowships/Badges.vue +12 -15
- package/dist/runtime/components/fellowships/DenseItem.vue +7 -7
- package/dist/runtime/components/fellowships/RegisterModal.vue +3 -2
- package/dist/runtime/components/fellowships/RowsItem.vue +19 -21
- package/dist/runtime/components/fellowships/View.vue +43 -49
- package/dist/runtime/components/list/atoms/FiltersMenu.vue +6 -8
- package/dist/runtime/components/list/atoms/SearchInput.vue +42 -50
- package/dist/runtime/components/list/atoms/SearchItem.vue +14 -14
- package/dist/runtime/components/list/atoms/SearchString.vue +6 -7
- package/dist/runtime/components/list/atoms/SortMenu.vue +23 -40
- package/dist/runtime/components/list/atoms/ViewMenu.vue +14 -22
- package/dist/runtime/components/list/inputs/AutoComplete.vue +9 -9
- package/dist/runtime/components/list/inputs/BooleanSwitch.vue +9 -9
- package/dist/runtime/components/list/inputs/Checkbox.vue +11 -11
- package/dist/runtime/components/list/inputs/Select.vue +11 -11
- package/dist/runtime/components/list/molecules/Filters.vue +27 -42
- package/dist/runtime/components/list/molecules/Header.vue +5 -7
- package/dist/runtime/components/list/molecules/Pagination.vue +60 -102
- package/dist/runtime/components/list/organisms/List.vue +28 -36
- package/dist/runtime/components/list/views/Dense.vue +1 -14
- package/dist/runtime/components/list/views/Grid.vue +3 -3
- package/dist/runtime/components/list/views/Rows.vue +3 -3
- package/dist/runtime/components/list/views/Table.vue +3 -3
- package/dist/runtime/components/misc/atoms/CountUp.vue +89 -144
- package/dist/runtime/components/misc/atoms/DateStamp.vue +42 -46
- package/dist/runtime/components/misc/atoms/ImageContainer.vue +14 -22
- package/dist/runtime/components/misc/atoms/ShareMenu.vue +9 -11
- package/dist/runtime/components/misc/atoms/Socials.vue +46 -52
- package/dist/runtime/components/misc/molecules/ChipContainer.vue +7 -11
- package/dist/runtime/components/misc/molecules/Related.vue +9 -11
- package/dist/runtime/components/misc/molecules/RelatedItems.vue +7 -9
- package/dist/runtime/components/misc/molecules/SearchItem.vue +2 -2
- package/dist/runtime/components/news/DenseItem.vue +15 -15
- package/dist/runtime/components/news/ExpandedItem.vue +40 -50
- package/dist/runtime/components/news/Header.vue +3 -5
- package/dist/runtime/components/news/RelatedItem.vue +6 -7
- package/dist/runtime/components/news/RowsItem.vue +14 -16
- package/dist/runtime/components/news/View.vue +9 -20
- package/dist/runtime/components/people/DenseItem.vue +9 -8
- package/dist/runtime/components/people/ExpandedItem.vue +4 -6
- package/dist/runtime/components/people/GroupBadges.vue +6 -8
- package/dist/runtime/components/people/RelatedItem.vue +6 -7
- package/dist/runtime/components/people/RowsItem.vue +12 -19
- package/dist/runtime/components/people/View.vue +7 -7
- package/dist/runtime/components/projects/ExpandedItem.vue +4 -6
- package/dist/runtime/components/projects/RelatedItem.vue +6 -7
- package/dist/runtime/components/projects/RowsItem.vue +21 -26
- package/dist/runtime/components/projects/View.vue +8 -8
- package/dist/runtime/components/publications/RelatedItem.vue +6 -7
- package/dist/runtime/components/publications/RowsItem.vue +20 -22
- package/dist/runtime/components/publications/View.vue +9 -15
- package/dist/runtime/composables/useFetchItem.d.ts +6 -0
- package/dist/runtime/composables/useFetchItem.js +49 -0
- package/dist/runtime/composables/useIcons.d.ts +1 -0
- package/dist/runtime/composables/useIcons.js +30 -0
- package/dist/runtime/composables/useUtils.d.ts +12 -0
- package/dist/runtime/composables/useUtils.js +47 -0
- package/dist/runtime/plugins/pinia.d.ts +2 -0
- package/dist/runtime/plugins/{pinia.ts → pinia.js} +30 -48
- package/dist/runtime/plugins/vuetify.d.ts +2 -0
- package/dist/runtime/plugins/vuetify.js +7 -7
- package/dist/runtime/server/tsconfig.json +3 -0
- package/dist/runtime/stores/factory.d.ts +1 -0
- package/dist/runtime/stores/{factory.ts → factory.js} +9 -9
- package/dist/runtime/stores/root.d.ts +34 -0
- package/dist/runtime/stores/root.js +227 -0
- package/dist/types.d.mts +3 -0
- package/package.json +55 -26
- package/dist/runtime/composables/useFetchItem.ts +0 -64
- package/dist/runtime/composables/useIcons.ts +0 -30
- package/dist/runtime/composables/useUtils.ts +0 -75
- package/dist/runtime/stores/root.ts +0 -353
- package/example/.env.example +0 -3
- package/example/nuxt.config.ts +0 -19
- package/example/pages/index.vue +0 -27
- package/index.ts +0 -119
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<template>
|
|
1
|
+
<template>
|
|
2
2
|
<v-col v-ripple cols="12" sm="6" md="4" lg="3" xl="2">
|
|
3
3
|
<MiscAtomsImageContainer
|
|
4
4
|
contain
|
|
@@ -82,24 +82,22 @@
|
|
|
82
82
|
</div>
|
|
83
83
|
</v-col>
|
|
84
84
|
<v-divider />
|
|
85
|
-
</template>
|
|
86
|
-
|
|
87
|
-
<script setup>
|
|
88
|
-
import { useDisplay } from "vuetify"
|
|
89
|
-
const { name } = useDisplay()
|
|
90
|
-
const { locale } = useI18n()
|
|
91
|
-
const { $stores } = useNuxtApp()
|
|
92
|
-
const router = useRouter()
|
|
93
|
-
const localePath = useLocalePath()
|
|
94
|
-
const props = defineProps({
|
|
95
|
-
item: {
|
|
96
|
-
type: Object,
|
|
97
|
-
default: () => {
|
|
98
|
-
return {}
|
|
99
|
-
},
|
|
100
|
-
required: true
|
|
101
|
-
}
|
|
102
|
-
})
|
|
103
|
-
</script>
|
|
104
|
-
|
|
105
|
-
<style lang="scss"></style>
|
|
85
|
+
</template>
|
|
86
|
+
|
|
87
|
+
<script setup>
|
|
88
|
+
import { useDisplay } from "vuetify";
|
|
89
|
+
const { name } = useDisplay();
|
|
90
|
+
const { locale } = useI18n();
|
|
91
|
+
const { $stores } = useNuxtApp();
|
|
92
|
+
const router = useRouter();
|
|
93
|
+
const localePath = useLocalePath();
|
|
94
|
+
const props = defineProps({
|
|
95
|
+
item: {
|
|
96
|
+
type: Object,
|
|
97
|
+
default: () => {
|
|
98
|
+
return {};
|
|
99
|
+
},
|
|
100
|
+
required: true
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
</script>
|
|
@@ -114,26 +114,20 @@
|
|
|
114
114
|
</template>
|
|
115
115
|
|
|
116
116
|
<script setup>
|
|
117
|
-
import { useDisplay } from "vuetify"
|
|
118
|
-
const { $stores } = useNuxtApp()
|
|
119
|
-
const { name } = useDisplay()
|
|
120
|
-
const { locale } = useI18n()
|
|
117
|
+
import { useDisplay } from "vuetify";
|
|
118
|
+
const { $stores } = useNuxtApp();
|
|
119
|
+
const { name } = useDisplay();
|
|
120
|
+
const { locale } = useI18n();
|
|
121
121
|
const props = defineProps({
|
|
122
122
|
item: {
|
|
123
123
|
type: Object,
|
|
124
|
-
required: true
|
|
124
|
+
required: true
|
|
125
125
|
},
|
|
126
126
|
loading: {
|
|
127
127
|
type: Boolean,
|
|
128
128
|
required: false,
|
|
129
|
-
default: false
|
|
130
|
-
}
|
|
131
|
-
})
|
|
132
|
-
|
|
133
|
-
/* const { data: action } = await useAsyncData("actions", () =>
|
|
134
|
-
queryContent("/actions/" + locale.value)
|
|
135
|
-
.limit(1)
|
|
136
|
-
.find()
|
|
137
|
-
) */
|
|
138
|
-
$stores.publications.loading = false
|
|
129
|
+
default: false
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
$stores.publications.loading = false;
|
|
139
133
|
</script>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { useRoute } from "vue-router";
|
|
2
|
+
export const useFetchItem = () => {
|
|
3
|
+
const fetchItem = async (payload) => {
|
|
4
|
+
try {
|
|
5
|
+
const { locale } = useI18n();
|
|
6
|
+
const route = useRoute();
|
|
7
|
+
const variables = {
|
|
8
|
+
itemId: route.params.slug?.toString().trim(),
|
|
9
|
+
appId: "iea",
|
|
10
|
+
lang: locale.value
|
|
11
|
+
};
|
|
12
|
+
const { data, error } = await useAsyncQuery(payload.query, variables);
|
|
13
|
+
if (error.value) {
|
|
14
|
+
console.error("GraphQL error:", error.value);
|
|
15
|
+
throw error.value;
|
|
16
|
+
}
|
|
17
|
+
const item = data?.value[payload.key];
|
|
18
|
+
if (!item) {
|
|
19
|
+
throw createError({
|
|
20
|
+
statusCode: 404,
|
|
21
|
+
message: "Item not found in response"
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
const setI18nParams = useSetI18nParams();
|
|
25
|
+
if (!route.name.includes("people")) {
|
|
26
|
+
setI18nParams({
|
|
27
|
+
en: { slug: item.slug.en },
|
|
28
|
+
fr: { slug: item.slug.fr }
|
|
29
|
+
});
|
|
30
|
+
} else {
|
|
31
|
+
setI18nParams({
|
|
32
|
+
en: { slug: item.slug },
|
|
33
|
+
fr: { slug: item.slug }
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return item;
|
|
37
|
+
} catch (error) {
|
|
38
|
+
console.error("Error fetching item:", error);
|
|
39
|
+
throw createError({
|
|
40
|
+
statusCode: 404,
|
|
41
|
+
message: "Item not found",
|
|
42
|
+
cause: error
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
fetchItem
|
|
48
|
+
};
|
|
49
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function getFileIcon(fileName: string): string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export default function getFileIcon(fileName) {
|
|
2
|
+
console.log("fileName: ", fileName);
|
|
3
|
+
const fileExtension = fileName.split(".").pop();
|
|
4
|
+
console.log("fileExtension: ", fileExtension);
|
|
5
|
+
switch (fileExtension) {
|
|
6
|
+
case "pdf":
|
|
7
|
+
return "mdi-file-pdf-box";
|
|
8
|
+
case "doc":
|
|
9
|
+
case "docx":
|
|
10
|
+
return "mdi-file-word";
|
|
11
|
+
case "xls":
|
|
12
|
+
case "xlsx":
|
|
13
|
+
return "mdi-file-excel";
|
|
14
|
+
case "ppt":
|
|
15
|
+
case "pptx":
|
|
16
|
+
return "mdi-file-powerpoint";
|
|
17
|
+
case "jpg":
|
|
18
|
+
case "jpeg":
|
|
19
|
+
case "png":
|
|
20
|
+
case "gif":
|
|
21
|
+
return "mdi-file-image";
|
|
22
|
+
case "zip":
|
|
23
|
+
case "rar":
|
|
24
|
+
return "mdi-folder-zip";
|
|
25
|
+
case "txt":
|
|
26
|
+
return "mdi-file-document";
|
|
27
|
+
default:
|
|
28
|
+
return "mdi-file";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const formatDate: (dateStr: string, locale: string) => string;
|
|
2
|
+
export declare const getLocalizedDate: (dateIso: string) => string;
|
|
3
|
+
export declare const getDetailedFormatedDate: (dateStr: string, locale: string) => {
|
|
4
|
+
day: number;
|
|
5
|
+
month: string;
|
|
6
|
+
year: number;
|
|
7
|
+
hours: number;
|
|
8
|
+
minutes: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const capitalize: (value: string, multiple?: boolean) => string;
|
|
11
|
+
export declare const slugify: (str: string) => string;
|
|
12
|
+
export declare const formatDateValue: (date: string | Date, locale: string) => string;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export const formatDate = (dateStr, locale) => {
|
|
2
|
+
const date = new Date(dateStr);
|
|
3
|
+
return date.toLocaleDateString(locale, {
|
|
4
|
+
weekday: "long",
|
|
5
|
+
year: "numeric",
|
|
6
|
+
month: "long",
|
|
7
|
+
day: "numeric"
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
export const getLocalizedDate = (dateIso) => {
|
|
11
|
+
const { $i18n } = useNuxtApp();
|
|
12
|
+
return new Date(dateIso).toLocaleDateString(
|
|
13
|
+
$i18n.localeProperties.value.language,
|
|
14
|
+
{
|
|
15
|
+
weekday: "long",
|
|
16
|
+
year: "numeric",
|
|
17
|
+
month: "long",
|
|
18
|
+
day: "numeric"
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
export const getDetailedFormatedDate = (dateStr, locale) => {
|
|
23
|
+
const date = new Date(dateStr);
|
|
24
|
+
return {
|
|
25
|
+
day: date.getDate(),
|
|
26
|
+
month: date.toLocaleString(locale, { month: "long" }),
|
|
27
|
+
year: date.getFullYear(),
|
|
28
|
+
hours: date.getUTCHours(),
|
|
29
|
+
minutes: date.getMinutes()
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export const capitalize = (value, multiple) => multiple ? value.replace(/(?:^|[\s'-])\S/g, (a) => a.toUpperCase()) : value && value.charAt(0).toUpperCase() + value.slice(1);
|
|
33
|
+
export const slugify = (str) => {
|
|
34
|
+
str = str.replace(/^\s+|\s+$/g, "").trim();
|
|
35
|
+
str = str.toLowerCase();
|
|
36
|
+
const from = "\xE0\xE1\xE4\xE2\xE8\xE9\xEB\xEA\xEC\xED\xEF\xEE\xF2\xF3\xF6\xF4\xF9\xFA\xFC\xFB\xF1\xE7\xB7/_,:;";
|
|
37
|
+
const to = "aaaaeeeeiiiioooouuuunc------";
|
|
38
|
+
for (let i = 0, l = from.length; i < l; i++) {
|
|
39
|
+
str = str.replace(new RegExp(from.charAt(i), "g"), to.charAt(i));
|
|
40
|
+
}
|
|
41
|
+
str = str.replace(/[^a-z0-9 -]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-");
|
|
42
|
+
return str;
|
|
43
|
+
};
|
|
44
|
+
export const formatDateValue = (date, locale) => {
|
|
45
|
+
const formattedDate = new Date(date);
|
|
46
|
+
return formattedDate.toLocaleDateString(locale);
|
|
47
|
+
};
|
|
@@ -1,88 +1,70 @@
|
|
|
1
|
-
import { createDynamicStore } from "../stores/factory"
|
|
2
|
-
import
|
|
3
|
-
import { useRootStore } from "../stores/root"
|
|
4
|
-
const rootStore = useRootStore()
|
|
1
|
+
import { createDynamicStore } from "../stores/factory.js";
|
|
2
|
+
import { defineNuxtPlugin } from "nuxt/app";
|
|
5
3
|
export default defineNuxtPlugin(async (nuxtApp) => {
|
|
6
|
-
const appConfig = useAppConfig()
|
|
7
|
-
list: {
|
|
8
|
-
modules: string[]
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// Define module imports
|
|
4
|
+
const appConfig = useAppConfig();
|
|
13
5
|
const moduleImports = {
|
|
14
6
|
events: () => ({
|
|
15
7
|
model: import("@paris-ias/data/dist/list/events.js"),
|
|
16
8
|
queries: {
|
|
17
9
|
list: import("../graphql/queries/list/events.gql"),
|
|
18
|
-
get: import("../graphql/queries/item/events.gql")
|
|
19
|
-
}
|
|
10
|
+
get: import("../graphql/queries/item/events.gql")
|
|
11
|
+
}
|
|
20
12
|
}),
|
|
21
13
|
news: () => ({
|
|
22
14
|
model: import("@paris-ias/data/dist/list/news.js"),
|
|
23
15
|
queries: {
|
|
24
16
|
list: import("../graphql/queries/list/news.gql"),
|
|
25
|
-
get: import("../graphql/queries/item/news.gql")
|
|
26
|
-
}
|
|
17
|
+
get: import("../graphql/queries/item/news.gql")
|
|
18
|
+
}
|
|
27
19
|
}),
|
|
28
20
|
people: () => ({
|
|
29
21
|
model: import("@paris-ias/data/dist/list/people.js"),
|
|
30
22
|
queries: {
|
|
31
23
|
list: import("../graphql/queries/list/people.gql"),
|
|
32
|
-
get: import("../graphql/queries/item/people.gql")
|
|
33
|
-
}
|
|
24
|
+
get: import("../graphql/queries/item/people.gql")
|
|
25
|
+
}
|
|
34
26
|
}),
|
|
35
27
|
projects: () => ({
|
|
36
28
|
model: import("@paris-ias/data/dist/list/projects.js"),
|
|
37
29
|
queries: {
|
|
38
30
|
list: import("../graphql/queries/list/projects.gql"),
|
|
39
|
-
get: import("../graphql/queries/item/projects.gql")
|
|
40
|
-
}
|
|
31
|
+
get: import("../graphql/queries/item/projects.gql")
|
|
32
|
+
}
|
|
41
33
|
}),
|
|
42
34
|
fellowships: () => ({
|
|
43
35
|
model: import("@paris-ias/data/dist/list/fellowships.js"),
|
|
44
36
|
queries: {
|
|
45
37
|
list: import("../graphql/queries/list/fellowships.gql"),
|
|
46
|
-
get: import("../graphql/queries/item/fellowships.gql")
|
|
47
|
-
}
|
|
38
|
+
get: import("../graphql/queries/item/fellowships.gql")
|
|
39
|
+
}
|
|
48
40
|
}),
|
|
49
41
|
publications: () => ({
|
|
50
42
|
model: import("@paris-ias/data/dist/list/publications.js"),
|
|
51
43
|
queries: {
|
|
52
44
|
list: import("../graphql/queries/list/publications.gql"),
|
|
53
|
-
get: import("../graphql/queries/item/publications.gql")
|
|
54
|
-
}
|
|
55
|
-
})
|
|
56
|
-
|
|
45
|
+
get: import("../graphql/queries/item/publications.gql")
|
|
46
|
+
}
|
|
47
|
+
})
|
|
57
48
|
// Add other modules similarly...
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const queries = {}
|
|
63
|
-
|
|
64
|
-
// Preload all required modules
|
|
49
|
+
};
|
|
50
|
+
const stores = {};
|
|
51
|
+
const queries = {};
|
|
52
|
+
console.log("INITIALIZING STORES");
|
|
65
53
|
await Promise.all(
|
|
66
54
|
appConfig.list.modules.map(async (type) => {
|
|
67
55
|
try {
|
|
68
|
-
const imports = await moduleImports[
|
|
69
|
-
|
|
70
|
-
]()
|
|
71
|
-
const model = (await imports.model).default
|
|
56
|
+
const imports = await moduleImports[type]();
|
|
57
|
+
const model = (await imports.model).default;
|
|
72
58
|
queries[type] = {
|
|
73
59
|
list: (await imports.queries.list).default,
|
|
74
|
-
get: (await imports.queries.get).default
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
stores[type] = createDynamicStore(type, { ...model, queries })()
|
|
60
|
+
get: (await imports.queries.get).default
|
|
61
|
+
};
|
|
62
|
+
stores[type] = createDynamicStore(type, model)();
|
|
78
63
|
} catch (error) {
|
|
79
|
-
console.error(`Failed to initialize ${type} store:`, error)
|
|
64
|
+
console.error(`Failed to initialize ${type} store:`, error);
|
|
80
65
|
}
|
|
81
66
|
})
|
|
82
|
-
)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
nuxtApp.provide("stores", stores)
|
|
87
|
-
nuxtApp.provide("queries", queries)
|
|
88
|
-
})
|
|
67
|
+
);
|
|
68
|
+
nuxtApp.provide("stores", stores);
|
|
69
|
+
nuxtApp.provide("queries", queries);
|
|
70
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createVuetify } from "vuetify"
|
|
2
|
-
import * as components from "vuetify/components"
|
|
3
|
-
import * as directives from "vuetify/directives"
|
|
4
|
-
|
|
1
|
+
import { createVuetify } from "vuetify";
|
|
2
|
+
import * as components from "vuetify/components";
|
|
3
|
+
import * as directives from "vuetify/directives";
|
|
4
|
+
import { defineNuxtPlugin } from "nuxt/app";
|
|
5
5
|
export default defineNuxtPlugin((nuxtApp) => {
|
|
6
6
|
const vuetify = createVuetify({
|
|
7
7
|
ssr: true,
|
|
@@ -15,7 +15,7 @@ export default defineNuxtPlugin((nuxtApp) => {
|
|
|
15
15
|
lg: 800,
|
|
16
16
|
xl: 1280,
|
|
17
17
|
}, */
|
|
18
|
-
})
|
|
18
|
+
});
|
|
19
19
|
|
|
20
|
-
nuxtApp.vueApp.use(vuetify)
|
|
21
|
-
})
|
|
20
|
+
nuxtApp.vueApp.use(vuetify);
|
|
21
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createDynamicStore: (storeName: string, moduleState: object) => import("pinia").StoreDefinition<string, {} | Pick<any, string | number>, {} | Pick<any, string | number>, {} | Pick<any, string | number>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { defineStore } from "pinia";
|
|
2
|
+
export const createDynamicStore = (storeName, moduleState) => {
|
|
2
3
|
return defineStore(storeName, () => {
|
|
3
4
|
const state = reactive({
|
|
4
5
|
loading: false,
|
|
@@ -7,12 +8,11 @@ export const createDynamicStore = (storeName: string, moduleState: object) => {
|
|
|
7
8
|
page: 1,
|
|
8
9
|
numberOfPages: 0,
|
|
9
10
|
search: "",
|
|
10
|
-
error: null
|
|
11
|
-
...moduleState
|
|
12
|
-
})
|
|
13
|
-
|
|
11
|
+
error: null,
|
|
12
|
+
...moduleState
|
|
13
|
+
});
|
|
14
14
|
return {
|
|
15
|
-
...toRefs(state)
|
|
16
|
-
}
|
|
17
|
-
})
|
|
18
|
-
}
|
|
15
|
+
...toRefs(state)
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const useRootStore: import("pinia").StoreDefinition<"rootStore", Record<string, any>, {}, {
|
|
2
|
+
setLoading(value: boolean, type?: string): void;
|
|
3
|
+
setScrolled(): void;
|
|
4
|
+
loadRouteQuery(type: string): void;
|
|
5
|
+
setFiltersCount(type: string): void;
|
|
6
|
+
setBlankFilterLoad(type: string): void;
|
|
7
|
+
setDefaults(): void;
|
|
8
|
+
updateRouteQuery(type: string): void;
|
|
9
|
+
resetState(): void;
|
|
10
|
+
updateSort({ value, type }: {
|
|
11
|
+
value: number[] | string[];
|
|
12
|
+
type: string;
|
|
13
|
+
}): void;
|
|
14
|
+
updateView({ value, type }: {
|
|
15
|
+
value: string;
|
|
16
|
+
type: string;
|
|
17
|
+
}): void;
|
|
18
|
+
updateLocalStorage(key: string, value: string): void;
|
|
19
|
+
updateFilter(key: string, val: any, type: string): void;
|
|
20
|
+
updateItemsPerPage({ value, type }: {
|
|
21
|
+
value: number;
|
|
22
|
+
type: string;
|
|
23
|
+
}): void;
|
|
24
|
+
updatePage({ page, type }: {
|
|
25
|
+
page: number;
|
|
26
|
+
type: string;
|
|
27
|
+
}): void;
|
|
28
|
+
updateSearch({ type, search, lang, }: {
|
|
29
|
+
type: string;
|
|
30
|
+
search: string;
|
|
31
|
+
lang: string;
|
|
32
|
+
}): Promise<void>;
|
|
33
|
+
update(type: string, lang?: string): Promise<boolean>;
|
|
34
|
+
}>;
|