@datagouv/components-next 0.1.1 → 0.1.3
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/{JsonPreview.client-nkpNPvZb.js → JsonPreview.client-D6ptqXOA.js} +1 -1
- package/dist/{MapContainer.client-CrTw-ai8.js → MapContainer.client-D4dQoauJ.js} +1 -1
- package/dist/{PdfPreview.client-JpAWf0A2.js → PdfPreview.client-DTUPMgrP.js} +1 -1
- package/dist/{Pmtiles.client-B83l4Ft5.js → Pmtiles.client-Cx6JUqT9.js} +1843 -1834
- package/dist/Swagger.client-BuBFNfiL.js +4 -0
- package/dist/{XmlPreview.client-DV8N1S9Y.js → XmlPreview.client-DDSXyn0x.js} +2 -2
- package/dist/components-next.css +1 -1
- package/dist/components-next.js +73 -71
- package/dist/components.css +1 -1
- package/dist/{main-CN6IuSUA.js → main-CarU0Io9.js} +7627 -7603
- package/dist/{vue3-xml-viewer.common-9hga4rGF.js → vue3-xml-viewer.common-Cqxs_s2H.js} +1 -1
- package/package.json +1 -1
- package/src/components/ActivityList/ActivityList.vue +5 -3
- package/src/components/DatasetCard.vue +0 -1
- package/src/components/LoadingBlock.vue +26 -0
- package/src/components/ResourceAccordion/Pmtiles.client.vue +19 -2
- package/src/components/ResourceAccordion/ResourceAccordion.vue +1 -0
- package/src/functions/api.ts +3 -2
- package/src/functions/owned.ts +10 -0
- package/src/main.ts +2 -0
- package/dist/Swagger.client-D1TfRQjI.js +0 -4
package/package.json
CHANGED
|
@@ -94,10 +94,10 @@
|
|
|
94
94
|
v-else
|
|
95
95
|
class="flex flex-col items-center"
|
|
96
96
|
>
|
|
97
|
-
<
|
|
98
|
-
src="
|
|
97
|
+
<img
|
|
98
|
+
:src="listSrc"
|
|
99
99
|
class="h-32"
|
|
100
|
-
|
|
100
|
+
>
|
|
101
101
|
<p class="fr-text--bold fr-my-3v">
|
|
102
102
|
{{ t(`Il n'y a pas encore d'activité`) }}
|
|
103
103
|
</p>
|
|
@@ -117,8 +117,10 @@ import { getLink } from '../../functions/pagination'
|
|
|
117
117
|
import type { PaginatedArray } from '../../types/api'
|
|
118
118
|
import type { Activity } from '../../types/activity'
|
|
119
119
|
import Avatar from '../Avatar.vue'
|
|
120
|
+
import LoadingBlock from '../LoadingBlock.vue'
|
|
120
121
|
import Pagination from '../Pagination.vue'
|
|
121
122
|
import PaddedContainer from '../PaddedContainer.vue'
|
|
123
|
+
import listSrc from '../../../../public/illustrations/list.svg?url'
|
|
122
124
|
|
|
123
125
|
const props = defineProps<{
|
|
124
126
|
id?: string
|
|
@@ -165,7 +165,6 @@ import type { Dataset, DatasetV2 } from '../types/datasets'
|
|
|
165
165
|
import { summarize } from '../functions/helpers'
|
|
166
166
|
import { useFormatDate } from '../functions/dates'
|
|
167
167
|
import { getOwnerName } from '../functions/owned'
|
|
168
|
-
import { removeMarkdown } from '../functions/markdown'
|
|
169
168
|
import { getShortDescription } from '../functions/datasets'
|
|
170
169
|
import { useComponentsConfig } from '../config'
|
|
171
170
|
import { useTranslation } from '../composables/useTranslation'
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="relative">
|
|
3
|
+
<div :class="{ 'opacity-50 min-h-64': loading }">
|
|
4
|
+
<slot />
|
|
5
|
+
</div>
|
|
6
|
+
<div
|
|
7
|
+
v-if="loading"
|
|
8
|
+
class="absolute inset-0 flex justify-center items-center min-h-64"
|
|
9
|
+
>
|
|
10
|
+
<AnimatedLoader class="size-24" />
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
import { computed } from 'vue'
|
|
17
|
+
import AnimatedLoader from './AnimatedLoader.vue'
|
|
18
|
+
|
|
19
|
+
const props = defineProps<{
|
|
20
|
+
status: string
|
|
21
|
+
}>()
|
|
22
|
+
|
|
23
|
+
const loading = computed(() => {
|
|
24
|
+
return props.status === 'idle' || props.status === 'pending'
|
|
25
|
+
})
|
|
26
|
+
</script>
|
|
@@ -61,13 +61,15 @@ import { useComponentsConfig } from '../../config'
|
|
|
61
61
|
import { useFormatDate } from '../../functions/dates'
|
|
62
62
|
import { throwOnNever } from '../../functions/never'
|
|
63
63
|
import type { Resource } from '../../types/resources'
|
|
64
|
+
import type { Dataset, DatasetV2 } from '../../types/datasets'
|
|
64
65
|
import BrandedButton from '../BrandedButton.vue'
|
|
65
66
|
import styleVector from '../../../assets/json/vector.json'
|
|
66
67
|
import SimpleBanner from '../SimpleBanner.vue'
|
|
67
68
|
import { useTranslation } from '../../composables/useTranslation'
|
|
68
69
|
import franceSvg from './france.svg?raw'
|
|
70
|
+
import { getOwnerName, getOwnerPage } from '../../functions/owned'
|
|
69
71
|
|
|
70
|
-
const props = defineProps<{ resource: Resource }>()
|
|
72
|
+
const props = defineProps<{ resource: Resource, dataset: Dataset | DatasetV2 }>()
|
|
71
73
|
|
|
72
74
|
const { t } = useTranslation()
|
|
73
75
|
const { formatDate } = useFormatDate()
|
|
@@ -84,6 +86,12 @@ const lastUpdate = computed(() => formatDate(props.resource.extras['analysis:par
|
|
|
84
86
|
|
|
85
87
|
const container = useTemplateRef('containerRef')
|
|
86
88
|
|
|
89
|
+
const attributions = computed(() => {
|
|
90
|
+
if (!props.dataset.organization && !props.dataset.owner)
|
|
91
|
+
return ''
|
|
92
|
+
return `© <a href="${getOwnerPage(props.dataset)}" target="_blank">${getOwnerName(props.dataset)}</a>`
|
|
93
|
+
})
|
|
94
|
+
|
|
87
95
|
async function displayMap() {
|
|
88
96
|
await import('maplibre-gl/dist/maplibre-gl.css')
|
|
89
97
|
|
|
@@ -103,6 +111,15 @@ async function displayMap() {
|
|
|
103
111
|
center: [h.centerLon, h.centerLat],
|
|
104
112
|
})
|
|
105
113
|
map.addControl(new maplibregl.NavigationControl())
|
|
114
|
+
map.addControl(
|
|
115
|
+
new maplibregl.GeolocateControl({
|
|
116
|
+
positionOptions: {
|
|
117
|
+
enableHighAccuracy: true,
|
|
118
|
+
},
|
|
119
|
+
trackUserLocation: true,
|
|
120
|
+
showAccuracyCircle: false,
|
|
121
|
+
}),
|
|
122
|
+
)
|
|
106
123
|
|
|
107
124
|
const popup = new maplibregl.Popup({
|
|
108
125
|
closeButton: false,
|
|
@@ -127,7 +144,7 @@ async function displayMap() {
|
|
|
127
144
|
map.addSource('pmtiles_source', {
|
|
128
145
|
type: 'vector',
|
|
129
146
|
url: `pmtiles://${pmtilesUrl.value}`,
|
|
130
|
-
attribution:
|
|
147
|
+
attribution: attributions.value,
|
|
131
148
|
})
|
|
132
149
|
// @ts-expect-error not typed from library
|
|
133
150
|
metadata.tilestats.layers.forEach((layer) => {
|
package/src/functions/api.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref, toValue, watchEffect, type ComputedRef, type Ref } from 'vue'
|
|
1
|
+
import { reactive, ref, toValue, watchEffect, type ComputedRef, type Ref } from 'vue'
|
|
2
2
|
import { ofetch } from 'ofetch'
|
|
3
3
|
import { useComponentsConfig } from '../config'
|
|
4
4
|
import { useTranslation } from '../composables/useTranslation'
|
|
@@ -23,6 +23,7 @@ export async function useFetch<DataT, ErrorT = never>(
|
|
|
23
23
|
const execute = async (_opts?: AsyncDataExecuteOptions) => {
|
|
24
24
|
const urlValue = toValue(url)
|
|
25
25
|
if (!urlValue) return
|
|
26
|
+
const fetchOptions = reactive(options ?? {})
|
|
26
27
|
status.value = 'pending'
|
|
27
28
|
try {
|
|
28
29
|
data.value = await ofetch(urlValue, {
|
|
@@ -66,7 +67,7 @@ export async function useFetch<DataT, ErrorT = never>(
|
|
|
66
67
|
// TODO Toast outside Nuxt
|
|
67
68
|
// toast.error(message)
|
|
68
69
|
},
|
|
69
|
-
...
|
|
70
|
+
...fetchOptions,
|
|
70
71
|
})
|
|
71
72
|
status.value = 'success'
|
|
72
73
|
}
|
package/src/functions/owned.ts
CHANGED
|
@@ -9,3 +9,13 @@ export function getOwnerName(owned: Owned): string {
|
|
|
9
9
|
}
|
|
10
10
|
return '' // Not supposed to exist but it does...
|
|
11
11
|
}
|
|
12
|
+
|
|
13
|
+
export function getOwnerPage(owned: Owned): string | null {
|
|
14
|
+
if (owned.organization) {
|
|
15
|
+
return owned.organization.page
|
|
16
|
+
}
|
|
17
|
+
else if (owned.owner) {
|
|
18
|
+
return owned.owner.page
|
|
19
|
+
}
|
|
20
|
+
return null // Not supposed to exist but it does...
|
|
21
|
+
}
|
package/src/main.ts
CHANGED
|
@@ -38,6 +38,7 @@ import DatasetQualityScore from './components/DatasetQualityScore.vue'
|
|
|
38
38
|
import DatasetQualityTooltipContent from './components/DatasetQualityTooltipContent.vue'
|
|
39
39
|
import ExtraAccordion from './components/ExtraAccordion.vue'
|
|
40
40
|
import LabelTag from './components/DatasetLabelTag.vue'
|
|
41
|
+
import LoadingBlock from './components/LoadingBlock.vue'
|
|
41
42
|
import OrganizationCard from './components/OrganizationCard.vue'
|
|
42
43
|
import OrganizationNameWithCertificate from './components/OrganizationNameWithCertificate.vue'
|
|
43
44
|
import OwnerType from './components/OwnerType.vue'
|
|
@@ -170,6 +171,7 @@ export {
|
|
|
170
171
|
DateRangeDetails,
|
|
171
172
|
ExtraAccordion,
|
|
172
173
|
LabelTag,
|
|
174
|
+
LoadingBlock,
|
|
173
175
|
OrganizationCard,
|
|
174
176
|
OrganizationNameWithCertificate,
|
|
175
177
|
OwnerType,
|