Skip to content

Commit a1eeb2e

Browse files
authored
feat: Nuxt 3.18 (#1009)
Related to datagouv/data.gouv.fr#1975
1 parent 994a728 commit a1eeb2e

File tree

15 files changed

+3019
-878
lines changed

15 files changed

+3019
-878
lines changed

components/Organization/ListPage.vue

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@
7878
:page="organizations.page"
7979
:page-size="organizations.page_size"
8080
:total-results="organizations.total"
81-
:link="link"
8281
@change="(p: number) => $emit('change', q, sortParam, p)"
8382
/>
8483
</template>
@@ -91,11 +90,6 @@ import { debouncedRef } from '@vueuse/core'
9190
import type { PaginatedArray, RequestStatus } from '~/types/types'
9291
9392
const props = defineProps<{
94-
/**
95-
* Customize the links used
96-
*/
97-
link?: (page: number) => string
98-
9993
/**
10094
* List of organizations to show
10195
*/

datagouv-components/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
"@remixicon/vue": "^4.5.0",
4343
"@types/hast": "^3.0.4",
4444
"@types/leaflet": "^1.9.17",
45-
"@vueuse/core": "^13.1.0",
46-
"@vueuse/router": "^13.1.0",
45+
"@vueuse/core": "^14.2.1",
46+
"@vueuse/router": "^14.2.1",
4747
"chart.js": "^4.4.8",
4848
"dompurify": "^3.2.5",
4949
"geopf-extensions-openlayers": "^1.0.0-beta.5",
@@ -95,13 +95,13 @@
9595
"typescript": "^5.7.3",
9696
"vite": "^7.0",
9797
"vite-plugin-vue-devtools": "^8.0",
98-
"vue": "^3.5.30",
99-
"vue-router": "^4.6.4",
98+
"vue": "^3.5.31",
99+
"vue-router": "^5.0.4",
100100
"vue-tsc": "^3.0"
101101
},
102102
"peerDependencies": {
103103
"vue": "^3.5.13",
104-
"vue-router": "^4.5.0"
104+
"vue-router": "^4.5.0 || ^5.0.0"
105105
},
106106
"scarfSettings": {
107107
"enabled": false

datagouv-components/src/components/ActivityList/ActivityList.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@
9090
:total-results="activities.total"
9191
:page-size="activities.page_size"
9292
:page="activities.page"
93-
:link="getLink"
9493
@change="(newPage: number) => page = newPage"
9594
/>
9695
</template>
@@ -117,7 +116,6 @@ import { useTranslation } from '../../composables/useTranslation'
117116
import { getActivityTranslation } from '../../functions/activities'
118117
import { useFetch } from '../../functions/api'
119118
import { useFormatDate } from '../../functions/dates'
120-
import { getLink } from '../../functions/pagination'
121119
import type { PaginatedArray } from '../../types/api'
122120
import type { Activity } from '../../types/activity'
123121
import Avatar from '../Avatar.vue'

datagouv-components/src/components/Pagination.vue

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101

102102
<script setup lang="ts">
103103
import { computed, useTemplateRef } from 'vue'
104+
import { useRoute } from 'vue-router'
104105
import { useTranslation } from '../composables/useTranslation'
105106
106107
type Props = {
@@ -112,10 +113,6 @@ type Props = {
112113
* The page size.
113114
*/
114115
pageSize?: number
115-
/**
116-
* Customize the links used
117-
*/
118-
link?: (page: number) => string
119116
/**
120117
* The number of items in the collection. It's used to calculated the number of pages.
121118
*/
@@ -174,6 +171,7 @@ function getVisiblePages(currentPage: number, pageCount: number) {
174171
}
175172
176173
const { t } = useTranslation()
174+
const route = useRoute()
177175
const pageCount = computed(() => Math.ceil(props.totalResults / props.pageSize))
178176
const visiblePages = computed(() => getVisiblePages(props.page, pageCount.value))
179177
@@ -211,6 +209,11 @@ function getHref(forPage: number) {
211209
if (forPage < 1 || forPage > pageCount.value) {
212210
return undefined
213211
}
214-
return props.page === forPage ? undefined : (props.link ? props.link(forPage) : '#')
212+
if (props.page === forPage) {
213+
return undefined
214+
}
215+
const search = new URLSearchParams(route.query as Record<string, string>)
216+
search.set('page', forPage.toFixed(0))
217+
return `${route.path}?${search.toString()}`
215218
}
216219
</script>

datagouv-components/src/components/Search/GlobalSearch.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,6 @@
271271
:page-size
272272
:total-results="results.total"
273273
class="mt-4"
274-
:link="getLink"
275274
@change="changePage"
276275
/>
277276
</div>
@@ -342,7 +341,6 @@ import { useDebouncedRef } from '../../composables/useDebouncedRef'
342341
import { useStableQueryParams } from '../../composables/useStableQueryParams'
343342
import { useComponentsConfig } from '../../config'
344343
import { useFetch } from '../../functions/api'
345-
import { getLink } from '../../functions/pagination'
346344
import type { Dataset } from '../../types/datasets'
347345
import type { Dataservice } from '../../types/dataservices'
348346
import type { Organization } from '../../types/organizations'

datagouv-components/src/functions/pagination.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

datagouv-components/src/main.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ export * from './functions/metrics'
116116
export * from './functions/never'
117117
export * from './functions/organizations'
118118
export * from './functions/owned'
119-
export * from './functions/pagination'
120119
export * from './functions/resources'
121120
export * from './functions/reuses'
122121
export * from './functions/schemas'

nuxt.config.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,14 +203,9 @@ export default defineNuxtConfig({
203203

204204
routeRules: {
205205
'/nuxt-api/oembed': { cors: true },
206-
// @ts-expect-error ssr option is valid but not in Nuxt types (see https://github.com/nuxt/nuxt/issues/15199)
207206
'/*/organizations/': { ssr: true },
208-
// @ts-expect-error ssr option is valid but not in Nuxt types
209207
'/*/posts/': { ssr: true },
210-
// @ts-expect-error ssr option is valid but not in Nuxt types
211208
'/*/posts/**': { ssr: true },
212-
// Admin dashboard renders only on server-side
213-
// @ts-expect-error ssr option is valid but not in Nuxt types
214209
'/*/admin/**': { ssr: true },
215210
},
216211

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"@milkdown/transformer": "^7.19.0",
6464
"@milkdown/vue": "^7.19.0",
6565
"@nuxt/image": "^2.0.0",
66-
"@nuxtjs/sitemap": "^7.6.0",
66+
"@nuxtjs/sitemap": "^8.0.8",
6767
"@prosemirror-adapter/vue": "^0.4.6",
6868
"@remixicon/vue": "^4.9.0",
6969
"@rollup/pluginutils": "^5.3.0",
@@ -79,7 +79,7 @@
7979
"gray-matter": "^4.0.3",
8080
"leaflet": "^1.9.4",
8181
"lodash-es": "^4.17.23",
82-
"nuxt": "~3.17.7",
82+
"nuxt": "~3.18.1",
8383
"nuxt-og-image": "^6.0.6",
8484
"ofetch": "^1.5.1",
8585
"papaparse": "^5.5.3",

pages/design/organization-search.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
<div class="bg-white py-4 px-4 -mx-4">
1616
<OrganizationListPage
1717
v-if="organizations"
18-
:link="getLink"
1918
:organizations
2019
:initial-q="q"
2120
:sort
@@ -27,7 +26,6 @@
2726
</template>
2827

2928
<script setup lang="ts">
30-
import { getLink } from '@datagouv/components-next'
3129
import type { Organization } from '@datagouv/components-next'
3230
import type { LocationQueryValue } from 'vue-router'
3331
import BreadcrumbItem from '~/components/Breadcrumbs/BreadcrumbItem.vue'

0 commit comments

Comments
 (0)