@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.
- 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.js +69 -0
- package/dist/runtime/plugins/vuetify.d.ts +2 -0
- 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/plugins/pinia.ts +0 -88
- 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,353 +0,0 @@
|
|
|
1
|
-
/* import filtersRaw from '~/assets/data/filters'
|
|
2
|
-
import lists from '~/assets/data/lists' */
|
|
3
|
-
|
|
4
|
-
/* import api from "~/server/api/github" */
|
|
5
|
-
import { defineStore } from "pinia"
|
|
6
|
-
import type { Views, ModuleType } from "@paris-ias/data"
|
|
7
|
-
|
|
8
|
-
import SEARCH from "../graphql/queries/list/search.gql"
|
|
9
|
-
export const useRootStore = defineStore("rootStore", {
|
|
10
|
-
state: (): Record<
|
|
11
|
-
string,
|
|
12
|
-
boolean | number | string | ModuleType | searchResults
|
|
13
|
-
> => ({
|
|
14
|
-
scrolled: import.meta.browser ? window.scrollY > 0 : false,
|
|
15
|
-
loading: false,
|
|
16
|
-
total: 0,
|
|
17
|
-
skip: 0,
|
|
18
|
-
page: 1,
|
|
19
|
-
numberOfPages: 0,
|
|
20
|
-
search: "",
|
|
21
|
-
results: {
|
|
22
|
-
events: {},
|
|
23
|
-
news: {},
|
|
24
|
-
people: {},
|
|
25
|
-
projects: {},
|
|
26
|
-
fellowships: {},
|
|
27
|
-
publications: {},
|
|
28
|
-
},
|
|
29
|
-
}),
|
|
30
|
-
|
|
31
|
-
actions: {
|
|
32
|
-
setLoading(value: boolean, type: string = "") {
|
|
33
|
-
const { $stores } = useNuxtApp()
|
|
34
|
-
this.loading = value
|
|
35
|
-
if (type.length) $stores[type].loading = value
|
|
36
|
-
},
|
|
37
|
-
setScrolled() {
|
|
38
|
-
if (import.meta.browser) {
|
|
39
|
-
this.scrolled = window.scrollY > 0
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
loadRouteQuery(type: string) {
|
|
43
|
-
const { currentRoute } = useRouter()
|
|
44
|
-
const { $stores } = useNuxtApp()
|
|
45
|
-
const query = currentRoute.value.query
|
|
46
|
-
if (Object.keys(query)?.length) {
|
|
47
|
-
Object.keys(query).forEach((filter) => {
|
|
48
|
-
if (Object.keys($stores[type].filters).includes(filter))
|
|
49
|
-
$stores[type].filters[filter].value = (this[type] as ModuleType)
|
|
50
|
-
.list.filters[filter].multiple
|
|
51
|
-
? JSON.parse(query[filter] as string)
|
|
52
|
-
: query[filter]
|
|
53
|
-
})
|
|
54
|
-
/* if (query.view) {
|
|
55
|
-
;$stores[type].view = query.view as
|
|
56
|
-
| string
|
|
57
|
-
| Views
|
|
58
|
-
| undefined
|
|
59
|
-
}
|
|
60
|
-
if (query.page) {
|
|
61
|
-
this.page = +query.page
|
|
62
|
-
} else {
|
|
63
|
-
this.page = 1
|
|
64
|
-
} */
|
|
65
|
-
|
|
66
|
-
/* const sortObj = $stores[type].sort
|
|
67
|
-
const defaultSortKey = Object.keys(sortObj).find(
|
|
68
|
-
(item) => sortObj[item].default === true,
|
|
69
|
-
)
|
|
70
|
-
const defaultSort = [sortObj[defaultSortKey as string]]
|
|
71
|
-
|
|
72
|
-
const sortDesc = $stores[type].sortDesc
|
|
73
|
-
let sortDescItem
|
|
74
|
-
sortDescItem = (sortDesc as number[] | boolean[])[0]
|
|
75
|
-
|
|
76
|
-
if (query.sortBy) {
|
|
77
|
-
;$stores[type].sortBy = [query.sortBy] as string[]
|
|
78
|
-
}
|
|
79
|
-
if (typeof query.sortDesc !== "undefined") {
|
|
80
|
-
sortDescItem = !!(query.sortDesc === "true")
|
|
81
|
-
} else {
|
|
82
|
-
sortDescItem = defaultSort[0].value[1]
|
|
83
|
-
} */
|
|
84
|
-
}
|
|
85
|
-
console.log("query loaded")
|
|
86
|
-
},
|
|
87
|
-
|
|
88
|
-
setFiltersCount(type: string) {
|
|
89
|
-
const { $stores } = useNuxtApp()
|
|
90
|
-
let filtersCount = 0 as number
|
|
91
|
-
Object.keys($stores[type].filters)
|
|
92
|
-
// remove empty values
|
|
93
|
-
.forEach((filter) => {
|
|
94
|
-
/*console.log("filter: ", filter)
|
|
95
|
-
console.log("filters[filter]?.value: ", filters[filter].value)
|
|
96
|
-
*/ /* console.log(
|
|
97
|
-
'typeof filters[filter]?.value !== "undefined": ',
|
|
98
|
-
typeof filters[filter]?.value !== "undefined",
|
|
99
|
-
) */
|
|
100
|
-
if (
|
|
101
|
-
$stores[type].filters[filter]?.value?.length &&
|
|
102
|
-
typeof $stores[type].filters[filter]?.value !== "undefined"
|
|
103
|
-
) {
|
|
104
|
-
filtersCount++
|
|
105
|
-
}
|
|
106
|
-
return filtersCount
|
|
107
|
-
})
|
|
108
|
-
|
|
109
|
-
$stores[type].filtersCount = filtersCount
|
|
110
|
-
},
|
|
111
|
-
setBlankFilterLoad(type: string) {
|
|
112
|
-
/* ;(this[type] as ModuleType).loading = false */
|
|
113
|
-
},
|
|
114
|
-
setDefaults() {
|
|
115
|
-
// lang
|
|
116
|
-
const lang = localStorage.getItem("lang")
|
|
117
|
-
/* if(lang)i18n.global.locale = lang; */
|
|
118
|
-
// dark mode
|
|
119
|
-
|
|
120
|
-
// event
|
|
121
|
-
// people
|
|
122
|
-
// news
|
|
123
|
-
// project
|
|
124
|
-
// fellowships
|
|
125
|
-
},
|
|
126
|
-
updateRouteQuery(type: string) {
|
|
127
|
-
const router = useRouter()
|
|
128
|
-
const { $stores } = useNuxtApp()
|
|
129
|
-
// update route
|
|
130
|
-
const routeQuery: Record<string, string> = {
|
|
131
|
-
// Add search if it exists and is defined
|
|
132
|
-
...(this.search ? { search: this.search } : {}),
|
|
133
|
-
|
|
134
|
-
// Add page if it's greater than 1
|
|
135
|
-
...(this.page > 1 ? { page: this.page.toString() } : {}),
|
|
136
|
-
|
|
137
|
-
// Add filters with defined values
|
|
138
|
-
...Object.entries($stores[type].filters).reduce(
|
|
139
|
-
(acc, [filterKey, filter]) => {
|
|
140
|
-
if (!$stores[type].filters[filterKey]?.value) {
|
|
141
|
-
return acc
|
|
142
|
-
}
|
|
143
|
-
return {
|
|
144
|
-
...acc,
|
|
145
|
-
...{
|
|
146
|
-
[filterKey]: $stores[type].filters[filterKey]?.value,
|
|
147
|
-
},
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
{} as Record<string, string>
|
|
151
|
-
),
|
|
152
|
-
}
|
|
153
|
-
router.replace({ query: routeQuery })
|
|
154
|
-
},
|
|
155
|
-
resetState() {
|
|
156
|
-
const { $stores } = useNuxtApp()
|
|
157
|
-
console.log("resetState")
|
|
158
|
-
this.search = ""
|
|
159
|
-
this.page = 1
|
|
160
|
-
this.scrolled = false
|
|
161
|
-
this.loading = false
|
|
162
|
-
this.total = 0
|
|
163
|
-
this.skip = 0
|
|
164
|
-
this.numberOfPages = 0
|
|
165
|
-
const modules = [
|
|
166
|
-
"events",
|
|
167
|
-
"news",
|
|
168
|
-
"people",
|
|
169
|
-
"projects",
|
|
170
|
-
"fellowships",
|
|
171
|
-
"publications",
|
|
172
|
-
]
|
|
173
|
-
/* this.events.list.filters = events.list.filters
|
|
174
|
-
this.news.list.filters = news.list.filters
|
|
175
|
-
this.people.list.filters = people.list.filters
|
|
176
|
-
this.projects.list.filters = projects.list.filters
|
|
177
|
-
this.fellowships.list.filters = fellowships.list.filters
|
|
178
|
-
this.publications.list.filters = publications.list.filters */
|
|
179
|
-
modules.forEach((type) => {
|
|
180
|
-
/* const viewsObj = $stores[type].views as Record<
|
|
181
|
-
string,
|
|
182
|
-
Views
|
|
183
|
-
>
|
|
184
|
-
const defaultViewsKey = Object.keys(viewsObj).find(
|
|
185
|
-
(item) => viewsObj[item].default === true
|
|
186
|
-
)
|
|
187
|
-
const defaultView = viewsObj[defaultViewsKey as string]
|
|
188
|
-
|
|
189
|
-
const sortObj = $stores[type].sort
|
|
190
|
-
const defaultSortKey = Object.keys(sortObj).find(
|
|
191
|
-
(item) => sortObj[item].default === true
|
|
192
|
-
)
|
|
193
|
-
const defaultSort = sortObj[defaultSortKey as string] */
|
|
194
|
-
/*
|
|
195
|
-
// TODO make dynamic based on an ~/assets located file
|
|
196
|
-
;$stores[type].view = defaultView
|
|
197
|
-
;$stores[type].sortBy = [defaultSort.value[0]]
|
|
198
|
-
;$stores[type].sortDesc = [defaultSort.value[1]] */
|
|
199
|
-
})
|
|
200
|
-
},
|
|
201
|
-
updateSort({ value, type }: { value: number[] | string[]; type: string }) {
|
|
202
|
-
const { $stores } = useNuxtApp()
|
|
203
|
-
$stores[type].sortBy = [value[0]] as string[]
|
|
204
|
-
$stores[type].sortDesc = [value[1]] as number[]
|
|
205
|
-
this.page = 1
|
|
206
|
-
this.updateLocalStorage(type + "_sort", value.join("_"))
|
|
207
|
-
this.update(type)
|
|
208
|
-
},
|
|
209
|
-
updateView({ value, type }: { value: string; type: string }) {
|
|
210
|
-
const { $stores } = useNuxtApp()
|
|
211
|
-
$stores[type].view = {
|
|
212
|
-
...($stores[type].views[value] as Views),
|
|
213
|
-
name: value,
|
|
214
|
-
}
|
|
215
|
-
this.updateLocalStorage(type + "_view", value)
|
|
216
|
-
this.update(type)
|
|
217
|
-
},
|
|
218
|
-
updateLocalStorage(key: string, value: string) {
|
|
219
|
-
const local = JSON.parse(localStorage.getItem("PARIS_IAS") as any) || {}
|
|
220
|
-
local[key] = value
|
|
221
|
-
localStorage.setItem("PARIS_IAS", JSON.stringify(local))
|
|
222
|
-
},
|
|
223
|
-
updateFilter(key: string, val: any, type: string) {
|
|
224
|
-
const { $stores } = useNuxtApp()
|
|
225
|
-
console.log("update filter: ", { key, val, type })
|
|
226
|
-
|
|
227
|
-
if (["online", "outside", "past"].includes(key) && val === false) {
|
|
228
|
-
$stores[type].filters[key].value = null
|
|
229
|
-
} else {
|
|
230
|
-
$stores[type].filters[key].value = val
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
this.updatePage({ page: 1, type })
|
|
234
|
-
},
|
|
235
|
-
updateItemsPerPage({ value, type }: { value: number; type: string }) {
|
|
236
|
-
const { $stores } = useNuxtApp()
|
|
237
|
-
this.page = 1
|
|
238
|
-
$stores[types].itemsPerPage = value
|
|
239
|
-
|
|
240
|
-
this.update(type)
|
|
241
|
-
},
|
|
242
|
-
updatePage({ page, type }: { page: number; type: string }) {
|
|
243
|
-
this.page = page
|
|
244
|
-
this.update(type)
|
|
245
|
-
},
|
|
246
|
-
async updateSearch({
|
|
247
|
-
type = "all",
|
|
248
|
-
search = "",
|
|
249
|
-
lang = "en",
|
|
250
|
-
}: {
|
|
251
|
-
type: string
|
|
252
|
-
search: string
|
|
253
|
-
lang: string
|
|
254
|
-
}) {
|
|
255
|
-
this.search = search
|
|
256
|
-
/* console.log("updateSearch: ", search + " " + lang) */
|
|
257
|
-
this.setLoading(true)
|
|
258
|
-
|
|
259
|
-
await this.update(type, lang)
|
|
260
|
-
},
|
|
261
|
-
|
|
262
|
-
async update(type: string, lang: string = "en") {
|
|
263
|
-
const { $stores } = useNuxtApp()
|
|
264
|
-
this.setLoading(true)
|
|
265
|
-
if (type !== "all") {
|
|
266
|
-
$stores[type].loading = true
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
// fetch the item categories
|
|
270
|
-
|
|
271
|
-
const itemsPerPage =
|
|
272
|
-
type === "all" ? 3 : ($stores[type]?.itemsPerPage as number)
|
|
273
|
-
const filters: Record<string, any> = {}
|
|
274
|
-
|
|
275
|
-
if (type !== "all") {
|
|
276
|
-
for (const filter in $stores[type].filters) {
|
|
277
|
-
const filterValue = $stores[type].filters[filter]?.value
|
|
278
|
-
|
|
279
|
-
// Prune empty values
|
|
280
|
-
if (typeof filterValue !== "undefined" && filterValue?.length) {
|
|
281
|
-
filters[filter] = filterValue
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
const args = JSON.parse(
|
|
287
|
-
JSON.stringify({
|
|
288
|
-
options: {
|
|
289
|
-
// skip
|
|
290
|
-
skip: +this.page === 1 ? 0 : (+this.page - 1) * itemsPerPage,
|
|
291
|
-
// limit
|
|
292
|
-
limit: itemsPerPage,
|
|
293
|
-
// sort, array of keys and array of directions - to have x tie breakers if necessary
|
|
294
|
-
sortBy: type === "all" ? "searchScore" : $stores[type].sortBy,
|
|
295
|
-
sortDesc:
|
|
296
|
-
type === "all" ? -1 : $stores[type].sortDesc > 0 ? true : false,
|
|
297
|
-
// search (if set)
|
|
298
|
-
...((this.search as string)?.length &&
|
|
299
|
-
type !== "all" && { search: this.search }),
|
|
300
|
-
// add the store module filters
|
|
301
|
-
filters,
|
|
302
|
-
},
|
|
303
|
-
...((this.search as string)?.length &&
|
|
304
|
-
type === "all" && { search: this.search }),
|
|
305
|
-
appId: "iea",
|
|
306
|
-
lang,
|
|
307
|
-
})
|
|
308
|
-
)
|
|
309
|
-
args.options.filters = JSON.stringify(args.options.filters)
|
|
310
|
-
let result: any = {}
|
|
311
|
-
console.log("args: ", args)
|
|
312
|
-
|
|
313
|
-
console.log(`Fetching ${type}`)
|
|
314
|
-
const { $queries } = useNuxtApp()
|
|
315
|
-
const { data, error } = await useAsyncQuery(
|
|
316
|
-
type === "all" ? SEARCH : $queries[type].list,
|
|
317
|
-
args
|
|
318
|
-
)
|
|
319
|
-
/* console.log("data: ", data) */
|
|
320
|
-
if (error.value) console.log(error.value)
|
|
321
|
-
const key =
|
|
322
|
-
type === "all"
|
|
323
|
-
? "search"
|
|
324
|
-
: "list" + type.charAt(0).toUpperCase() + type.slice(1)
|
|
325
|
-
|
|
326
|
-
if (type === "all") {
|
|
327
|
-
this.results = data?.value?.[key]
|
|
328
|
-
} else {
|
|
329
|
-
const items = data?.value?.[key]?.items ?? []
|
|
330
|
-
this.total = data?.value?.[key]?.total
|
|
331
|
-
result = {
|
|
332
|
-
...data?.value?.[key],
|
|
333
|
-
items: items.map(({ id, ...rest }) => ({
|
|
334
|
-
...rest,
|
|
335
|
-
_path: `/${id}`,
|
|
336
|
-
})),
|
|
337
|
-
}
|
|
338
|
-
$stores[type].items = result["items"]
|
|
339
|
-
|
|
340
|
-
const lastPage = Math.ceil(result.total / itemsPerPage)
|
|
341
|
-
/* this.updateRouteQuery(type) */
|
|
342
|
-
this.setFiltersCount(type)
|
|
343
|
-
this.setBlankFilterLoad(type)
|
|
344
|
-
/* console.log("type2: ", type) */
|
|
345
|
-
$stores[type].numberOfPages = lastPage
|
|
346
|
-
}
|
|
347
|
-
/* console.log("this.total: ", this.total)
|
|
348
|
-
*/
|
|
349
|
-
this.setLoading(false, type)
|
|
350
|
-
return true
|
|
351
|
-
},
|
|
352
|
-
},
|
|
353
|
-
})
|
package/example/.env.example
DELETED
package/example/nuxt.config.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export default defineNuxtConfig({
|
|
2
|
-
modules: ["@paris-ias/list"],
|
|
3
|
-
list: {
|
|
4
|
-
modules: [
|
|
5
|
-
"events",
|
|
6
|
-
"news",
|
|
7
|
-
"people",
|
|
8
|
-
"projects",
|
|
9
|
-
"fellowships",
|
|
10
|
-
"publications",
|
|
11
|
-
],
|
|
12
|
-
},
|
|
13
|
-
runtimeConfig: {
|
|
14
|
-
public: {
|
|
15
|
-
graphqlEndpoint: process.env.GRAPHQL_ENDPOINT,
|
|
16
|
-
graphqlApiKey: process.env.GRAPHQL_API_KEY,
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
})
|
package/example/pages/index.vue
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<h1>List Module Example</h1>
|
|
4
|
-
|
|
5
|
-
<h2>Events</h2>
|
|
6
|
-
<ListOrganismsList type="events" />
|
|
7
|
-
|
|
8
|
-
<h2>News</h2>
|
|
9
|
-
<ListOrganismsList type="news" />
|
|
10
|
-
|
|
11
|
-
<h2>People</h2>
|
|
12
|
-
<ListOrganismsList type="people" />
|
|
13
|
-
|
|
14
|
-
<h2>Publications</h2>
|
|
15
|
-
<ListOrganismsList type="publications" />
|
|
16
|
-
|
|
17
|
-
<h2>Fellowships</h2>
|
|
18
|
-
<ListOrganismsList type="fellowships" />
|
|
19
|
-
|
|
20
|
-
<h2>Projects</h2>
|
|
21
|
-
<ListOrganismsList type="projects" />
|
|
22
|
-
</div>
|
|
23
|
-
</template>
|
|
24
|
-
|
|
25
|
-
<script setup lang="ts">
|
|
26
|
-
// The components are automatically imported by the module
|
|
27
|
-
</script>
|
package/index.ts
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
defineNuxtModule,
|
|
3
|
-
createResolver,
|
|
4
|
-
addComponentsDir,
|
|
5
|
-
addImportsDir,
|
|
6
|
-
addPlugin,
|
|
7
|
-
} from "@nuxt/kit"
|
|
8
|
-
import { fileURLToPath } from "node:url"
|
|
9
|
-
|
|
10
|
-
export interface ModuleOptions {
|
|
11
|
-
modules: string[]
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export default defineNuxtModule<ModuleOptions>({
|
|
15
|
-
meta: {
|
|
16
|
-
name: "@paris-ias/list",
|
|
17
|
-
configKey: "list",
|
|
18
|
-
compatibility: {
|
|
19
|
-
nuxt: "^3.0.0",
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
defaults: {
|
|
23
|
-
modules: [],
|
|
24
|
-
},
|
|
25
|
-
setup(options, nuxt) {
|
|
26
|
-
const { resolve } = createResolver(import.meta.url)
|
|
27
|
-
const runtimeDir = fileURLToPath(new URL("./dist/runtime", import.meta.url))
|
|
28
|
-
|
|
29
|
-
// Add components
|
|
30
|
-
addComponentsDir({
|
|
31
|
-
path: resolve(runtimeDir, "components"),
|
|
32
|
-
global: true,
|
|
33
|
-
})
|
|
34
|
-
// Add store
|
|
35
|
-
nuxt.hook("modules:before", () => {
|
|
36
|
-
nuxt.options.build.transpile.push(resolve(runtimeDir, "stores"))
|
|
37
|
-
})
|
|
38
|
-
// Add composables
|
|
39
|
-
addImportsDir(resolve(runtimeDir, "composables"))
|
|
40
|
-
|
|
41
|
-
// Add graphQL queries
|
|
42
|
-
addImportsDir(resolve(runtimeDir, "graphql"))
|
|
43
|
-
|
|
44
|
-
// Add plugin
|
|
45
|
-
addPlugin(resolve(runtimeDir, "plugins/pinia.ts"))
|
|
46
|
-
addPlugin(resolve(runtimeDir, "plugins/vuetify.js"))
|
|
47
|
-
|
|
48
|
-
// Add translations
|
|
49
|
-
|
|
50
|
-
nuxt.hook("i18n:registerModule", (register) => {
|
|
51
|
-
register({
|
|
52
|
-
// langDir path needs to be resolved
|
|
53
|
-
langDir: resolve(runtimeDir, "translations"),
|
|
54
|
-
locales: [
|
|
55
|
-
{
|
|
56
|
-
code: "en",
|
|
57
|
-
file: "en.json",
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
code: "fr",
|
|
61
|
-
file: "fr.json",
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
})
|
|
65
|
-
})
|
|
66
|
-
nuxt.options.runtimeConfig.public.list = options
|
|
67
|
-
|
|
68
|
-
// Add i18n configuration
|
|
69
|
-
nuxt.options.i18n = {
|
|
70
|
-
...nuxt.options.i18n,
|
|
71
|
-
langDir: resolve(runtimeDir, "translations"),
|
|
72
|
-
lazy: true,
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// Add Apollo configuration
|
|
76
|
-
nuxt.options.apollo = {
|
|
77
|
-
...nuxt.options.apollo,
|
|
78
|
-
clients: {
|
|
79
|
-
default: {
|
|
80
|
-
httpEndpoint: process.env.GRAPHQL_ENDPOINT || "",
|
|
81
|
-
httpLinkOptions: {
|
|
82
|
-
headers: {
|
|
83
|
-
"x-api-key": process.env.GRAPHQL_API_KEY || "",
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// Add Vuetify configuration
|
|
91
|
-
nuxt.options.build.transpile = [
|
|
92
|
-
...(nuxt.options.build.transpile || []),
|
|
93
|
-
"vuetify",
|
|
94
|
-
]
|
|
95
|
-
nuxt.options.css = [
|
|
96
|
-
...(nuxt.options.css || []),
|
|
97
|
-
"vuetify/lib/styles/main.sass",
|
|
98
|
-
]
|
|
99
|
-
|
|
100
|
-
// Add Vite configuration
|
|
101
|
-
nuxt.options.vite = {
|
|
102
|
-
...nuxt.options.vite,
|
|
103
|
-
define: {
|
|
104
|
-
...nuxt.options.vite?.define,
|
|
105
|
-
"process.env.DEBUG": false,
|
|
106
|
-
},
|
|
107
|
-
css: {
|
|
108
|
-
preprocessorOptions: {
|
|
109
|
-
scss: {
|
|
110
|
-
api: "modern-compiler",
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
build: {
|
|
115
|
-
target: "esnext",
|
|
116
|
-
},
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
})
|