@datagouv/components-next 1.1.2 → 1.3.0

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.
Files changed (62) hide show
  1. package/README.md +7 -6
  2. package/dist/{Control-ZFh5ta_U.js → Control-b-43UT2B.js} +10 -10
  3. package/dist/{Datafair.client-8bXp6UeQ.js → Datafair.client-BrjISlaZ.js} +4 -4
  4. package/dist/{Event-DSQcW7OF.js → Event-py_AAwJY.js} +18 -18
  5. package/dist/{Image-BijNEG0p.js → Image-BHQYZWzH.js} +23 -23
  6. package/dist/{JsonPreview.client-BxuoPK_w.js → JsonPreview.client-DivFAnbN.js} +5 -5
  7. package/dist/{Map-BUtPf5GN.js → Map-CtP7leHl.js} +1313 -1173
  8. package/dist/{MapContainer.client-CTz0wmJG.js → MapContainer.client-Cq8tNLZZ.js} +17 -17
  9. package/dist/{OSM-D4MTdBtk.js → OSM-gdDSIsDA.js} +15 -23
  10. package/dist/{PdfPreview.client-DpVreUSl.js → PdfPreview.client-BNBgLsK2.js} +6 -10
  11. package/dist/Pmtiles.client-CQi5Rw8W.js +26123 -0
  12. package/dist/{PreviewWrapper.vue_vue_type_script_setup_true_lang-stmU5qEB.js → PreviewWrapper.vue_vue_type_script_setup_true_lang-C3dDzrIr.js} +2 -2
  13. package/dist/{ScaleLine-hJQIqcZm.js → ScaleLine-hG-FhNqy.js} +2 -2
  14. package/dist/{Tile-Dcl7oIVu.js → Tile-D6rFonpT.js} +163 -166
  15. package/dist/{TileImage-BJeHipMX.js → TileImage-cfrEgz5y.js} +131 -119
  16. package/dist/{View-xp_P_OHw.js → View-vp7vDb9q.js} +169 -119
  17. package/dist/{XmlPreview.client-DAOs89cR.js → XmlPreview.client-XCsNvnsZ.js} +5 -5
  18. package/dist/{common-BjQlan3k.js → common-C8efyyuc.js} +49 -49
  19. package/dist/components-next.css +1 -52
  20. package/dist/components-next.js +166 -157
  21. package/dist/components.css +2 -2
  22. package/dist/{index-JqjPja1u.js → index-CXUamc8Z.js} +6382 -6057
  23. package/dist/{leaflet-src-7m1mB8LI.js → leaflet-src-BRKv9Ksv.js} +162 -164
  24. package/dist/{main-D4WQMky0.js → main-DKu5SOAl.js} +48480 -97188
  25. package/dist/{proj-CsNo9yH1.js → proj-CsjVeojN.js} +322 -306
  26. package/dist/{text-clamp.esm-B5kW_XMt.js → text-clamp.esm-DVseBqZZ.js} +4 -4
  27. package/dist/{tilecoord-A0fLnBZr.js → tilecoord-CPcQJnrF.js} +270 -261
  28. package/dist/{vue3-json-viewer-BXwup7nO.js → vue3-json-viewer-CJLQFzXZ.js} +10 -16
  29. package/dist/{vue3-xml-viewer.common-BGsoNyZe.js → vue3-xml-viewer.common-BIaEIFYG.js} +1 -1
  30. package/package.json +42 -35
  31. package/src/chart.ts +5 -0
  32. package/src/components/ActivityList/ActivityList.vue +3 -0
  33. package/src/components/DatasetCard.vue +6 -4
  34. package/src/components/ObjectCardHeader.vue +1 -1
  35. package/src/components/RadioInput.vue +7 -2
  36. package/src/components/ResourceAccordion/DataStructure.vue +11 -33
  37. package/src/components/ResourceAccordion/Downloads.vue +160 -0
  38. package/src/components/ResourceAccordion/Pmtiles.client.vue +3 -1
  39. package/src/components/ResourceAccordion/ResourceAccordion.vue +7 -104
  40. package/src/components/ResourceExplorer/ResourceExplorer.vue +10 -64
  41. package/src/components/ResourceExplorer/ResourceExplorerViewer.vue +30 -136
  42. package/src/components/ResourceExplorer/ResourceSelector.vue +113 -0
  43. package/src/components/Search/GlobalSearch.vue +27 -6
  44. package/src/components/TabularExplorer/TabularCellPopover.vue +2 -2
  45. package/src/components/TabularExplorer/TabularExplorer.vue +404 -163
  46. package/src/components/TabularExplorer/TabularFilterContent.vue +15 -13
  47. package/src/components/TabularExplorer/TabularFilterPopover.vue +21 -26
  48. package/src/components/TabularExplorer/types.ts +9 -9
  49. package/src/composables/useHasTabularData.ts +7 -0
  50. package/src/composables/useResourceCapabilities.ts +1 -1
  51. package/src/composables/useSearchFilter.ts +7 -5
  52. package/src/composables/useStableQueryParams.ts +7 -3
  53. package/src/composables/useTabularProfile.ts +70 -0
  54. package/src/functions/activities.ts +3 -3
  55. package/src/functions/api.ts +13 -7
  56. package/src/functions/resources.ts +5 -0
  57. package/src/functions/tabular.ts +103 -1
  58. package/src/main.ts +12 -6
  59. package/src/types/resources.ts +0 -1
  60. package/src/types/search.ts +11 -0
  61. package/src/types/ui.ts +1 -1
  62. package/dist/Pmtiles.client-BwmHo3T8.js +0 -25185
