@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.
Files changed (34) hide show
  1. package/dist/Datafair.client-Ds3VQrRi.js +30 -0
  2. package/dist/JsonPreview.client-CYxmz0yV.js +72 -0
  3. package/dist/{MapContainer.client-DRkAmdOc.js → MapContainer.client-B2BijMx5.js} +35 -38
  4. package/dist/{PdfPreview.client-C-w6-w44.js → PdfPreview.client-DJBMzrlC.js} +534 -549
  5. package/dist/{Pmtiles.client-BR7_ldHY.js → Pmtiles.client-C_hvRDuy.js} +574 -579
  6. package/dist/Swagger.client-B4y0hXME.js +4 -0
  7. package/dist/XmlPreview.client-LETEfNBH.js +64 -0
  8. package/dist/components-next.css +3 -3
  9. package/dist/components-next.js +1 -1
  10. package/dist/components.css +1 -1
  11. package/dist/{index-SrYZwgCT.js → index-BFQX7Ccz.js} +1 -1
  12. package/dist/{main-B2kXxWRG.js → main-vqhkVhVS.js} +34465 -33707
  13. package/dist/{vue3-xml-viewer.common-BRxsqI9j.js → vue3-xml-viewer.common-BcNJo35o.js} +1 -1
  14. package/package.json +8 -4
  15. package/src/components/Form/SearchableSelect.vue +2 -1
  16. package/src/components/ReadMore.vue +1 -1
  17. package/src/components/ResourceAccordion/Datafair.client.vue +4 -10
  18. package/src/components/ResourceAccordion/JsonPreview.client.vue +13 -30
  19. package/src/components/ResourceAccordion/MapContainer.client.vue +7 -11
  20. package/src/components/ResourceAccordion/PdfPreview.client.vue +13 -29
  21. package/src/components/ResourceAccordion/Pmtiles.client.vue +5 -10
  22. package/src/components/ResourceAccordion/Preview.vue +5 -10
  23. package/src/components/ResourceAccordion/PreviewLoader.vue +1 -2
  24. package/src/components/ResourceAccordion/PreviewUnavailable.vue +22 -0
  25. package/src/components/ResourceAccordion/XmlPreview.client.vue +13 -30
  26. package/src/components/ResourceExplorer/ResourceExplorer.vue +21 -10
  27. package/src/components/ResourceExplorer/ResourceExplorerViewer.vue +12 -1
  28. package/src/composables/useResourceCapabilities.ts +1 -1
  29. package/src/types/organizations.ts +1 -1
  30. package/dist/Datafair.client-E5D6ePRC.js +0 -35
  31. package/dist/JsonPreview.client-C-6eBbPw.js +0 -87
  32. package/dist/Swagger.client-D4-F6yEf.js +0 -4
  33. package/dist/XmlPreview.client-Dl2VCgXF.js +0 -79
  34. /package/assets/illustrations/{_microscope.svg → microscope.svg} +0 -0
