@datagouv/components-next 1.4.1-dev.1363.ga6a9113d → 1.4.1-dev.1369.ge90e64f3

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 (43) hide show
  1. package/dist/Datafair.client-Ci2WOgAS.js +28 -0
  2. package/dist/ImagePreview.client-B4RtxuiJ.js +36 -0
  3. package/dist/{JsonPreview.client-DcnN7kTh.js → JsonPreview.client-r7swv2fp.js} +13 -5
  4. package/dist/MapContainer.client-CxH1a8Tn.js +75 -0
  5. package/dist/{PdfPreview.client-D-jPm4dP.js → PdfPreview.client-BjeMcqcy.js} +783 -773
  6. package/dist/{PdfSkeleton-5HBfBlXx.js → PdfSkeleton-CVZxJaeL.js} +1 -1
  7. package/dist/{Pmtiles.client-DBaMKSO-.js → Pmtiles.client-D8idR2l7.js} +44 -44
  8. package/dist/{config-jrnuUDOH.js → PreviewError-Cx7CItT_.js} +11729 -9691
  9. package/dist/PreviewWrapper-Cd1RSmS-.js +62 -0
  10. package/dist/{XmlPreview.client-WnIR6jRO.js → XmlPreview.client-cSebx8br.js} +13 -5
  11. package/dist/components-next.css +1 -1
  12. package/dist/components-next.js +10841 -11704
  13. package/dist/components.css +1 -1
  14. package/dist/france-DPcdJc84.js +75 -0
  15. package/package.json +1 -1
  16. package/src/components/ResourceAccordion/Datafair.client.vue +8 -6
  17. package/src/components/ResourceAccordion/ImagePreview.client.vue +22 -10
  18. package/src/components/ResourceAccordion/JsonPreview.client.vue +2 -0
  19. package/src/components/ResourceAccordion/MapContainer.client.vue +13 -5
  20. package/src/components/ResourceAccordion/PdfPreview.client.vue +15 -0
  21. package/src/components/ResourceAccordion/Pmtiles.client.vue +6 -4
  22. package/src/components/ResourceAccordion/Preview.vue +13 -5
  23. package/src/components/ResourceAccordion/PreviewError.vue +148 -0
  24. package/src/components/ResourceAccordion/PreviewWrapper.vue +63 -20
  25. package/src/components/ResourceAccordion/ResourceAccordion.vue +54 -67
  26. package/src/components/ResourceAccordion/UrlPreview.vue +31 -0
  27. package/src/components/ResourceAccordion/XmlPreview.client.vue +2 -0
  28. package/src/components/ResourceExplorer/ResourceExplorer.vue +3 -1
  29. package/src/components/ResourceExplorer/ResourceExplorerViewer.vue +24 -22
  30. package/src/components/TabularExplorer/TabularExplorer.vue +6 -6
  31. package/src/composables/useResourceCapabilities.ts +27 -11
  32. package/src/config.ts +1 -0
  33. package/src/functions/previewErrors.ts +188 -0
  34. package/src/functions/resources.ts +22 -1
  35. package/src/main.ts +1 -0
  36. package/dist/Datafair.client-DV0kxqBW.js +0 -27
  37. package/dist/ImagePreview.client-0mW3sY5X.js +0 -30
  38. package/dist/MapContainer.client-ZoJqauC6.js +0 -74
  39. package/dist/PreviewUnavailable-BJkpCiyL.js +0 -82
  40. package/dist/PreviewWrapper-DEl1D2rR.js +0 -47
  41. package/dist/france-DxksUv5K.js +0 -694
  42. package/dist/resources-CmwQ4DAB.js +0 -316
  43. package/src/components/ResourceAccordion/PreviewUnavailable.vue +0 -22
