@datagouv/components-next 1.4.1-dev.1361.g08f7a0a4 → 1.4.1-dev.1366.ga52eaed5
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-Ci2WOgAS.js +28 -0
- package/dist/ImagePreview.client-B4RtxuiJ.js +36 -0
- package/dist/{JsonPreview.client-DcnN7kTh.js → JsonPreview.client-r7swv2fp.js} +13 -5
- package/dist/MapContainer.client-CxH1a8Tn.js +75 -0
- package/dist/{PdfPreview.client-D-jPm4dP.js → PdfPreview.client-BjeMcqcy.js} +783 -773
- package/dist/{PdfSkeleton-5HBfBlXx.js → PdfSkeleton-CVZxJaeL.js} +1 -1
- package/dist/{Pmtiles.client-DBaMKSO-.js → Pmtiles.client-D8idR2l7.js} +44 -44
- package/dist/{config-jrnuUDOH.js → PreviewError-Cx7CItT_.js} +11729 -9691
- package/dist/PreviewWrapper-Cd1RSmS-.js +62 -0
- package/dist/{XmlPreview.client-WnIR6jRO.js → XmlPreview.client-cSebx8br.js} +13 -5
- package/dist/components-next.css +1 -1
- package/dist/components-next.js +10841 -11704
- package/dist/components.css +1 -1
- package/dist/france-DPcdJc84.js +75 -0
- package/package.json +1 -1
- package/src/components/ResourceAccordion/Datafair.client.vue +8 -6
- package/src/components/ResourceAccordion/ImagePreview.client.vue +22 -10
- package/src/components/ResourceAccordion/JsonPreview.client.vue +2 -0
- package/src/components/ResourceAccordion/MapContainer.client.vue +13 -5
- package/src/components/ResourceAccordion/PdfPreview.client.vue +15 -0
- package/src/components/ResourceAccordion/Pmtiles.client.vue +6 -4
- package/src/components/ResourceAccordion/Preview.vue +13 -5
- package/src/components/ResourceAccordion/PreviewError.vue +148 -0
- package/src/components/ResourceAccordion/PreviewWrapper.vue +63 -20
- package/src/components/ResourceAccordion/ResourceAccordion.vue +54 -67
- package/src/components/ResourceAccordion/UrlPreview.vue +31 -0
- package/src/components/ResourceAccordion/XmlPreview.client.vue +2 -0
- package/src/components/ResourceExplorer/ResourceExplorer.vue +3 -1
- package/src/components/ResourceExplorer/ResourceExplorerViewer.vue +24 -22
- package/src/components/TabularExplorer/TabularExplorer.vue +6 -6
- package/src/composables/useResourceCapabilities.ts +27 -11
- package/src/config.ts +1 -0
- package/src/functions/previewErrors.ts +188 -0
- package/src/functions/resources.ts +22 -1
- package/src/main.ts +1 -0
- package/dist/Datafair.client-DV0kxqBW.js +0 -27
- package/dist/ImagePreview.client-0mW3sY5X.js +0 -30
- package/dist/MapContainer.client-ZoJqauC6.js +0 -74
- package/dist/PreviewUnavailable-BJkpCiyL.js +0 -82
- package/dist/PreviewWrapper-DEl1D2rR.js +0 -47
- package/dist/france-DxksUv5K.js +0 -694
- package/dist/resources-CmwQ4DAB.js +0 -316
- package/src/components/ResourceAccordion/PreviewUnavailable.vue +0 -22
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { H as e, _ as t, h as n, t as r } from "./PreviewError-Cx7CItT_.js";
|
|
2
|
+
import { computed as i, createBlock as a, createElementBlock as o, createElementVNode as s, createSlots as c, defineComponent as l, nextTick as u, normalizeClass as d, onMounted as f, openBlock as p, ref as m, renderSlot as h, toDisplayString as g, unref as _, withCtx as v } from "vue";
|
|
3
|
+
//#region src/components/ResourceAccordion/PreviewWrapper.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var y = { class: "text-gray-medium" }, b = /* @__PURE__ */ l({
|
|
5
|
+
__name: "PreviewWrapper",
|
|
6
|
+
props: {
|
|
7
|
+
fileType: {},
|
|
8
|
+
resource: {},
|
|
9
|
+
maxSize: {},
|
|
10
|
+
load: { type: Function },
|
|
11
|
+
fill: { type: Boolean },
|
|
12
|
+
canEdit: { type: Boolean }
|
|
13
|
+
},
|
|
14
|
+
emits: ["loaded"],
|
|
15
|
+
setup(l, { emit: b }) {
|
|
16
|
+
let x = l, S = b, { t: C } = e(), w = m(null), T = m(!1), E = m(null), D = m(!1), O = i(() => t(x.resource)), k = i(() => n(x.resource)), A = i(() => x.resource.extras["check:available"] === !1), j = i(() => {
|
|
17
|
+
if (D.value) return !0;
|
|
18
|
+
let e = O.value, t = x.maxSize;
|
|
19
|
+
return e ? !t || e <= t : !1;
|
|
20
|
+
}), M = i(() => {
|
|
21
|
+
if (A.value) return "unavailable";
|
|
22
|
+
if (E.value === "network") return "network";
|
|
23
|
+
if (E.value) return "unknown";
|
|
24
|
+
if (k.value === "blocked") return "cors";
|
|
25
|
+
if (!j.value) return O.value ? "too_large" : "too_large_unsized";
|
|
26
|
+
});
|
|
27
|
+
async function N() {
|
|
28
|
+
if (!A.value && j.value && k.value !== "blocked" && !(w.value !== null || T.value)) {
|
|
29
|
+
T.value = !0;
|
|
30
|
+
try {
|
|
31
|
+
w.value = await x.load(), await u(), S("loaded");
|
|
32
|
+
} catch (e) {
|
|
33
|
+
console.error("Error loading preview:", e), E.value = e instanceof TypeError ? "network" : "generic";
|
|
34
|
+
} finally {
|
|
35
|
+
T.value = !1;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
f(N);
|
|
40
|
+
function P() {
|
|
41
|
+
D.value = !0, N();
|
|
42
|
+
}
|
|
43
|
+
return (e, t) => (p(), o("div", { class: d(["text-xs", l.fill ? "flex min-h-0 flex-1 flex-col" : ""]) }, [w.value === null ? T.value ? h(e.$slots, "loading", {}, () => [s("div", y, g(_(C)("Chargement de l'aperçu {fileType}...", { fileType: l.fileType })), 1)], void 0, 1) : (p(), a(r, {
|
|
44
|
+
key: 2,
|
|
45
|
+
resource: l.resource,
|
|
46
|
+
"error-type": M.value,
|
|
47
|
+
"file-type": l.fileType,
|
|
48
|
+
"show-producer-cta": l.canEdit
|
|
49
|
+
}, c({ _: 2 }, [e.$slots["too-large-action"] ? {
|
|
50
|
+
name: "too-large-action",
|
|
51
|
+
fn: v(() => [h(e.$slots, "too-large-action", { force: P })]),
|
|
52
|
+
key: "0"
|
|
53
|
+
} : void 0]), 1032, [
|
|
54
|
+
"resource",
|
|
55
|
+
"error-type",
|
|
56
|
+
"file-type",
|
|
57
|
+
"show-producer-cta"
|
|
58
|
+
])) : h(e.$slots, "default", { data: w.value }, void 0, void 0, 0)], 2));
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
//#endregion
|
|
62
|
+
export { b as t };
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { o as e } from "./rolldown-runtime-CEFd7nDs.js";
|
|
2
|
-
import {
|
|
3
|
-
import { t as n } from "./PreviewWrapper-
|
|
2
|
+
import { L as t } from "./PreviewError-Cx7CItT_.js";
|
|
3
|
+
import { t as n } from "./PreviewWrapper-Cd1RSmS-.js";
|
|
4
4
|
import { createBlock as r, createVNode as i, defineAsyncComponent as a, defineComponent as o, openBlock as s, unref as c, withCtx as l } from "vue";
|
|
5
5
|
//#endregion
|
|
6
6
|
//#region src/components/ResourceAccordion/XmlPreview.client.vue
|
|
7
7
|
var u = /* @__PURE__ */ o({
|
|
8
8
|
__name: "XmlPreview.client",
|
|
9
|
-
props: {
|
|
9
|
+
props: {
|
|
10
|
+
resource: {},
|
|
11
|
+
canEdit: { type: Boolean }
|
|
12
|
+
},
|
|
10
13
|
setup(o) {
|
|
11
14
|
let u = a(() => import("./vue3-xml-viewer.common-DbJwzvCC.js").then((t) => /* @__PURE__ */ e(t.default, 1)).then((e) => e.default || e.XmlViewer)), d = o, f = t(), p = async () => {
|
|
12
15
|
let e = await fetch(d.resource.url);
|
|
@@ -17,11 +20,16 @@ var u = /* @__PURE__ */ o({
|
|
|
17
20
|
"file-type": "XML",
|
|
18
21
|
resource: o.resource,
|
|
19
22
|
"max-size": c(f).maxXmlPreviewCharSize,
|
|
20
|
-
load: p
|
|
23
|
+
load: p,
|
|
24
|
+
"can-edit": o.canEdit
|
|
21
25
|
}, {
|
|
22
26
|
default: l(({ data: e }) => [i(c(u), { xml: e }, null, 8, ["xml"])]),
|
|
23
27
|
_: 1
|
|
24
|
-
}, 8, [
|
|
28
|
+
}, 8, [
|
|
29
|
+
"resource",
|
|
30
|
+
"max-size",
|
|
31
|
+
"can-edit"
|
|
32
|
+
]));
|
|
25
33
|
}
|
|
26
34
|
});
|
|
27
35
|
//#endregion
|