@@ -0,0 +1,30 @@
1
+ import { defineComponent as l, computed as a, createElementBlock as o, openBlock as t, createBlock as u, createElementVNode as f, withCtx as p, createTextVNode as m, toDisplayString as _, unref as h } from "vue";
2
+ import { a as x, _ as g } from "./main-vqhkVhVS.js";
3
+ const v = { class: "fr-text--xs" }, b = { key: 0 }, k = ["src"], $ = /* @__PURE__ */ l({
4
+ __name: "Datafair.client",
5
+ props: {
6
+ resource: {},
7
+ dataset: {}
8
+ },
9
+ setup(c) {
10
+ const e = c, { t: i } = x(), r = a(() => e.resource.extras.datafairOrigin || e.dataset.extras.datafairOrigin), s = a(() => e.resource.extras.datafairDatasetId || e.dataset.extras.datafairDatasetId), d = a(() => e.resource.extras.datafairEmbed), n = a(() => !r.value || !s.value ? null : `${r.value}/embed/dataset/${s.value}/${d.value}`);
11
+ return (D, y) => (t(), o("div", v, [
12
+ n.value ? (t(), o("div", b, [
13
+ f("iframe", {
14
+ src: n.value,
15
+ width: "100%",
16
+ height: "500px",
17
+ style: { "background-color": "transparent", border: "none" }
18
+ }, null, 8, k)
19
+ ])) : (t(), u(g, { key: 1 }, {
20
+ default: p(() => [
21
+ m(_(h(i)("L'aperçu de ce fichier n'a pas pu être chargé. Téléchargez-le depuis l'onglet Téléchargements.")), 1)
22
+ ]),
23
+ _: 1
24
+ }))
25
+ ]));
26
+ }
27
+ });
28
+ export {
29
+ $ as default
30
+ };
@@ -0,0 +1,72 @@
1
+ import { defineComponent as z, defineAsyncComponent as C, ref as l, computed as x, onMounted as J, createElementBlock as c, openBlock as t, createBlock as p, createCommentVNode as S, createVNode as N, unref as r, toDisplayString as i, withCtx as d, createTextVNode as f } from "vue";
2
+ import { u as B, a as L, g as V, _ as h } from "./main-vqhkVhVS.js";
3
+ const E = { class: "fr-text--xs" }, P = { key: 0 }, b = {
4
+ key: 1,
5
+ class: "text-gray-medium"
6
+ }, j = /* @__PURE__ */ z({
7
+ __name: "JsonPreview.client",
8
+ props: {
9
+ resource: {}
10
+ },
11
+ setup(y) {
12
+ const T = C(
13
+ () => import("./vue3-json-viewer-BXwup7nO.js").then((e) => (Promise.resolve({ }), e.JsonViewer))
14
+ ), m = y, v = B(), { t: n } = L(), s = l(null), u = l(!1), a = l(null), g = l(!1), _ = x(() => V(m.resource)), w = x(() => {
15
+ const e = _.value;
16
+ if (!e || !v.maxJsonPreviewCharSize)
17
+ return !1;
18
+ const o = v.maxJsonPreviewCharSize;
19
+ return e <= o;
20
+ }), k = async () => {
21
+ if (!w.value) {
22
+ g.value = !0;
23
+ return;
24
+ }
25
+ u.value = !0, a.value = null;
26
+ try {
27
+ const e = await fetch(m.resource.url);
28
+ if (!e.ok)
29
+ throw new Error(`HTTP error! status: ${e.status}`);
30
+ const o = await e.json();
31
+ s.value = o;
32
+ } catch (e) {
33
+ console.error("Error loading JSON:", e), e instanceof TypeError ? a.value = "network" : a.value = "generic", s.value = null;
34
+ } finally {
35
+ u.value = !1;
36
+ }
37
+ };
38
+ return J(() => {
39
+ k();
40
+ }), (e, o) => (t(), c("div", E, [
41
+ s.value ? (t(), c("div", P, [
42
+ N(r(T), {
43
+ value: s.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
+ ])) : u.value ? (t(), c("div", b, i(r(n)("Chargement de l'aperçu JSON...")), 1)) : g.value ? (t(), p(h, { key: 2 }, {
52
+ default: d(() => [
53
+ f(i(_.value ? r(n)("Le fichier JSON est trop volumineux pour être prévisualisé. Téléchargez-le depuis l'onglet Téléchargements.") : r(n)("La taille du fichier est inconnue, l'aperçu n'est pas disponible. Téléchargez-le depuis l'onglet Téléchargements.")), 1)
54
+ ]),
55
+ _: 1
56
+ })) : a.value === "network" ? (t(), p(h, { key: 3 }, {
57
+ default: d(() => [
58
+ f(i(r(n)("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.")), 1)
59
+ ]),
60
+ _: 1
61
+ })) : a.value ? (t(), p(h, { key: 4 }, {
62
+ default: d(() => [
63
+ f(i(r(n)("L'aperçu de ce fichier n'a pas pu être chargé. Téléchargez-le depuis l'onglet Téléchargements.")), 1)
64
+ ]),
65
+ _: 1
66
+ })) : S("", !0)
67
+ ]));
68
+ }
69
+ });
70
+ export {
71
+ j as default
72
+ };
@@ -1,21 +1,21 @@
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({
1
+ import { defineComponent as E, useTemplateRef as G, ref as W, onMounted as B, createBlock as z, createElementBlock as N, openBlock as m, withCtx as U, createTextVNode as V, toDisplayString as q, unref as A } from "vue";
2
+ import { a as D, _ as F } from "./main-vqhkVhVS.js";
3
+ const Z = /* @__PURE__ */ E({
4
4
  __name: "MapContainer.client",
5
5
  props: {
6
6
  resource: {}
7
7
  },
8
8
  setup(f) {
9
- const a = f, { t: d } = D();
9
+ const r = f, { t: d } = D();
10
10
  let e = null;
11
- const r = W("mapRef"), n = z(!1);
11
+ const a = G("mapRef"), n = W(!1);
12
12
  async function w() {
13
13
  const [
14
14
  { default: i },
15
15
  { default: s },
16
16
  { default: y },
17
- { default: h },
18
17
  { default: C },
18
+ { default: h },
19
19
  _
20
20
  ] = await Promise.all([
21
21
  import("./View-BR92hTWP.js").then((t) => t.M),
@@ -24,13 +24,13 @@ const j = /* @__PURE__ */ G({
24
24
  import("./Tile-DbNFNPfU.js").then((t) => t.d),
25
25
  import("./OSM-s40W6sQ2.js"),
26
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,
27
+ import("./index-BFQX7Ccz.js")
28
+ ]), { CRS: S, GeoportalAttribution: g, GeoportalFullScreen: M, GeoportalZoom: b, LayerImport: v, LayerSwitcher: L } = _;
29
+ await Promise.resolve({ }), await Promise.resolve({ }), await Promise.resolve({ }), await Promise.resolve({ }), S.load(), e = new s({
30
+ target: a.value,
31
31
  layers: [
32
- new h({
33
- source: new C()
32
+ new C({
33
+ source: new h()
34
34
  })
35
35
  ],
36
36
  view: new i({
@@ -44,62 +44,59 @@ const j = /* @__PURE__ */ G({
44
44
  bar: !1
45
45
  });
46
46
  e.addControl(R);
47
- const k = new M({
47
+ const T = new M({
48
48
  position: "top-right"
49
49
  });
50
- e.addControl(k);
51
- const T = new b({
50
+ e.addControl(T);
51
+ const k = new b({
52
52
  position: "bottom-left"
53
53
  });
54
- e.addControl(T);
55
- const x = new L({
54
+ e.addControl(k);
55
+ const I = new L({
56
56
  options: {
57
57
  position: "top-right"
58
58
  }
59
59
  });
60
- e.addControl(x);
61
- const E = new S({
60
+ e.addControl(I);
61
+ const l = new g({
62
62
  position: "bottom-right"
63
+ // collapsed option is ignored by the library, thus the override below
64
+ // see https://github.com/IGNF/geopf-extensions-openlayers/issues/497
63
65
  });
64
- e.addControl(E);
66
+ l.setCollapsed(!1), e.addControl(l);
65
67
  const o = new v({
66
68
  position: "bottom-left",
67
69
  listable: !0,
68
70
  layerTypes: ["WMS"]
69
71
  });
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() {
72
+ o._serviceUrlImportInput.value = r.resource.url, o._formContainer.dispatchEvent(new CustomEvent("submit", { cancelable: !0 })), e.addControl(o);
73
+ const p = 500;
74
+ let c = 20;
75
+ function u() {
74
76
  if (!o._getCapResponseWMSLayers)
75
- p--, p > 0 ? setTimeout(c, l) : n.value = !0;
77
+ c--, c > 0 ? setTimeout(u, p) : n.value = !0;
76
78
  else {
77
- const t = o._getCapResponseWMSLayers.filter((I) => I.Name == a.resource.title)[0];
79
+ const t = o._getCapResponseWMSLayers.filter((x) => x.Name == r.resource.title)[0];
78
80
  o._addGetCapWMSLayer(t);
79
81
  }
80
82
  }
81
- setTimeout(c, l);
83
+ setTimeout(u, p);
82
84
  }
83
85
  return B(() => {
84
86
  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)
87
+ }), (i, s) => n.value ? (m(), z(F, { key: 0 }, {
88
+ default: U(() => [
89
+ V(q(A(d)("L'aperçu cartographique de ce fichier n'a pas pu être chargé.")), 1)
93
90
  ]),
94
91
  _: 1
95
- })) : (u(), N("div", {
92
+ })) : (m(), N("div", {
96
93
  key: 1,
97
94
  id: "map",
98
95
  ref_key: "mapRef",
99
- ref: r
96
+ ref: a
100
97
  }, null, 512));
101
98
  }
102
99
  });
103
100
  export {
104
- j as default
101
+ Z as default
105
102
  };