@@ -1,4 +1,4 @@
1
- import { defineComponent as T, ref as k, onMounted as J, h as g, watch as F, computed as O, inject as $, provide as q, createElementBlock as _, openBlock as N, normalizeClass as S, toDisplayString as A, resolveComponent as ie, createCommentVNode as Y, createElementVNode as z, renderSlot as ce, createTextVNode as pe, createVNode as fe, nextTick as de } from "vue";
1
+ import { defineComponent as T, ref as k, onMounted as J, h as g, watch as F, computed as O, inject as $, provide as q, openBlock as _, createElementBlock as N, toDisplayString as A, normalizeClass as S, resolveComponent as ie, createElementVNode as z, renderSlot as ce, createTextVNode as pe, createCommentVNode as Y, createVNode as fe, nextTick as de } from "vue";
2
2
  const ve = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+$/, X = T({
3
3
  name: "JsonString",
4
4
  props: {
@@ -66,7 +66,7 @@ const ve = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)
66
66
  },
67
67
  setup(e) {
68
68
  const y = e, c = O(() => y.jsonValue === null ? "null" : "undefined");
69
- return (p, d) => (N(), _("span", ye, A(c.value), 1));
69
+ return (p, d) => (_(), N("span", ye, A(c.value), 1));
70
70
  }
71
71
  }), he = /* @__PURE__ */ T({
72
72
  __name: "json-number",
@@ -79,7 +79,7 @@ const ve = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)
79
79
  },
80
80
  setup(e) {
81
81
  const y = e, c = O(() => Number.isInteger(y.jsonValue));
82
- return (p, d) => (N(), _("span", {
82
+ return (p, d) => (_(), N("span", {
83
83
  class: S(["jv-item", "jv-number", c.value ? "jv-number-integer" : "jv-number-float"])
84
84
  }, A(e.jsonValue.toString()), 3));
85
85
  }
@@ -95,7 +95,7 @@ const ve = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)
95
95
  }
96
96
  },
97
97
  setup(e) {
98
- return (y, c) => (N(), _("span", ge, A(e.jsonValue.toString()), 1));
98
+ return (y, c) => (_(), N("span", ge, A(e.jsonValue.toString()), 1));
99
99
  }
100
100
  }), je = T({
101
101
  name: "JsonObject",
@@ -277,7 +277,7 @@ const ve = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)
277
277
  }
278
278
  },
279
279
  setup(e) {
280
- return (y, c) => (N(), _("span", {
280
+ return (y, c) => (_(), N("span", {
281
281
  class: S(["jv-item", "jv-function"]),
282
282
  title: e.jsonValue.toString()
283
283
  }, " <function> ", 8, Ee));
@@ -295,7 +295,7 @@ const ve = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)
295
295
  },
296
296
  setup(e) {
297
297
  const y = e, c = $("timeformat", (d) => d.toLocaleString()), p = O(() => c(y.jsonValue));
298
- return (d, i) => (N(), _("span", ke, ' "' + A(p.value) + '" ', 1));
298
+ return (d, i) => (_(), N("span", ke, ' "' + A(p.value) + '" ', 1));
299
299
  }
300
300
  }), Te = {
301
301
  class: /* @__PURE__ */ S(["jv-item", "jv-regexp"])
@@ -309,7 +309,7 @@ const ve = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)
309
309
  }
