@datagouv/components-next 1.0.2-dev.2 → 1.0.2-dev.20
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/Datafair.client-Ds3VQrRi.js +30 -0
- package/dist/JsonPreview.client-CYxmz0yV.js +72 -0
- package/dist/{MapContainer.client-DRkAmdOc.js → MapContainer.client-B2BijMx5.js} +35 -38
- package/dist/{PdfPreview.client-C-w6-w44.js → PdfPreview.client-DJBMzrlC.js} +534 -549
- package/dist/{Pmtiles.client-BR7_ldHY.js → Pmtiles.client-C_hvRDuy.js} +574 -579
- package/dist/Swagger.client-B4y0hXME.js +4 -0
- package/dist/XmlPreview.client-LETEfNBH.js +64 -0
- package/dist/components-next.css +3 -3
- package/dist/components-next.js +1 -1
- package/dist/components.css +1 -1
- package/dist/{index-SrYZwgCT.js → index-BFQX7Ccz.js} +1 -1
- package/dist/{main-B2kXxWRG.js → main-vqhkVhVS.js} +34465 -33707
- package/dist/{vue3-xml-viewer.common-BRxsqI9j.js → vue3-xml-viewer.common-BcNJo35o.js} +1 -1
- package/package.json +8 -4
- package/src/components/Form/SearchableSelect.vue +2 -1
- package/src/components/ReadMore.vue +1 -1
- package/src/components/ResourceAccordion/Datafair.client.vue +4 -10
- package/src/components/ResourceAccordion/JsonPreview.client.vue +13 -30
- package/src/components/ResourceAccordion/MapContainer.client.vue +7 -11
- package/src/components/ResourceAccordion/PdfPreview.client.vue +13 -29
- package/src/components/ResourceAccordion/Pmtiles.client.vue +5 -10
- package/src/components/ResourceAccordion/Preview.vue +5 -10
- package/src/components/ResourceAccordion/PreviewLoader.vue +1 -2
- package/src/components/ResourceAccordion/PreviewUnavailable.vue +22 -0
- package/src/components/ResourceAccordion/XmlPreview.client.vue +13 -30
- package/src/components/ResourceExplorer/ResourceExplorer.vue +21 -10
- package/src/components/ResourceExplorer/ResourceExplorerViewer.vue +12 -1
- package/src/composables/useResourceCapabilities.ts +1 -1
- package/src/types/organizations.ts +1 -1
- package/dist/Datafair.client-E5D6ePRC.js +0 -35
- package/dist/JsonPreview.client-C-6eBbPw.js +0 -87
- package/dist/Swagger.client-D4-F6yEf.js +0 -4
- package/dist/XmlPreview.client-Dl2VCgXF.js +0 -79
- /package/assets/illustrations/{_microscope.svg → microscope.svg} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datagouv/components-next",
|
|
3
|
-
"version": "1.0.2-dev.
|
|
3
|
+
"version": "1.0.2-dev.20",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@floating-ui/vue": "^1.1.8",
|
|
20
|
-
"@types/leaflet": "^1.9.17",
|
|
21
20
|
"@headlessui/vue": "^1.7.23",
|
|
22
21
|
"@remixicon/vue": "^4.5.0",
|
|
23
22
|
"@types/hast": "^3.0.4",
|
|
23
|
+
"@types/leaflet": "^1.9.17",
|
|
24
24
|
"@vueuse/core": "^13.1.0",
|
|
25
25
|
"@vueuse/router": "^13.1.0",
|
|
26
26
|
"chart.js": "^4.4.8",
|
|
@@ -48,9 +48,7 @@
|
|
|
48
48
|
"swagger-ui-dist": "^5.27.1",
|
|
49
49
|
"unified": "^11.0.5",
|
|
50
50
|
"unist-util-visit": "^5.0.0",
|
|
51
|
-
"vue": "^3.5.13",
|
|
52
51
|
"vue-content-loader": "^2.0.1",
|
|
53
|
-
"vue-router": "^4.5.0",
|
|
54
52
|
"vue-sonner": "^2.0.9",
|
|
55
53
|
"vue3-json-viewer": "^2.4.1",
|
|
56
54
|
"vue3-text-clamp": "^0.1.2",
|
|
@@ -76,8 +74,14 @@
|
|
|
76
74
|
"typescript": "^5.7.3",
|
|
77
75
|
"vite": "^7.0",
|
|
78
76
|
"vite-plugin-vue-devtools": "^8.0",
|
|
77
|
+
"vue": "^3.5.29",
|
|
78
|
+
"vue-router": "^4.6.4",
|
|
79
79
|
"vue-tsc": "^3.0"
|
|
80
80
|
},
|
|
81
|
+
"peerDependencies": {
|
|
82
|
+
"vue": "^3.5.13",
|
|
83
|
+
"vue-router": "^4.5.0"
|
|
84
|
+
},
|
|
81
85
|
"scarfSettings": {
|
|
82
86
|
"enabled": false
|
|
83
87
|
},
|
|
@@ -10,8 +10,9 @@
|
|
|
10
10
|
:class="{ 'sr-only': hideLabel }"
|
|
11
11
|
>
|
|
12
12
|
{{ label }}
|
|
13
|
+
<!-- $props needed: in generic components, vue-tsc resolves `required` to the Nuxt auto-imported function instead of the prop -->
|
|
13
14
|
<span
|
|
14
|
-
v-if="required"
|
|
15
|
+
v-if="$props.required"
|
|
15
16
|
class="text-new-primary"
|
|
16
17
|
>*</span>
|
|
17
18
|
<span
|
|
@@ -9,21 +9,15 @@
|
|
|
9
9
|
border: none;"
|
|
10
10
|
/>
|
|
11
11
|
</div>
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class="flex items-center space-x-2"
|
|
16
|
-
>
|
|
17
|
-
<RiErrorWarningLine class="shrink-0 size-6" />
|
|
18
|
-
<span>{{ t("Erreur lors de l'affichage de l'aperçu.") }}</span>
|
|
19
|
-
</SimpleBanner>
|
|
12
|
+
<PreviewUnavailable v-else>
|
|
13
|
+
{{ t("L'aperçu de ce fichier n'a pas pu être chargé. Téléchargez-le depuis l'onglet Téléchargements.") }}
|
|
14
|
+
</PreviewUnavailable>
|
|
20
15
|
</div>
|
|
21
16
|
</template>
|
|
22
17
|
|
|
23
18
|
<script setup lang="ts">
|
|
24
19
|
import { computed } from 'vue'
|
|
25
|
-
import
|
|
26
|
-
import SimpleBanner from '../SimpleBanner.vue'
|
|
20
|
+
import PreviewUnavailable from './PreviewUnavailable.vue'
|
|
27
21
|
import type { Resource } from '../../types/resources'
|
|
28
22
|
import type { Dataset, DatasetV2 } from '../../types/datasets'
|
|
29
23
|
import { useTranslation } from '../../composables/useTranslation'
|
|
@@ -17,42 +17,25 @@
|
|
|
17
17
|
>
|
|
18
18
|
{{ t("Chargement de l'aperçu JSON...") }}
|
|
19
19
|
</div>
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
v-else-if="error === 'network'"
|
|
33
|
-
type="warning"
|
|
34
|
-
class="flex items-center space-x-2"
|
|
35
|
-
>
|
|
36
|
-
<RiErrorWarningLine class="shrink-0 size-6" />
|
|
37
|
-
<span>{{ t("Ce fichier JSON ne peut pas être prévisualisé, peut-être parce qu'il est hébergé sur un autre site qui ne l'autorise pas. Pour le consulter, téléchargez-le en cliquant sur le bouton bleu ou depuis l'onglet Téléchargements.") }}</span>
|
|
38
|
-
</SimpleBanner>
|
|
39
|
-
<SimpleBanner
|
|
40
|
-
v-else-if="error"
|
|
41
|
-
type="warning"
|
|
42
|
-
class="flex items-center space-x-2"
|
|
43
|
-
>
|
|
44
|
-
<RiErrorWarningLine class="shrink-0 size-6" />
|
|
45
|
-
<span>{{ t("Erreur lors du chargement de l'aperçu JSON.") }}</span>
|
|
46
|
-
</SimpleBanner>
|
|
20
|
+
<PreviewUnavailable v-else-if="fileTooLarge">
|
|
21
|
+
{{ fileSizeBytes
|
|
22
|
+
? t("Le fichier JSON est trop volumineux pour être prévisualisé. Téléchargez-le depuis l'onglet Téléchargements.")
|
|
23
|
+
: t("La taille du fichier est inconnue, l'aperçu n'est pas disponible. Téléchargez-le depuis l'onglet Téléchargements.")
|
|
24
|
+
}}
|
|
25
|
+
</PreviewUnavailable>
|
|
26
|
+
<PreviewUnavailable v-else-if="error === 'network'">
|
|
27
|
+
{{ t("Ce fichier est hébergé sur un site externe qui ne permet pas la prévisualisation. Téléchargez-le depuis l'onglet Téléchargements.") }}
|
|
28
|
+
</PreviewUnavailable>
|
|
29
|
+
<PreviewUnavailable v-else-if="error">
|
|
30
|
+
{{ t("L'aperçu de ce fichier n'a pas pu être chargé. Téléchargez-le depuis l'onglet Téléchargements.") }}
|
|
31
|
+
</PreviewUnavailable>
|
|
47
32
|
</div>
|
|
48
33
|
</template>
|
|
49
34
|
|
|
50
35
|
<script setup lang="ts">
|
|
51
36
|
import { computed, defineAsyncComponent, onMounted, ref } from 'vue'
|
|
52
|
-
import { RiErrorWarningLine } from '@remixicon/vue'
|
|
53
|
-
|
|
54
37
|
import { useComponentsConfig } from '../../config'
|
|
55
|
-
import
|
|
38
|
+
import PreviewUnavailable from './PreviewUnavailable.vue'
|
|
56
39
|
import type { Resource } from '../../types/resources'
|
|
57
40
|
import { useTranslation } from '../../composables/useTranslation'
|
|
58
41
|
import { getResourceFilesize } from '../../functions/datasets'
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class="flex items-center space-x-2"
|
|
6
|
-
>
|
|
7
|
-
<RiErrorWarningLine class="shrink-0 size-6" />
|
|
8
|
-
<span>{{ t("L'aperçu cartographique de ce fichier n'a pas pu être chargé.") }}</span>
|
|
9
|
-
</SimpleBanner>
|
|
2
|
+
<PreviewUnavailable v-if="hasError">
|
|
3
|
+
{{ t("L'aperçu cartographique de ce fichier n'a pas pu être chargé.") }}
|
|
4
|
+
</PreviewUnavailable>
|
|
10
5
|
<div
|
|
11
6
|
v-else
|
|
12
7
|
id="map"
|
|
@@ -16,9 +11,7 @@
|
|
|
16
11
|
|
|
17
12
|
<script setup lang = "ts">
|
|
18
13
|
import { onMounted, ref, useTemplateRef } from 'vue'
|
|
19
|
-
import
|
|
20
|
-
|
|
21
|
-
import SimpleBanner from '../SimpleBanner.vue'
|
|
14
|
+
import PreviewUnavailable from './PreviewUnavailable.vue'
|
|
22
15
|
import type { Resource } from '../../types/resources'
|
|
23
16
|
import { useTranslation } from '../../composables/useTranslation'
|
|
24
17
|
|
|
@@ -96,7 +89,10 @@ async function displayMap() {
|
|
|
96
89
|
|
|
97
90
|
const attributions = new GeoportalAttribution({
|
|
98
91
|
position: 'bottom-right',
|
|
92
|
+
// collapsed option is ignored by the library, thus the override below
|
|
93
|
+
// see https://github.com/IGNF/geopf-extensions-openlayers/issues/497
|
|
99
94
|
})
|
|
95
|
+
attributions.setCollapsed(false)
|
|
100
96
|
map.addControl(attributions)
|
|
101
97
|
|
|
102
98
|
const layerImport = new LayerImport({
|
|
@@ -18,43 +18,27 @@
|
|
|
18
18
|
>
|
|
19
19
|
{{ t("Chargement de l'aperçu PDF...") }}
|
|
20
20
|
</div>
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
v-else-if="error === 'network'"
|
|
34
|
-
type="warning"
|
|
35
|
-
class="flex items-center space-x-2"
|
|
36
|
-
>
|
|
37
|
-
<RiErrorWarningLine class="flex-none size-6" />
|
|
38
|
-
<span>{{ t("Ce fichier PDF ne peut pas être prévisualisé, peut-être parce qu'il est hébergé sur un autre site qui ne l'autorise pas. Pour le consulter, téléchargez-le en cliquant sur le bouton bleu ou depuis l'onglet Téléchargements.") }}</span>
|
|
39
|
-
</SimpleBanner>
|
|
40
|
-
<SimpleBanner
|
|
41
|
-
v-else-if="error"
|
|
42
|
-
type="warning"
|
|
43
|
-
class="flex items-center space-x-2"
|
|
44
|
-
>
|
|
45
|
-
<RiErrorWarningLine class="flex-none size-6" />
|
|
46
|
-
<span>{{ t("Erreur lors du chargement de l'aperçu PDF. Pour consulter le fichier, téléchargez-le depuis l'onglet Téléchargements.") }}</span>
|
|
47
|
-
</SimpleBanner>
|
|
21
|
+
<PreviewUnavailable v-else-if="fileTooLarge">
|
|
22
|
+
{{ fileSizeBytes
|
|
23
|
+
? t("Le fichier PDF est trop volumineux pour être prévisualisé. Téléchargez-le depuis l'onglet Téléchargements.")
|
|
24
|
+
: t("La taille du fichier est inconnue, l'aperçu n'est pas disponible. Téléchargez-le depuis l'onglet Téléchargements.")
|
|
25
|
+
}}
|
|
26
|
+
</PreviewUnavailable>
|
|
27
|
+
<PreviewUnavailable v-else-if="error === 'network'">
|
|
28
|
+
{{ t("Ce fichier est hébergé sur un site externe qui ne permet pas la prévisualisation. Téléchargez-le depuis l'onglet Téléchargements.") }}
|
|
29
|
+
</PreviewUnavailable>
|
|
30
|
+
<PreviewUnavailable v-else-if="error">
|
|
31
|
+
{{ t("L'aperçu de ce fichier n'a pas pu être chargé. Téléchargez-le depuis l'onglet Téléchargements.") }}
|
|
32
|
+
</PreviewUnavailable>
|
|
48
33
|
</div>
|
|
49
34
|
</template>
|
|
50
35
|
|
|
51
36
|
<script setup lang="ts">
|
|
52
37
|
import { computed, nextTick, onBeforeUnmount, onMounted, ref } from 'vue'
|
|
53
|
-
import { RiErrorWarningLine } from '@remixicon/vue'
|
|
54
38
|
import * as pdfjsLib from 'pdfjs-dist'
|
|
55
39
|
import pdfjsWorker from 'pdfjs-dist/build/pdf.worker.min.mjs?url'
|
|
56
40
|
import type { PDFDocumentProxy } from 'pdfjs-dist'
|
|
57
|
-
import
|
|
41
|
+
import PreviewUnavailable from './PreviewUnavailable.vue'
|
|
58
42
|
import { useComponentsConfig } from '../../config'
|
|
59
43
|
import type { Resource } from '../../types/resources'
|
|
60
44
|
import { useTranslation } from '../../composables/useTranslation'
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class="flex items-center space-x-2"
|
|
7
|
-
>
|
|
8
|
-
<RiErrorWarningLine class="shrink-0 size-6" />
|
|
9
|
-
<span>{{ t("L'aperçu cartographique de ce fichier n'a pas pu être chargé.") }}</span>
|
|
10
|
-
</SimpleBanner>
|
|
3
|
+
<PreviewUnavailable v-if="hasError">
|
|
4
|
+
{{ t("L'aperçu cartographique de ce fichier n'a pas pu être chargé.") }}
|
|
5
|
+
</PreviewUnavailable>
|
|
11
6
|
<div
|
|
12
7
|
v-else
|
|
13
8
|
class="-mx-4"
|
|
@@ -53,7 +48,7 @@
|
|
|
53
48
|
|
|
54
49
|
<script setup lang="ts">
|
|
55
50
|
import { computed, onMounted, ref, useTemplateRef } from 'vue'
|
|
56
|
-
import {
|
|
51
|
+
import { RiExternalLinkFill } from '@remixicon/vue'
|
|
57
52
|
import { Protocol, PMTiles } from 'pmtiles'
|
|
58
53
|
import maplibregl from 'maplibre-gl'
|
|
59
54
|
import DOMPurify from 'dompurify'
|
|
@@ -64,7 +59,7 @@ import type { Resource } from '../../types/resources'
|
|
|
64
59
|
import type { Dataset, DatasetV2 } from '../../types/datasets'
|
|
65
60
|
import BrandedButton from '../BrandedButton.vue'
|
|
66
61
|
import styleVector from '../../../assets/json/vector.json'
|
|
67
|
-
import
|
|
62
|
+
import PreviewUnavailable from './PreviewUnavailable.vue'
|
|
68
63
|
import { useTranslation } from '../../composables/useTranslation'
|
|
69
64
|
import franceSvg from './france.svg?raw'
|
|
70
65
|
import { getOwnerName, getOwnerPage } from '../../functions/owned'
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class="flex items-center space-x-2"
|
|
7
|
-
>
|
|
8
|
-
<RiErrorWarningLine class="shrink-0 size-6" />
|
|
9
|
-
<span>{{ t("L'aperçu de ce fichier n'a pas pu être chargé.") }}</span>
|
|
10
|
-
</SimpleBanner>
|
|
3
|
+
<PreviewUnavailable v-if="hasError">
|
|
4
|
+
{{ t("L'aperçu de ce fichier n'a pas pu être chargé. Téléchargez-le depuis l'onglet Téléchargements.") }}
|
|
5
|
+
</PreviewUnavailable>
|
|
11
6
|
<PreviewLoader v-else-if="loading" />
|
|
12
7
|
<div
|
|
13
8
|
v-else
|
|
@@ -105,7 +100,7 @@
|
|
|
105
100
|
|
|
106
101
|
<script setup lang="ts">
|
|
107
102
|
import { computed, onMounted, ref } from 'vue'
|
|
108
|
-
import { RiArrowDownLine, RiArrowUpLine,
|
|
103
|
+
import { RiArrowDownLine, RiArrowUpLine, RiExternalLinkFill } from '@remixicon/vue'
|
|
109
104
|
import Pagination from '../Pagination.vue'
|
|
110
105
|
import { getData, type SortConfig } from '../../functions/tabularApi'
|
|
111
106
|
import { useFormatDate } from '../../functions/dates'
|
|
@@ -113,7 +108,7 @@ import { trackEvent } from '../../functions/matomo'
|
|
|
113
108
|
import type { Resource } from '../../types/resources'
|
|
114
109
|
import { useComponentsConfig } from '../../config'
|
|
115
110
|
import BrandedButton from '../BrandedButton.vue'
|
|
116
|
-
import
|
|
111
|
+
import PreviewUnavailable from './PreviewUnavailable.vue'
|
|
117
112
|
import { useTranslation } from '../../composables/useTranslation'
|
|
118
113
|
import franceSvg from './france.svg?raw'
|
|
119
114
|
import PreviewLoader from './PreviewLoader.vue'
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex flex-col items-center py-12">
|
|
3
|
+
<img
|
|
4
|
+
:src="microscopeSrc"
|
|
5
|
+
class="h-20 mb-3"
|
|
6
|
+
alt=""
|
|
7
|
+
>
|
|
8
|
+
<p class="fr-text--bold mb-1">
|
|
9
|
+
{{ t("Aucun aperçu disponible") }}
|
|
10
|
+
</p>
|
|
11
|
+
<p class="text-sm text-gray-medium mb-0 text-center max-w-lg">
|
|
12
|
+
<slot />
|
|
13
|
+
</p>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script setup lang="ts">
|
|
18
|
+
import { useTranslation } from '../../composables/useTranslation'
|
|
19
|
+
import microscopeSrc from '../../../assets/illustrations/microscope.svg?url'
|
|
20
|
+
|
|
21
|
+
const { t } = useTranslation()
|
|
22
|
+
</script>
|
|
@@ -9,42 +9,25 @@
|
|
|
9
9
|
>
|
|
10
10
|
{{ t("Chargement de l'aperçu XML...") }}
|
|
11
11
|
</div>
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
v-else-if="error === 'network'"
|
|
25
|
-
type="warning"
|
|
26
|
-
class="flex items-center space-x-2"
|
|
27
|
-
>
|
|
28
|
-
<RiErrorWarningLine class="shrink-0 size-6" />
|
|
29
|
-
<span>{{ t("Ce fichier XML ne peut pas être prévisualisé, peut-être parce qu'il est hébergé sur un autre site qui ne l'autorise pas. Pour le consulter, téléchargez-le en cliquant sur le bouton bleu ou depuis l'onglet Téléchargements.") }}</span>
|
|
30
|
-
</SimpleBanner>
|
|
31
|
-
<SimpleBanner
|
|
32
|
-
v-else-if="error"
|
|
33
|
-
type="warning"
|
|
34
|
-
class="flex items-center space-x-2"
|
|
35
|
-
>
|
|
36
|
-
<RiErrorWarningLine class="shrink-0 size-6" />
|
|
37
|
-
<span>{{ t("Erreur lors du chargement de l'aperçu XML.") }}</span>
|
|
38
|
-
</SimpleBanner>
|
|
12
|
+
<PreviewUnavailable v-else-if="fileTooLarge">
|
|
13
|
+
{{ fileSizeBytes
|
|
14
|
+
? t("Le fichier XML est trop volumineux pour être prévisualisé. Téléchargez-le depuis l'onglet Téléchargements.")
|
|
15
|
+
: t("La taille du fichier est inconnue, l'aperçu n'est pas disponible. Téléchargez-le depuis l'onglet Téléchargements.")
|
|
16
|
+
}}
|
|
17
|
+
</PreviewUnavailable>
|
|
18
|
+
<PreviewUnavailable v-else-if="error === 'network'">
|
|
19
|
+
{{ t("Ce fichier est hébergé sur un site externe qui ne permet pas la prévisualisation. Téléchargez-le depuis l'onglet Téléchargements.") }}
|
|
20
|
+
</PreviewUnavailable>
|
|
21
|
+
<PreviewUnavailable v-else-if="error">
|
|
22
|
+
{{ t("L'aperçu de ce fichier n'a pas pu être chargé. Téléchargez-le depuis l'onglet Téléchargements.") }}
|
|
23
|
+
</PreviewUnavailable>
|
|
39
24
|
</div>
|
|
40
25
|
</template>
|
|
41
26
|
|
|
42
27
|
<script setup lang="ts">
|
|
43
28
|
import { computed, defineAsyncComponent, onMounted, ref } from 'vue'
|
|
44
|
-
import { RiErrorWarningLine } from '@remixicon/vue'
|
|
45
|
-
|
|
46
29
|
import { useComponentsConfig } from '../../config'
|
|
47
|
-
import
|
|
30
|
+
import PreviewUnavailable from './PreviewUnavailable.vue'
|
|
48
31
|
import type { Resource } from '../../types/resources'
|
|
49
32
|
import { useTranslation } from '../../composables/useTranslation'
|
|
50
33
|
import '../../types/vue3-xml-viewer.d'
|
|
@@ -159,6 +159,22 @@ watch(searchDebounced, () => {
|
|
|
159
159
|
}
|
|
160
160
|
})
|
|
161
161
|
|
|
162
|
+
// Separate useFetch for loadMore, initialized at setup time with immediate: false
|
|
163
|
+
// so that it doesn't fetch until execute() is called from the event handler.
|
|
164
|
+
const loadMoreType = ref<ResourceType>('main')
|
|
165
|
+
const loadMorePage = ref(1)
|
|
166
|
+
const loadMoreParams = computed(() => ({
|
|
167
|
+
type: loadMoreType.value,
|
|
168
|
+
page_size: PAGE_SIZE,
|
|
169
|
+
page: loadMorePage.value,
|
|
170
|
+
q: searchDebounced.value || undefined,
|
|
171
|
+
}))
|
|
172
|
+
const { data: loadMoreData, execute: executeLoadMore } = await useFetch<PaginatedArray<Resource>>(url, {
|
|
173
|
+
params: loadMoreParams,
|
|
174
|
+
immediate: false,
|
|
175
|
+
watch: false,
|
|
176
|
+
})
|
|
177
|
+
|
|
162
178
|
const loadMore = async (type: ResourceType) => {
|
|
163
179
|
const index = RESOURCE_TYPE.indexOf(type)
|
|
164
180
|
if (index === -1) return
|
|
@@ -166,17 +182,12 @@ const loadMore = async (type: ResourceType) => {
|
|
|
166
182
|
const extraRef = extraResourcesByType[index]!
|
|
167
183
|
pageRef.value++
|
|
168
184
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
page_size: PAGE_SIZE,
|
|
173
|
-
page: pageRef.value,
|
|
174
|
-
q: searchDebounced.value || undefined,
|
|
175
|
-
},
|
|
176
|
-
})
|
|
185
|
+
loadMoreType.value = type
|
|
186
|
+
loadMorePage.value = pageRef.value
|
|
187
|
+
await executeLoadMore()
|
|
177
188
|
|
|
178
|
-
if (
|
|
179
|
-
extraRef.value = [...extraRef.value, ...
|
|
189
|
+
if (loadMoreData.value) {
|
|
190
|
+
extraRef.value = [...extraRef.value, ...loadMoreData.value.data]
|
|
180
191
|
}
|
|
181
192
|
}
|
|
182
193
|
|
|
@@ -17,6 +17,12 @@
|
|
|
17
17
|
/>
|
|
18
18
|
</div>
|
|
19
19
|
<div class="text-gray-medium text-xs flex items-center gap-1">
|
|
20
|
+
<SchemaBadge :resource />
|
|
21
|
+
<RiSubtractLine
|
|
22
|
+
v-if="resource.schema"
|
|
23
|
+
aria-hidden="true"
|
|
24
|
+
class="size-3 fill-gray-medium"
|
|
25
|
+
/>
|
|
20
26
|
<span>{{ t('mis à jour {date}', { date: formatRelativeIfRecentDate(resource.last_modified) }) }}</span>
|
|
21
27
|
<RiSubtractLine
|
|
22
28
|
aria-hidden="true"
|
|
@@ -133,9 +139,12 @@
|
|
|
133
139
|
:url="resource.extras['apidocUrl'] as string"
|
|
134
140
|
/>
|
|
135
141
|
<Preview
|
|
136
|
-
v-else
|
|
142
|
+
v-else-if="hasTabularData"
|
|
137
143
|
:resource="resource"
|
|
138
144
|
/>
|
|
145
|
+
<PreviewUnavailable v-else>
|
|
146
|
+
{{ t("Ce fichier ne peut pas être prévisualisé. Téléchargez-le depuis l'onglet Téléchargements.") }}
|
|
147
|
+
</PreviewUnavailable>
|
|
139
148
|
</div>
|
|
140
149
|
<div v-if="tab.key === 'description'">
|
|
141
150
|
<MarkdownViewer
|
|
@@ -298,6 +307,7 @@
|
|
|
298
307
|
<script setup lang="ts">
|
|
299
308
|
import { computed, defineAsyncComponent } from 'vue'
|
|
300
309
|
import { RiDownloadLine, RiFileCopyLine, RiFileWarningLine, RiInformationLine, RiSubtractLine } from '@remixicon/vue'
|
|
310
|
+
import PreviewUnavailable from '../ResourceAccordion/PreviewUnavailable.vue'
|
|
301
311
|
import { toast } from 'vue-sonner'
|
|
302
312
|
import BrandedButton from '../BrandedButton.vue'
|
|
303
313
|
import CopyButton from '../CopyButton.vue'
|
|
@@ -313,6 +323,7 @@ import Tooltip from '../Tooltip.vue'
|
|
|
313
323
|
import Preview from '../ResourceAccordion/Preview.vue'
|
|
314
324
|
import DataStructure from '../ResourceAccordion/DataStructure.vue'
|
|
315
325
|
import Metadata from '../ResourceAccordion/Metadata.vue'
|
|
326
|
+
import SchemaBadge from '../ResourceAccordion/SchemaBadge.vue'
|
|
316
327
|
import { filesize, summarize } from '../../functions/helpers'
|
|
317
328
|
import { getResourceFormatIcon } from '../../functions/resources'
|
|
318
329
|
import { getResourceExternalUrl, getResourceFilesize } from '../../functions/datasets'
|
|
@@ -88,7 +88,7 @@ export function useResourceCapabilities(
|
|
|
88
88
|
if (hasTabularData.value) {
|
|
89
89
|
options.push({ key: 'data', label: t('Données') })
|
|
90
90
|
}
|
|
91
|
-
else
|
|
91
|
+
else {
|
|
92
92
|
options.push({ key: 'data', label: t('Aperçu') })
|
|
93
93
|
}
|
|
94
94
|
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { defineComponent as f, computed as a, createElementBlock as o, openBlock as t, createBlock as p, createElementVNode as i, withCtx as m, createVNode as _, unref as c, toDisplayString as x } from "vue";
|
|
2
|
-
import { a as h, _ as v, F as g } from "./main-B2kXxWRG.js";
|
|
3
|
-
const k = { class: "fr-text--xs" }, b = { key: 0 }, y = ["src"], B = /* @__PURE__ */ f({
|
|
4
|
-
__name: "Datafair.client",
|
|
5
|
-
props: {
|
|
6
|
-
resource: {},
|
|
7
|
-
dataset: {}
|
|
8
|
-
},
|
|
9
|
-
setup(d) {
|
|
10
|
-
const e = d, { t: l } = h(), r = a(() => e.resource.extras.datafairOrigin || e.dataset.extras.datafairOrigin), s = a(() => e.resource.extras.datafairDatasetId || e.dataset.extras.datafairDatasetId), u = a(() => e.resource.extras.datafairEmbed), n = a(() => !r.value || !s.value ? null : `${r.value}/embed/dataset/${s.value}/${u.value}`);
|
|
11
|
-
return (D, E) => (t(), o("div", k, [
|
|
12
|
-
n.value ? (t(), o("div", b, [
|
|
13
|
-
i("iframe", {
|
|
14
|
-
src: n.value,
|
|
15
|
-
width: "100%",
|
|
16
|
-
height: "500px",
|
|
17
|
-
style: { "background-color": "transparent", border: "none" }
|
|
18
|
-
}, null, 8, y)
|
|
19
|
-
])) : (t(), p(v, {
|
|
20
|
-
key: 1,
|
|
21
|
-
type: "warning",
|
|
22
|
-
class: "flex items-center space-x-2"
|
|
23
|
-
}, {
|
|
24
|
-
default: m(() => [
|
|
25
|
-
_(c(g), { class: "shrink-0 size-6" }),
|
|
26
|
-
i("span", null, x(c(l)("Erreur lors de l'affichage de l'aperçu.")), 1)
|
|
27
|
-
]),
|
|
28
|
-
_: 1
|
|
29
|
-
}))
|
|
30
|
-
]));
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
export {
|
|
34
|
-
B as default
|
|
35
|
-
};
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { defineComponent as S, defineAsyncComponent as b, ref as o, computed as w, onMounted as N, createElementBlock as p, openBlock as r, createBlock as f, createCommentVNode as T, createVNode as u, unref as t, toDisplayString as i, withCtx as d, createElementVNode as h } from "vue";
|
|
2
|
-
import { u as P, a as E, g as q, _ as m, F as v } from "./main-B2kXxWRG.js";
|
|
3
|
-
const B = { class: "fr-text--xs" }, O = { key: 0 }, V = {
|
|
4
|
-
key: 1,
|
|
5
|
-
class: "text-gray-medium"
|
|
6
|
-
}, L = /* @__PURE__ */ S({
|
|
7
|
-
__name: "JsonPreview.client",
|
|
8
|
-
props: {
|
|
9
|
-
resource: {}
|
|
10
|
-
},
|
|
11
|
-
setup(k) {
|
|
12
|
-
const z = b(
|
|
13
|
-
() => import("./vue3-json-viewer-BXwup7nO.js").then((e) => (Promise.resolve({ }), e.JsonViewer))
|
|
14
|
-
), g = k, x = P(), { t: s } = E(), l = o(null), c = o(!1), n = o(null), _ = o(!1), y = w(() => q(g.resource)), J = w(() => {
|
|
15
|
-
const e = y.value;
|
|
16
|
-
if (!e || !x.maxJsonPreviewCharSize)
|
|
17
|
-
return !1;
|
|
18
|
-
const a = x.maxJsonPreviewCharSize;
|
|
19
|
-
return e <= a;
|
|
20
|
-
}), C = async () => {
|
|
21
|
-
if (!J.value) {
|
|
22
|
-
_.value = !0;
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
c.value = !0, n.value = null;
|
|
26
|
-
try {
|
|
27
|
-
const e = await fetch(g.resource.url);
|
|
28
|
-
if (!e.ok)
|
|
29
|
-
throw new Error(`HTTP error! status: ${e.status}`);
|
|
30
|
-
const a = await e.json();
|
|
31
|
-
l.value = a;
|
|
32
|
-
} catch (e) {
|
|
33
|
-
console.error("Error loading JSON:", e), e instanceof TypeError ? n.value = "network" : n.value = "generic", l.value = null;
|
|
34
|
-
} finally {
|
|
35
|
-
c.value = !1;
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
return N(() => {
|
|
39
|
-
C();
|
|
40
|
-
}), (e, a) => (r(), p("div", B, [
|
|
41
|
-
l.value ? (r(), p("div", O, [
|
|
42
|
-
u(t(z), {
|
|
43
|
-
value: l.value,
|
|
44
|
-
boxed: "",
|
|
45
|
-
sort: "",
|
|
46
|
-
theme: "light",
|
|
47
|
-
"max-depth": 3,
|
|
48
|
-
"expand-depth": 2,
|
|
49
|
-
"indent-width": 2
|
|
50
|
-
}, null, 8, ["value"])
|
|
51
|
-
])) : c.value ? (r(), p("div", V, i(t(s)("Chargement de l'aperçu JSON...")), 1)) : _.value ? (r(), f(m, {
|
|
52
|
-
key: 2,
|
|
53
|
-
type: "warning",
|
|
54
|
-
class: "flex items-center space-x-2"
|
|
55
|
-
}, {
|
|
56
|
-
default: d(() => [
|
|
57
|
-
u(t(v), { class: "shrink-0 size-6" }),
|
|
58
|
-
h("span", null, i(y.value ? t(s)("Fichier JSON trop volumineux pour l'aperçu. Pour consulter le fichier complet, téléchargez-le en cliquant sur le bouton bleu ou depuis l'onglet Téléchargements.") : t(s)("L'aperçu n'est pas disponible car la taille du fichier est inconnue. Pour consulter le fichier complet, téléchargez-le en cliquant sur le bouton bleu ou depuis l'onglet Téléchargements.")), 1)
|
|
59
|
-
]),
|
|
60
|
-
_: 1
|
|
61
|
-
})) : n.value === "network" ? (r(), f(m, {
|
|
62
|
-
key: 3,
|
|
63
|
-
type: "warning",
|
|
64
|
-
class: "flex items-center space-x-2"
|
|
65
|
-
}, {
|
|
66
|
-
default: d(() => [
|
|
67
|
-
u(t(v), { class: "shrink-0 size-6" }),
|
|
68
|
-
h("span", null, i(t(s)("Ce fichier JSON ne peut pas être prévisualisé, peut-être parce qu'il est hébergé sur un autre site qui ne l'autorise pas. Pour le consulter, téléchargez-le en cliquant sur le bouton bleu ou depuis l'onglet Téléchargements.")), 1)
|
|
69
|
-
]),
|
|
70
|
-
_: 1
|
|
71
|
-
})) : n.value ? (r(), f(m, {
|
|
72
|
-
key: 4,
|
|
73
|
-
type: "warning",
|
|
74
|
-
class: "flex items-center space-x-2"
|
|
75
|
-
}, {
|
|
76
|
-
default: d(() => [
|
|
77
|
-
u(t(v), { class: "shrink-0 size-6" }),
|
|
78
|
-
h("span", null, i(t(s)("Erreur lors du chargement de l'aperçu JSON.")), 1)
|
|
79
|
-
]),
|
|
80
|
-
_: 1
|
|
81
|
-
})) : T("", !0)
|
|
82
|
-
]));
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
export {
|
|
86
|
-
L as default
|
|
87
|
-
};
|