@datagouv/components-next 1.0.2-dev.3 → 1.0.2-dev.30

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 (47) hide show
  1. package/dist/Datafair.client-CSUWxY1U.js +30 -0
  2. package/dist/{Event--kp8kMdJ.js → Event-B0pbfyAo.js} +1 -1
  3. package/dist/JsonPreview.client-DWP5adeD.js +72 -0
  4. package/dist/{Map-BjUnLyj8.js → Map-ByzoJvTf.js} +2 -2
  5. package/dist/MapContainer.client-B0oJPrx5.js +102 -0
  6. package/dist/{OSM-s40W6sQ2.js → OSM-FSBCBM2l.js} +1 -1
  7. package/dist/{PdfPreview.client-C-w6-w44.js → PdfPreview.client-B2E_IWUj.js} +533 -548
  8. package/dist/{Pmtiles.client-BR7_ldHY.js → Pmtiles.client-STSFvULL.js} +575 -580
  9. package/dist/Swagger.client-mrRTl6ll.js +4 -0
  10. package/dist/{Tile-DbNFNPfU.js → Tile-nykTnQlb.js} +4 -4
  11. package/dist/{TileImage-BsXBxMtq.js → TileImage-RLU-wMoy.js} +1 -1
  12. package/dist/{View-BR92hTWP.js → View-SHblmfOT.js} +1 -1
  13. package/dist/XmlPreview.client-C0zaJXWA.js +64 -0
  14. package/dist/components-next.css +4 -4
  15. package/dist/components-next.js +13 -13
  16. package/dist/components.css +1 -1
  17. package/dist/{index-SrYZwgCT.js → index-kxzw3Ssm.js} +1164 -1164
  18. package/dist/{leaflet-src-7m1mB8LI.js → leaflet-src-DfyFSZpM.js} +185 -183
  19. package/dist/{main-B2kXxWRG.js → main-BMXOPzsN.js} +34653 -33895
  20. package/dist/{text-clamp.esm-B5kW_XMt.js → text-clamp.esm-DVseBqZZ.js} +4 -4
  21. package/dist/{tilecoord-Db24Px13.js → tilecoord-BgTy1qJO.js} +5 -5
  22. package/dist/{vue3-json-viewer-BXwup7nO.js → vue3-json-viewer-BgCuOAH6.js} +10 -10
  23. package/dist/{vue3-xml-viewer.common-BRxsqI9j.js → vue3-xml-viewer.common-CwN-5lms.js} +16 -16
  24. package/package.json +9 -5
  25. package/src/components/Form/SearchableSelect.vue +2 -1
  26. package/src/components/ReadMore.vue +1 -1
  27. package/src/components/ResourceAccordion/Datafair.client.vue +4 -10
  28. package/src/components/ResourceAccordion/JsonPreview.client.vue +13 -30
  29. package/src/components/ResourceAccordion/MapContainer.client.vue +7 -11
  30. package/src/components/ResourceAccordion/PdfPreview.client.vue +13 -29
  31. package/src/components/ResourceAccordion/Pmtiles.client.vue +5 -10
  32. package/src/components/ResourceAccordion/Preview.vue +5 -10
  33. package/src/components/ResourceAccordion/PreviewLoader.vue +1 -2
  34. package/src/components/ResourceAccordion/PreviewUnavailable.vue +22 -0
  35. package/src/components/ResourceAccordion/XmlPreview.client.vue +13 -30
  36. package/src/components/ResourceExplorer/ResourceExplorer.vue +21 -10
  37. package/src/components/ResourceExplorer/ResourceExplorerViewer.vue +12 -1
  38. package/src/composables/useResourceCapabilities.ts +1 -1
  39. package/src/types/dataservices.ts +2 -0
  40. package/src/types/organizations.ts +1 -1
  41. package/src/types/users.ts +0 -1
  42. package/dist/Datafair.client-E5D6ePRC.js +0 -35
  43. package/dist/JsonPreview.client-C-6eBbPw.js +0 -87
  44. package/dist/MapContainer.client-DRkAmdOc.js +0 -105
  45. package/dist/Swagger.client-D4-F6yEf.js +0 -4
  46. package/dist/XmlPreview.client-Dl2VCgXF.js +0 -79
  47. /package/assets/illustrations/{_microscope.svg → microscope.svg} +0 -0
@@ -9,42 +9,25 @@
9
9
  >
10
10
  {{ t("Chargement de l'aperçu XML...") }}
11
11
  </div>