310
310
  },
311
311
  setup(e) {
312
- return (y, c) => (N(), _("span", Te, A(e.jsonValue.toString()), 1));
312
+ return (y, c) => (_(), N("span", Te, A(e.jsonValue.toString()), 1));
313
313
  }
314
314
  }), I = T({
315
315
  name: "JsonBox",
@@ -421,12 +421,6 @@ function _e(e) {
421
421
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
422
422
  }
423
423
  var H = { exports: {} };
424
- /*!
425
- * clipboard.js v2.0.11
426
- * https://clipboardjs.com/
427
- *
428
- * Licensed MIT © Zeno Rocha
429
- */
430
424
  var Ne = H.exports, Z;
431
425
  function Oe() {
432
426
  return Z || (Z = 1, (function(e, y) {
@@ -1041,10 +1035,10 @@ const Me = /* @__PURE__ */ _e(Ae), Ve = function(e, y) {
1041
1035
  };
1042
1036
  function Re(e, y, c, p, d, i) {
1043
1037
  const n = ie("json-box");
1044
- return N(), _("div", {
1038
+ return _(), N("div", {
1045
1039
  class: S(e.jvClass)
1046
1040
  }, [
1047
- e.copyable ? (N(), _("div", {
1041
+ e.copyable ? (_(), N("div", {
1048
1042
  key: 0,
1049
1043
  class: S(`jv-tooltip ${e.copyText.align || "right"}`)
1050
1044
  }, [
@@ -1067,7 +1061,7 @@ function Re(e, y, c, p, d, i) {
1067
1061
  "preview-mode": e.previewMode
1068
1062
  }, null, 8, ["value", "sort", "preview-mode"])
1069
1063
  ], 2),
1070
- e.expandableCode && e.boxed ? (N(), _("div", {
1064
+ e.expandableCode && e.boxed ? (_(), N("div", {
1071
1065
  key: 1,
1072
1066
  class: "jv-more",
1073
1067
  onClick: y[0] || (y[0] = (...t) => e.toggleExpandCode && e.toggleExpandCode(...t))
@@ -1,4 +1,4 @@
1
- import { c as Ke } from "./main-D4WQMky0.js";
1
+ import { b7 as Ke } from "./main-DKu5SOAl.js";
2
2
  import We from "vue";
3
3
  function Fe(I, K) {
4
4
  for (var V = 0; V < K.length; V++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datagouv/components-next",
3
- "version": "1.1.2",
3
+ "version": "1.3.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "engines": {
@@ -10,6 +10,12 @@
10
10
  "yarn": "use-pnpm-instead"
11
11
  },
12
12
  "main": "./src/main.ts",
13
+ "exports": {
14
+ ".": "./src/main.ts",
15
+ "./chart": "./src/chart.ts",
16
+ "./assets/*": "./assets/*",
17
+ "./dist/*": "./dist/*"
18
+ },
13
19
  "sideEffects": false,
14
20
  "files": [
15
21
  "assets",
@@ -19,22 +25,22 @@
19
25
  "dependencies": {
20
26
  "@floating-ui/vue": "^1.1.11",
21
27
  "@headlessui/vue": "^1.7.23",
22
- "@remixicon/vue": "^4.5.0",
28
+ "@remixicon/vue": "^4.9.0",
23
29
  "@types/hast": "^3.0.4",
24
- "@types/leaflet": "^1.9.17",
25
- "@vueuse/core": "^14.2.1",
26
- "@vueuse/router": "^14.2.1",
27
- "chart.js": "^4.4.8",
28
- "dompurify": "^3.2.5",
29
- "echarts": "^6.0.0",
30
- "geopf-extensions-openlayers": "^1.0.0-beta.10",
30
+ "@types/leaflet": "^1.9.21",
31
+ "@vueuse/core": "^14.3.0",
32
+ "@vueuse/router": "^14.3.0",
33
+ "chart.js": "^4.5.1",
34
+ "dompurify": "^3.4.7",
35
+ "echarts": "^6.1.0",
36
+ "geopf-extensions-openlayers": "1.0.0-beta.11",
31
37
  "leaflet": "^1.9.4",
32
- "maplibre-gl": "^5.6.2",
33
- "ofetch": "^1.4.1",
34
- "ol": "^10.6.1",
38
+ "maplibre-gl": "^5.24.0",
39
+ "ofetch": "^1.5.1",
40
+ "ol": "^10.9.0",
35
41
  "pdfjs-dist": "^4.10.38",
36
- "pmtiles": "^4.3.0",
37
- "popmotion": "^11.0",
42
+ "pmtiles": "^4.4.1",
43
+ "popmotion": "^11.0.5",
38
44
  "rehype-highlight": "^7.0.2",
39
45
  "rehype-raw": "^7.0.0",
40
46
  "rehype-sanitize": "^6.0.0",
@@ -48,42 +54,43 @@
48
54
  "strip-markdown": "^6.0.0",
49
55
  "stylefire": "^7.0.3",
50
56
  "unified": "^11.0.5",
51
- "unist-util-visit": "^5.0.0",
57
+ "unist-util-visit": "^5.1.0",
52
58
  "vue-content-loader": "^2.0.1",
53
59
  "vue-sonner": "^2.0.9",
54
60
  "vue3-json-viewer": "^2.4.1",
55
61
  "vue3-text-clamp": "^0.1.2",
56
62
  "vue3-xml-viewer": "^0.0.14",
57
- "yaml": "^2.8.2"
63
+ "yaml": "^2.9.0"
58
64
  },
59
65
  "devDependencies": {
60
66
  "@intlify/cli": "^0.13.1",
61
- "@tailwindcss/cli": "^4.0.8",
62
- "@tailwindcss/typography": "^0.5.16",
63
- "@tsconfig/node22": "^22.0.0",
67
+ "@tailwindcss/cli": "^4.3.0",
68
+ "@tailwindcss/typography": "^0.5.19",
69
+ "@tsconfig/node22": "^22.0.5",
64
70
  "@types/geojson": "^7946.0.16",
65
- "@types/node": "^22.13.1",
66
- "@vitejs/plugin-vue": "^6.0",
71
+ "@types/node": "^22.19.19",
72
+ "@vitejs/plugin-vue": "^6.0.7",
67
73
  "@vue/eslint-config-prettier": "^10.2.0",
68
- "@vue/eslint-config-typescript": "^14.3.0",
69
- "@vue/tsconfig": "^0.8.0",
70
- "eslint": "^9.18.0",
71
- "eslint-plugin-vue": "^10.0",
72
- "jiti": "^2.4.2",
73
- "npm-run-all2": "^8.0",
74
+ "@vue/eslint-config-typescript": "^14.7.0",
75
+ "@vue/tsconfig": "^0.8.1",
76
+ "eslint": "^9.39.4",
77
+ "eslint-plugin-vue": "^10.9.1",
78
+ "jiti": "^2.7.0",
79
+ "npm-run-all2": "^8.0.4",
74
80
  "openapi-types": "^12.1.3",
75
- "prettier": "^3.0.0",
76
- "tailwindcss": "^4.0.8",
81
+ "prettier": "^3.8.3",
82
+ "tailwindcss": "^4.3.0",
77
83
  "typescript": "^5.9.3",
78
- "vite": "^7.0",
79
- "vite-plugin-vue-devtools": "^8.0",
80
- "vue": "^3.5.33",
81
- "vue-router": "^5.0.4",
82
- "vue-tsc": "^3.0"
84
+ "vite": "^7.3.3",
85
+ "vite-plugin-vue-devtools": "^8.1.2",
86
+ "vue": "^3.5.35",
87
+ "vue-router": "^5.0.7",
88
+ "vue-tsc": "^3.3.2"
83
89
  },
84
90
  "peerDependencies": {
85
91
  "vue": "^3.5.13",
86
- "vue-router": "^4.5.0 || ^5.0.0"
92
+ "vue-router": "^4.5.0 || ^5.0.0",
93
+ "echarts": "^6.0.0"
87
94
  },
88
95
  "scarfSettings": {
89
96
  "enabled": false
package/src/chart.ts ADDED
@@ -0,0 +1,5 @@
1
+ import ChartViewer from './components/Chart/ChartViewer.vue'
2
+ import ChartViewerWrapper from './components/Chart/ChartViewerWrapper.vue'
3
+ import SmallChart from './components/SmallChart.vue'
4
+
5
+ export { ChartViewer, ChartViewerWrapper, SmallChart }
@@ -77,6 +77,9 @@
77
77
  v-bind="{ class: '', activity }"
78
78
  >
79
79
  {{ getActivityTranslation(activity) }}
80
+ <template v-if="'resource_id' in activity.extras">
81
+ {{ activity.extras.resource_id }}
82
+ </template>
80
83
  </slot>
81
84
  </p>
82
85
  <p class="m-0 flex-none text-xs text-gray-medium">
@@ -107,10 +107,12 @@
107
107
  </p>
108
108
  </div>
109
109
  </div>
110
- <ObjectCardShortDescription
111
- v-if="showDescriptionShort"
112
- :text="getDescriptionShort(props.dataset)"
113
- />
110
+ <slot>
111
+ <ObjectCardShortDescription
112
+ v-if="showDescriptionShort"
113
+ :text="getDescriptionShort(props.dataset)"
114
+ />
115
+ </slot>
114
116
  </ObjectCard>
115
117
  </template>
116
118
 
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <component
3
3
  :is="titleTag"
4
- class="w-full text-base flex"
4
+ class="w-full text-base font-bold flex"
5
5
  >
6
6
  <AppLink
7
7
  :to="url"
@@ -13,9 +13,14 @@
13
13
  >
14
14
  <component
15
15
  :is="icon"
16
- v-if="icon"
16
+ v-if="icon && typeof icon !== 'string'"
17
17
  class="w-4 h-4"
18
18
  />
19
+ <span
20
+ v-else-if="icon"
21
+ :class="icon"
22
+ aria-hidden="true"
23
+ />
19
24
  <span class="text-sm flex-1 min-w-0">
20
25
  <slot />
21
26
  </span>
@@ -40,7 +45,7 @@ type Props = {
40
45
  value: string
41
46
  count?: number
42
47
  loading?: boolean
43
- icon?: Component
48
+ icon?: Component | string
44
49
  highlighted?: boolean
45
50
  }
46
51
 
@@ -49,45 +49,23 @@
49
49
  </template>
50
50
 
51
51
  <script setup lang="ts">
52
- import { onMounted, ref } from 'vue'
52
+ import { computed } from 'vue'
53
53
  import type { Resource } from '../../types/resources'
54
- import { useGetProfile } from '../../functions/tabularApi'
55
54
  import { useTranslation } from '../../composables/useTranslation'
55
+ import { injectTabularProfile } from '../../composables/useTabularProfile'
56
56
  import PreviewLoader from './PreviewLoader.vue'
57
57
 
58
58
  const props = defineProps<{ resource: Resource }>()
59
- const getProfile = useGetProfile()
60
59
  const { t } = useTranslation()
61
60
 
62
- type ColumnInfo = {
63
- score: number
64
- format: string
65
- python_type: string
66
- }
61
+ // Profile is shared with sibling components (e.g. TabularExplorer) via
62
+ // `provideTabularProfile` in the parent. Falls back to a local fetch
63
+ // when no parent provides it (standalone usage).
64
+ const { data: profileData, status } = await injectTabularProfile(() => props.resource.id)
67
65
 
68
- const columns = ref<Array<string>>([])
69
- const columnsInfo = ref<Record<string, ColumnInfo>>({})
70
- const loading = ref(true)
71
- const hasError = ref(false)
72
- const hasColumnInfo = ref(false)
73
-
74
- onMounted(async () => {
75
- try {
76
- const response = await getProfile(props.resource.id) // Assurez-vous que cette fonction retourne bien les données attendues
77
- if ('profile' in response && response.profile) {
78
- columns.value = Object.keys(response.profile.columns)
79
- columnsInfo.value = response.profile.columns
80
- hasColumnInfo.value = true
81
- loading.value = false
82
- }
83
- else {
84
- hasError.value = true
85
- loading.value = false
86
- }
87
- }
88
- catch {
89
- hasError.value = true
90
- loading.value = false
91
- }
92
- })
66
+ const loading = computed(() => status.value === 'idle' || status.value === 'pending')
67
+ const hasError = computed(() => status.value === 'error')
68
+ const hasColumnInfo = computed(() => !!profileData.value?.profile?.columns)
69
+ const columns = computed(() => profileData.value?.profile ? Object.keys(profileData.value.profile.columns) : [])
70
+ const columnsInfo = computed(() => profileData.value?.profile?.columns ?? {})
93
71
  </script>
@@ -0,0 +1,160 @@
1
+ <template>
2
+ <dl class="fr-pl-0">
3
+ <dt
4
+ v-if="resource.format === 'url'"
5
+ class="font-bold fr-text--sm fr-mb-0"
6
+ >
7
+ {{ t("URL d'origine") }}
8
+ </dt>
9
+ <dt
10
+ v-else
11
+ class="font-bold fr-text--sm fr-mb-0"
12
+ >
13
+ {{ t('Format original') }}
14
+ </dt>
15
+ <dd class="text-sm pl-0 mb-4 text-gray-medium h-8 flex flex-wrap items-center">
16
+ <span
17
+ v-if="resource.format === 'url'"
18
+ class="inline-flex items-center max-w-full"
19
+ >
20
+ <a
21
+ :href="resource.latest"
22
+ class="fr-link no-icon-after truncate"
23
+ rel="ugc nofollow noopener"
24
+ target="_blank"
25
+ @click="trackEvent('Jeux de données', 'Télécharger un fichier', 'Bouton : télécharger un fichier')"
26
+ >
27
+ {{ resource.url }}
28
+ </a>
29
+ <span class="fr-ml-1v fr-icon-external-link-line fr-icon--sm shrink-0" />
30
+ </span>
31
+ <span v-else>
32
+ <span class="text-datagouv fr-icon-download-line fr-icon--sm fr-mr-1v fr-mt-1v" />
33
+ <a
34
+ :href="resource.latest"
35
+ class="fr-link"
36
+ rel="ugc nofollow noopener"
37
+ @click="trackEvent('Jeux de données', 'Télécharger un fichier', `Bouton : format ${resource.format}`)"
38
+ >
39
+ <span>{{ t('Format {format}', { format: resource.format }) }}<span v-if="resourceFilesize"> - {{ filesize(resourceFilesize) }}</span></span>
40
+ </a>
41
+ </span>
42
+ <CopyButton
43
+ :label="t('Copier le lien')"
44
+ :copied-label="t('Lien copié !')"
45
+ :text="resource.latest"
46
+ class="relative"
47
+ />
48
+ </dd>
49
+ <template v-if="generatedFormats.length">
50
+ <dt class="font-bold fr-text--sm fr-mb-0">
51
+ {{ t('Formats générés automatiquement par {platform} (dernière mise à jour {date})', { platform: config.name, date: conversionsLastUpdate }) }}
52
+ </dt>
53
+ <dd
54
+ v-for="generatedFormat in generatedFormats"
55
+ :key="generatedFormat.format"
56
+ class="text-sm pl-0 mb-4 text-gray-medium h-8 flex flex-wrap items-center"
57
+ >
58
+ <span>
59
+ <span class="text-datagouv fr-icon-download-line fr-icon--sm fr-mr-1v fr-mt-1v" />
60
+ <a
61
+ :href="generatedFormat.url"
62
+ class="fr-link"
63
+ rel="ugc nofollow noopener"
64
+ @click="trackEvent('Jeux de données', 'Télécharger un fichier', `Bouton : format ${generatedFormat.format}`)"
65
+ >
66
+ <span>{{ t('Format {format}', { format: generatedFormat.format }) }}<span v-if="generatedFormat.size"> - {{ filesize(generatedFormat.size) }}</span></span>
67
+ </a>
68
+ </span>
69
+ <CopyButton
70
+ :label="t('Copier le lien')"
71
+ :copied-label="t('Lien copié !')"
72
+ :text="generatedFormat.url"
73
+ class="relative"
74
+ />
75
+ </dd>
76
+ </template>
77
+ <template v-if="wfsFormats.length">
78
+ <dt class="font-bold fr-text--sm fr-mb-0">
79
+ <div class="flex gap-1 items-center">
80
+ {{ t('Formats exportés depuis le service WFS') }}
81
+ <span v-if="defaultWfsProjection"> ({{ t('projection {crs}', { crs: defaultWfsProjection }) }})</span>
82
+ <Tooltip>
83
+ <RiInformationLine
84
+ class="flex-none size-4"
85
+ :aria-label="t(`Le lien de téléchargement interroge directement le flux WFS distant. Le nombre de features téléchargées peut être limité.`)"
86
+ aria-hidden="true"
87
+ />
88
+ <template #tooltip>
89
+ <p class="text-sm font-normal mb-0">
90
+ {{ t(`Le lien de téléchargement interroge directement le flux WFS distant.`) }}
91
+ </p>
92
+ <p class="text-sm font-normal mb-0">
93
+ {{ t(`Le nombre de features téléchargées peut être limité.`) }}
94
+ </p>
95
+ </template>
96
+ </Tooltip>
97
+ </div>
98
+ </dt>
99
+ <dd
100
+ v-for="wfsFormat in wfsFormats"
101
+ :key="wfsFormat.format"
102
+ class="text-sm pl-0 mb-4 text-gray-medium h-8 flex flex-wrap items-center"
103
+ >
104
+ <span>
105
+ <span class="text-datagouv fr-icon-download-line fr-icon--sm fr-mr-1v fr-mt-1v" />
106
+ <a
107
+ :href="wfsFormat.url"
108
+ class="fr-link"
109
+ rel="ugc nofollow noopener"
110
+ @click="trackEvent('Jeux de données', 'Télécharger un fichier', `Bouton : format ${wfsFormat.format}`)"
111
+ >
112
+ <span>{{ t('Format {format}', { format: wfsFormat.format }) }}</span>
113
+ </a>
114
+ </span>
115
+ <CopyButton
116
+ :label="t('Copier le lien')"
117
+ :copied-label="t('Lien copié !')"
118
+ :text="wfsFormat.url"
119
+ class="relative"
120
+ />
121
+ </dd>
122
+ </template>
123
+ </dl>
124
+ </template>
125
+
126
+ <script setup lang="ts">
127
+ import { computed } from 'vue'
128
+ import { RiInformationLine } from '@remixicon/vue'
129
+ import CopyButton from '../CopyButton.vue'
130
+ import Tooltip from '../Tooltip.vue'
131
+ import { filesize } from '../../functions/helpers'
132
+ import { getResourceFilesize } from '../../functions/resources'
133
+ import { trackEvent } from '../../functions/matomo'
134
+ import { useComponentsConfig } from '../../config'
135
+ import { useFormatDate } from '../../functions/dates'
136
+ import { useTranslation } from '../../composables/useTranslation'
137
+ import { useResourceCapabilities } from '../../composables/useResourceCapabilities'
138
+ import type { Resource } from '../../types/resources'
139
+ import type { Dataset, DatasetV2 } from '../../types/datasets'
140
+
141
+ const props = defineProps<{
142
+ resource: Resource
143
+ dataset: Dataset | DatasetV2
144
+ }>()
145
+
146
+ const { t } = useTranslation()
147
+ const config = useComponentsConfig()
148
+ const { formatRelativeIfRecentDate } = useFormatDate()
149
+
150
+ const { generatedFormats, wfsFormats, defaultWfsProjection } = useResourceCapabilities(
151
+ () => props.resource,
152
+ () => props.dataset,
153
+ )
154
+
155
+ const resourceFilesize = computed(() => getResourceFilesize(props.resource))
156
+
157
+ const conversionsLastUpdate = computed(() =>
158
+ formatRelativeIfRecentDate(props.resource.extras['analysis:parsing:finished_at'] as string | undefined),
159
+ )
160
+ </script>
@@ -107,7 +107,9 @@ async function displayMap() {
107
107
  p.getHeader().then((h: { maxZoom: number, centerLon: number, centerLat: number }) => {
108
108
  const map = new maplibregl.Map({
109
109
  container: container.value!,
110
- style: styleVector as maplibregl.StyleSpecification,
110
+ // JSON import is inferred too loosely (e.g. center as number[]) to match
111
+ // maplibre's strict StyleSpecification, so cast through unknown.
112
+ style: styleVector as unknown as maplibregl.StyleSpecification,
111
113
  zoom: h.maxZoom - 2,
112
114
  center: [h.centerLon, h.centerLat],
113
115
  })