@@ -0,0 +1,28 @@
1
+ import { a as e, t } from "./PreviewError-Cx7CItT_.js";
2
+ import { computed as n, createBlock as r, createElementBlock as i, createElementVNode as a, defineComponent as o, openBlock as s } from "vue";
3
+ //#region src/components/ResourceAccordion/Datafair.client.vue?vue&type=script&setup=true&lang.ts
4
+ var c = { class: "fr-text--xs" }, l = { key: 0 }, u = ["src"], d = /* @__PURE__ */ o({
5
+ __name: "Datafair.client",
6
+ props: {
7
+ resource: {},
8
+ dataset: {}
9
+ },
10
+ setup(o) {
11
+ let d = o, f = n(() => e(d.resource)), p = n(() => d.resource.extras.datafairOrigin || d.dataset.extras.datafairOrigin), m = n(() => d.resource.extras.datafairDatasetId || d.dataset.extras.datafairDatasetId), h = n(() => d.resource.extras.datafairEmbed), g = n(() => !p.value || !m.value ? null : `${p.value}/embed/dataset/${m.value}/${h.value}`);
12
+ return (e, n) => (s(), i("div", c, [g.value ? (s(), i("div", l, [a("iframe", {
13
+ src: g.value,
14
+ width: "100%",
15
+ height: "500px",
16
+ style: {
17
+ "background-color": "transparent",
18
+ border: "none"
19
+ }
20
+ }, null, 8, u)])) : (s(), r(t, {
21
+ key: 1,
22
+ resource: o.resource,
23
+ "error-type": f.value
24
+ }, null, 8, ["resource", "error-type"]))]));
25
+ }
26
+ });
27
+ //#endregion
28
+ export { d as default };
@@ -0,0 +1,36 @@
1
+ import { H as e, L as t, _ as n, i as r, t as i } from "./PreviewError-Cx7CItT_.js";
2
+ import { computed as a, createBlock as o, createElementBlock as s, defineComponent as c, openBlock as l, ref as u } from "vue";
3
+ //#region src/components/ResourceAccordion/ImagePreview.client.vue?vue&type=script&setup=true&lang.ts
4
+ var d = { class: "text-xs" }, f = ["src"], p = /* @__PURE__ */ c({
5
+ __name: "ImagePreview.client",
6
+ props: {
7
+ resource: {},
8
+ canEdit: { type: Boolean }
9
+ },
10
+ setup(c) {
11
+ let p = c, { t: m } = e(), h = t(), g = u(!1), _ = a(() => p.resource.format?.toUpperCase() ?? m("Fichier")), v = a(() => n(p.resource)), y = a(() => {
12
+ let e = v.value, t = h.maxImagePreviewByteSize;
13
+ return !e || !t ? !1 : e <= t;
14
+ }), b = a(() => r(p.resource) === "unavailable"), x = a(() => b.value ? "unavailable" : g.value ? "network" : v.value ? "too_large" : "too_large_unsized");
15
+ return (e, t) => (l(), s("div", d, [!y.value || g.value ? (l(), o(i, {
16
+ key: 0,
17
+ resource: c.resource,
18
+ "error-type": x.value,
19
+ "file-type": _.value,
20
+ "show-producer-cta": c.canEdit
21
+ }, null, 8, [
22
+ "resource",
23
+ "error-type",
24
+ "file-type",
25
+ "show-producer-cta"
26
+ ])) : (l(), s("img", {
27
+ key: 1,
28
+ src: c.resource.url,
29
+ alt: "",
30
+ class: "block w-full h-auto max-w-[800px]",
31
+ onError: t[0] ||= (e) => g.value = !0
32
+ }, null, 40, f))]));
33
+ }
34
+ });
35
+ //#endregion
36
+ export { p as default };
@@ -1,11 +1,14 @@
1
- import { n as e } from "./config-jrnuUDOH.js";
2
- import { t } from "./PreviewWrapper-DEl1D2rR.js";
1
+ import { L as e } from "./PreviewError-Cx7CItT_.js";
2
+ import { t } from "./PreviewWrapper-Cd1RSmS-.js";
3
3
  import { createBlock as n, createVNode as r, defineAsyncComponent as i, defineComponent as a, openBlock as o, unref as s, withCtx as c } from "vue";
4
4
  //#endregion
5
5
  //#region src/components/ResourceAccordion/JsonPreview.client.vue
6
6
  var l = /* @__PURE__ */ a({
7
7
  __name: "JsonPreview.client",
8
- props: { resource: {} },
8
+ props: {
9
+ resource: {},
10
+ canEdit: { type: Boolean }
11
+ },
9
12
  setup(a) {
10
13
  let l = i(() => import("./vue3-json-viewer-BJgUfh-l.js").then((e) => (Promise.resolve({ }), e.JsonViewer))), u = a, d = e(), f = async () => {
11
14
  let e = await fetch(u.resource.url);
@@ -16,7 +19,8 @@ var l = /* @__PURE__ */ a({
16
19
  "file-type": "JSON",
17
20
  resource: a.resource,
18
21
  "max-size": s(d).maxJsonPreviewCharSize,
19
- load: f
22
+ load: f,
23
+ "can-edit": a.canEdit
20
24
  }, {
21
25
  default: c(({ data: e }) => [r(s(l), {
22
26
  value: e,
@@ -28,7 +32,11 @@ var l = /* @__PURE__ */ a({
28
32
  "indent-width": 2
29
33
  }, null, 8, ["value"])]),
30
34
  _: 1
31
- }, 8, ["resource", "max-size"]));
35
+ }, 8, [
36
+ "resource",
37
+ "max-size",
38
+ "can-edit"
39
+ ]));
32
40
  }
33
41
  });