12
- <SimpleBanner
13
- v-else-if="fileTooLarge"
14
- type="warning"
15
- class="flex items-center space-x-2"
16
- >
17
- <RiErrorWarningLine class="shrink-0 size-6" />
18
- <span>{{ fileSizeBytes
19
- ? t("Fichier XML 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.")
20
- : t("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.")
21
- }}</span>
22
- </SimpleBanner>
23
- <SimpleBanner
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 SimpleBanner from '../SimpleBanner.vue'
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
- const { data } = await useFetch<PaginatedArray<Resource>>(url, {
170
- params: {
171
- type,
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 (data.value) {
179
- extraRef.value = [...extraRef.value, ...data.value.data]
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 if (hasPreview.value || hasDatafairPreview.value || hasOpenAPIPreview.value) {
91
+ else {
92
92
  options.push({ key: 'data', label: t('Aperçu') })
93
93
  }
94
94
 
@@ -24,6 +24,7 @@ export type BaseDataservice = Owned & WithAccessType & {
24
24
  license: string | null
25
25
  private: boolean
26
26
  rate_limiting: string
27
+ rate_limiting_url: string | null
27
28
  title: DataserviceReference['title']
28
29
  contact_points: Array<ContactPoint>
29
30
  }
@@ -65,6 +66,7 @@ export type Dataservice = Owned & WithAccessType & {
65
66
  permissions: { edit: boolean, delete: boolean }
66
67
  private: boolean
67
68
  rate_limiting: string
69
+ rate_limiting_url: string | null
68
70
  self_api_url: DataserviceReference['self_api_url']
69
71
  self_web_url: DataserviceReference['self_web_url']
70
72
  slug: string
@@ -1,7 +1,7 @@
1
1
  import type { User } from './users'
2
2
  import type { Badges } from './badges'
3
3
 
4
- export type MemberRole = 'admin' | 'editor'
4
+ export type MemberRole = 'admin' | 'editor' | 'partial_editor'
5
5
 
6
6
  export type Member = {
7
7
  role: MemberRole
@@ -21,7 +21,6 @@ export type User = {
21
21
  page: UserReference['page']
22
22
  avatar: UserReference['avatar']
23
23
  avatar_thumbnail: UserReference['avatar_thumbnail']
24
- apikey?: string
25
24
  email?: string
26
25
  about: string
27
26
  website?: string
@@ -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
- };
@@ -1,105 +0,0 @@
1
- import { defineComponent as G, useTemplateRef as W, ref as z, onMounted as B, createBlock as F, createElementBlock as N, openBlock as u, withCtx as V, createVNode as U, createElementVNode as q, unref as m, toDisplayString as A } from "vue";
2
- import { a as D, _ as O, F as P } from "./main-B2kXxWRG.js";
3
- const j = /* @__PURE__ */ G({
4
- __name: "MapContainer.client",
5
- props: {
6
- resource: {}
7
- },
8
- setup(f) {
9
- const a = f, { t: d } = D();
10
- let e = null;
11
- const r = W("mapRef"), n = z(!1);
12
- async function w() {
13
- const [
14
- { default: i },
15
- { default: s },
16
- { default: y },
17
- { default: h },
18
- { default: C },
19
- _
20
- ] = await Promise.all([
21
- import("./View-BR92hTWP.js").then((t) => t.M),
22
- import("./Map-BjUnLyj8.js").then((t) => t.U),
23
- import("./ScaleLine-KW-nXqp3.js"),
24
- import("./Tile-DbNFNPfU.js").then((t) => t.d),
25
- import("./OSM-s40W6sQ2.js"),
26
- // @ts-expect-error no types provided
27
- import("./index-SrYZwgCT.js")
28
- ]), { CRS: g, GeoportalAttribution: S, GeoportalFullScreen: M, GeoportalZoom: b, LayerImport: v, LayerSwitcher: L } = _;
29
- await Promise.resolve({ }), await Promise.resolve({ }), await Promise.resolve({ }), await Promise.resolve({ }), g.load(), e = new s({
30
- target: r.value,
31
- layers: [
32
- new h({
33
- source: new C()
34
- })
35
- ],
36
- view: new i({
37
- center: [288074.8449901076, 6247982515792289e-9],
38
- zoom: 8,
39
- constrainResolution: !0
40
- })
41
- });
42
- const R = new y({
43
- units: "metric",
44
- bar: !1
45
- });
46
- e.addControl(R);
47
- const k = new M({
48
- position: "top-right"
49
- });
50
- e.addControl(k);
51
- const T = new b({
52
- position: "bottom-left"
53
- });
54
- e.addControl(T);
55
- const x = new L({
56
- options: {
57
- position: "top-right"
58
- }
59
- });
60
- e.addControl(x);
61
- const E = new S({
62
- position: "bottom-right"
63
- });
64
- e.addControl(E);
65
- const o = new v({
66
- position: "bottom-left",
67
- listable: !0,
68
- layerTypes: ["WMS"]
69
- });
70
- o._serviceUrlImportInput.value = a.resource.url, o._formContainer.dispatchEvent(new CustomEvent("submit", { cancelable: !0 })), e.addControl(o);
71
- const l = 500;
72
- let p = 20;
73
- function c() {
74
- if (!o._getCapResponseWMSLayers)
75
- p--, p > 0 ? setTimeout(c, l) : n.value = !0;
76
- else {
77
- const t = o._getCapResponseWMSLayers.filter((I) => I.Name == a.resource.title)[0];
78
- o._addGetCapWMSLayer(t);
79
- }
80
- }
81
- setTimeout(c, l);
82
- }
83
- return B(() => {
84
- w();
85
- }), (i, s) => n.value ? (u(), F(O, {
86
- key: 0,
87
- type: "warning",
88
- class: "flex items-center space-x-2"
89
- }, {
90
- default: V(() => [
91
- U(m(P), { class: "shrink-0 size-6" }),
92
- q("span", null, A(m(d)("L'aperçu cartographique de ce fichier n'a pas pu être chargé.")), 1)
93
- ]),
94
- _: 1
95
- })) : (u(), N("div", {
96
- key: 1,
97
- id: "map",
98
- ref_key: "mapRef",
99
- ref: r
100
- }, null, 512));
101
- }
102
- });
103
- export {
104
- j as default
105
- };
@@ -1,4 +0,0 @@
1
- import { i as f } from "./main-B2kXxWRG.js";
2
- export {
3
- f as default
4
- };
@@ -1,79 +0,0 @@
1
- import { defineComponent as b, defineAsyncComponent as L, ref as o, computed as w, onMounted as T, createElementBlock as p, openBlock as r, createBlock as m, createCommentVNode as P, createVNode as u, unref as t, toDisplayString as i, withCtx as f, createElementVNode as d } from "vue";
2
- import { u as E, a as M, g as q, _ as h, F as v } from "./main-B2kXxWRG.js";
3
- const B = { class: "fr-text--xs" }, S = { key: 0 }, V = {
4
- key: 1,
5
- class: "text-gray-medium"
6
- }, N = /* @__PURE__ */ b({
7
- __name: "XmlPreview.client",
8
- props: {
9
- resource: {}
10
- },
11
- setup(k) {
12
- const z = L(
13
- () => import("./vue3-xml-viewer.common-BRxsqI9j.js").then((e) => e.v).then((e) => e.default || e.XmlViewer)
14
- ), g = k, x = E(), { t: l } = M(), n = o(null), c = o(!1), s = o(null), _ = o(!1), y = w(() => q(g.resource)), X = w(() => {
15
- const e = y.value;
16
- if (!e || !x.maxXmlPreviewCharSize)
17
- return !1;
18
- const a = x.maxXmlPreviewCharSize;
19
- return e <= a;
20
- }), C = async () => {
21
- if (!X.value) {
22
- _.value = !0;
23
- return;
24
- }
25
- c.value = !0, s.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.text();
31
- n.value = a;
32
- } catch (e) {
33
- console.error("Error loading XML:", e), e instanceof TypeError ? s.value = "network" : s.value = "generic", n.value = null;
34
- } finally {
35
- c.value = !1;
36
- }
37
- };
38
- return T(() => {
39
- C();
40
- }), (e, a) => (r(), p("div", B, [
41
- n.value ? (r(), p("div", S, [
42
- u(t(z), { xml: n.value }, null, 8, ["xml"])
43
- ])) : c.value ? (r(), p("div", V, i(t(l)("Chargement de l'aperçu XML...")), 1)) : _.value ? (r(), m(h, {
44
- key: 2,
45
- type: "warning",
46
- class: "flex items-center space-x-2"
47
- }, {
48
- default: f(() => [
49
- u(t(v), { class: "shrink-0 size-6" }),
50
- d("span", null, i(y.value ? t(l)("Fichier XML 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(l)("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)
51
- ]),
52
- _: 1
53
- })) : s.value === "network" ? (r(), m(h, {
54
- key: 3,
55
- type: "warning",
56
- class: "flex items-center space-x-2"
57
- }, {
58
- default: f(() => [
59
- u(t(v), { class: "shrink-0 size-6" }),
60
- d("span", null, i(t(l)("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.")), 1)
61
- ]),
62
- _: 1
63
- })) : s.value ? (r(), m(h, {
64
- key: 4,
65
- type: "warning",
66
- class: "flex items-center space-x-2"
67
- }, {
68
- default: f(() => [
69
- u(t(v), { class: "shrink-0 size-6" }),
70
- d("span", null, i(t(l)("Erreur lors du chargement de l'aperçu XML.")), 1)
71
- ]),
72
- _: 1
73
- })) : P("", !0)
74
- ]));
75
- }
76
- });
77
- export {
78
- N as default
79
- };