34
42
  //#endregion
@@ -0,0 +1,75 @@
1
+ import { H as e, j as t, t as n } from "./PreviewError-Cx7CItT_.js";
2
+ import { createBlock as r, createElementBlock as i, defineComponent as a, onMounted as o, openBlock as s, ref as c, useTemplateRef as l } from "vue";
3
+ //#endregion
4
+ //#region src/components/ResourceAccordion/MapContainer.client.vue
5
+ var u = /* @__PURE__ */ a({
6
+ __name: "MapContainer.client",
7
+ props: { resource: {} },
8
+ setup(a) {
9
+ let u = a, { t: d } = e(), f = null, p = l("mapRef"), m = c(!1);
10
+ async function h() {
11
+ let [{ default: e }, { default: n }, { default: r }, { default: i }, { default: a }, o] = await Promise.all([
12
+ import("./View-DWqx4Jqr.js").then((e) => e.n),
13
+ import("./Map-QeL96qbQ.js").then((e) => e.n),
14
+ import("./ScaleLine-Cwwk9wJo.js"),
15
+ import("./Tile-BV44yf69.js").then((e) => e.n),
16
+ import("./OSM-DT4I7v8A.js"),
17
+ import("./src-D_UE0st7.js")
18
+ ]), { CRS: s, GeoportalAttribution: c, GeoportalFullScreen: l, GeoportalZoom: h, LayerImport: g, LayerSwitcher: _ } = o;
19
+ await Promise.resolve({ }), await Promise.resolve({ }), await Promise.resolve({ }), await Promise.resolve({ }), s.load(), f = new n({
20
+ target: p.value,
21
+ layers: [new i({ source: new a() })],
22
+ view: new e({
23
+ center: [288074.8449901076, 6247982.515792289],
24
+ zoom: 8,
25
+ constrainResolution: !0
26
+ })
27
+ });
28
+ let v = new r({
29
+ units: "metric",
30
+ bar: !1
31
+ });
32
+ f.addControl(v);
33
+ let y = new l({ position: "top-right" });
34
+ f.addControl(y);
35
+ let b = new h({ position: "bottom-left" });
36
+ f.addControl(b);
37
+ let x = new _({ options: { position: "top-right" } });
38
+ f.addControl(x);
39
+ let S = new c({
40
+ position: "bottom-right",
41
+ collapsed: !1
42
+ });
43
+ f.addControl(S);
44
+ let C = new g({
45
+ position: "bottom-left",
46
+ listable: !0,
47
+ layerTypes: ["WMS"]
48
+ }), w = C;
49
+ w._serviceUrlImportInput.value = u.resource.url, w._formContainer.dispatchEvent(new CustomEvent("submit", { cancelable: !0 })), f.addControl(C);
50
+ let T = 20;
51
+ function E() {
52
+ if (!w._getCapResponseWMSLayers) T--, T > 0 ? setTimeout(E, 500) : m.value = !0;
53
+ else {
54
+ let e = w._getCapResponseWMSLayers.filter((e) => e.Name == u.resource.title)[0];
55
+ e ? w._addGetCapWMSLayer(e) : t.info(d("La couche n'a pas pu être détectée automatiquement. Ajoutez-la via l'outil d'import de couches depuis la carte"));
56
+ }
57
+ }
58
+ setTimeout(E, 500);
59
+ }
60
+ return o(() => {
61
+ h();
62
+ }), (e, t) => m.value ? (s(), r(n, {
63
+ key: 0,
64
+ resource: a.resource,
65
+ "error-type": "map_load"
66
+ }, null, 8, ["resource"])) : (s(), i("div", {
67
+ key: 1,
68
+ ref_key: "mapRef",
69
+ ref: p,
70
+ class: "size-full"
71
+ }, null, 512));
72
+ }
73
+ });
74
+ //#endregion
75
+ export { u as default };