@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.
- 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,188 @@
|
|
|
1
|
+
import { hasTabularParsingError, isTabularPipelineFormat } from './resources'
|
|
2
|
+
import type { Resource } from '../types/resources'
|
|
3
|
+
import { useTranslation } from '../composables/useTranslation'
|
|
4
|
+
|
|
5
|
+
// Every error type, whether diagnosed from the resource's metadata (`none`,
|
|
6
|
+
// `unavailable`, `too_large`…) or known only at runtime (the wrapper's own
|
|
7
|
+
// `network`, `cors`, `load_failed`, etc.).
|
|
8
|
+
export type PreviewErrorType
|
|
9
|
+
= | 'cors'
|
|
10
|
+
| 'network'
|
|
11
|
+
| 'unavailable'
|
|
12
|
+
| 'too_large'
|
|
13
|
+
| 'too_large_unsized'
|
|
14
|
+
| 'malformed'
|
|
15
|
+
| 'unknown'
|
|
16
|
+
| 'load_failed'
|
|
17
|
+
| 'map_load'
|
|
18
|
+
| 'map_generation'
|
|
19
|
+
| 'none'
|
|
20
|
+
|
|
21
|
+
type PreviewErrorInfo = {
|
|
22
|
+
type: PreviewErrorType
|
|
23
|
+
message: string
|
|
24
|
+
userCta?: string
|
|
25
|
+
producerCta?: string
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Determine the type of preview error based on resource metadata
|
|
30
|
+
*/
|
|
31
|
+
export function getPreviewErrorType(resource: Resource): PreviewErrorType {
|
|
32
|
+
const extras = resource.extras
|
|
33
|
+
|
|
34
|
+
// A diagnosed availability failure (the robot's check could not reach the
|
|
35
|
+
// file) is the actual cause: like the runtime wrapper (PreviewWrapper), it
|
|
36
|
+
// wins over the size/status heuristics, which would blame the file for
|
|
37
|
+
// not loading.
|
|
38
|
+
if (extras['check:available'] === false) {
|
|
39
|
+
return 'unavailable'
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Note: there's no CORS branch here on purpose. A blocked origin is only
|
|
43
|
+
// relevant for the fetch-based previews (pdf/json/xml), which detect and
|
|
44
|
+
// diagnose it at runtime in PreviewWrapper (`getResourceCorsStatus`).
|
|
45
|
+
|
|
46
|
+
// Check for file too large for tabular formats
|
|
47
|
+
if (extras['analysis:error'] === 'File too large to download' && isTabularPipelineFormat(resource.format)) {
|
|
48
|
+
return 'too_large'
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Check for tabular parsing errors (malformed).
|
|
52
|
+
if (hasTabularParsingError(resource)) {
|
|
53
|
+
return 'malformed'
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Check for general analysis errors
|
|
57
|
+
if (extras['analysis:error']) {
|
|
58
|
+
return 'unknown'
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return 'none'
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The single source of every preview error text and CTA. Callers never build
|
|
66
|
+
* their own sentences: they pass an error type (explicit when they know the cause
|
|
67
|
+
* better than the metadata does) and receive message + CTAs.
|
|
68
|
+
*/
|
|
69
|
+
export function getPreviewErrorInfoByType(errorType: PreviewErrorType, resource?: Resource, fileType?: string): PreviewErrorInfo {
|
|
70
|
+
// Translated at call time so the strings track the detected locale: the keys
|
|
71
|
+
// are the French texts, like everywhere else in the package (e.g.
|
|
72
|
+
// `getResourceLabel`).
|
|
73
|
+
const { t } = useTranslation()
|
|
74
|
+
|
|
75
|
+
switch (errorType) {
|
|
76
|
+
case 'cors':
|
|
77
|
+
return {
|
|
78
|
+
type: 'cors',
|
|
79
|
+
message: t('Ce fichier est hébergé sur un site externe qui n’autorise pas son affichage dans data.gouv.fr.'),
|
|
80
|
+
userCta: t('Signaler un problème avec cet aperçu'),
|
|
81
|
+
producerCta: t('Signaler un problème'),
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
case 'network':
|
|
85
|
+
return {
|
|
86
|
+
type: 'network',
|
|
87
|
+
message: t('Ce fichier hébergé sur un site externe n’a pas pu être chargé.'),
|
|
88
|
+
userCta: t('Signaler un problème avec cet aperçu'),
|
|
89
|
+
producerCta: t('Signaler un problème'),
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
case 'unavailable':
|
|
93
|
+
return {
|
|
94
|
+
type: 'unavailable',
|
|
95
|
+
message: t('Ce fichier est hébergé sur un site externe et n’est pas disponible'),
|
|
96
|
+
userCta: t('Signaler un problème avec cet aperçu'),
|
|
97
|
+
producerCta: t('Signaler un problème'),
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
case 'too_large':
|
|
101
|
+
case 'too_large_unsized':
|
|
102
|
+
return {
|
|
103
|
+
type: errorType,
|
|
104
|
+
message: errorType === 'too_large_unsized'
|
|
105
|
+
? t('La taille du fichier est inconnue. Il est possible que le fichier soit trop volumineux pour être prévisualisé.')
|
|
106
|
+
: fileType
|
|
107
|
+
? t('Ce fichier {fileType} est trop volumineux pour être prévisualisé.', { fileType })
|
|
108
|
+
: t('Ce fichier est trop volumineux pour être prévisualisé.'),
|
|
109
|
+
// Only tabular-pipeline files can be re-processed server-side with a
|
|
110
|
+
// larger quota: asking for it on a client-side preview (PDF…) is noise.
|
|
111
|
+
userCta: resource && isTabularPipelineFormat(resource.format) ? t('Cette prévisualisation vous serait utile ?') : '',
|
|
112
|
+
producerCta: resource && isTabularPipelineFormat(resource.format) ? t('Cette prévisualisation vous serait utile ?') : '',
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
case 'malformed':
|
|
116
|
+
return {
|
|
117
|
+
type: 'malformed',
|
|
118
|
+
message: t('La structure de ce fichier ne permet pas d\'afficher son aperçu'),
|
|
119
|
+
userCta: '',
|
|
120
|
+
producerCta: t('Signaler un problème'),
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// A runtime failure with no clear CTA
|
|
124
|
+
case 'load_failed':
|
|
125
|
+
return {
|
|
126
|
+
type: 'load_failed',
|
|
127
|
+
message: t('L\'aperçu de ce fichier n\'a pas pu être chargé.'),
|
|
128
|
+
userCta: '',
|
|
129
|
+
producerCta: '',
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
case 'map_load':
|
|
133
|
+
return {
|
|
134
|
+
type: 'map_load',
|
|
135
|
+
message: t('L\'aperçu cartographique de ce fichier n\'a pas pu être chargé.'),
|
|
136
|
+
userCta: t('Signaler un problème avec cet aperçu'),
|
|
137
|
+
producerCta: t('Signaler un problème'),
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
case 'map_generation':
|
|
141
|
+
return {
|
|
142
|
+
type: 'map_generation',
|
|
143
|
+
message: t('La carte n\'a pas pu être générée automatiquement pour ce fichier.'),
|
|
144
|
+
userCta: '',
|
|
145
|
+
producerCta: '',
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
case 'none':
|
|
149
|
+
return {
|
|
150
|
+
type: 'none',
|
|
151
|
+
message: t('Ce fichier ne peut pas être prévisualisé.'),
|
|
152
|
+
userCta: '',
|
|
153
|
+
producerCta: '',
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
case 'unknown':
|
|
157
|
+
default:
|
|
158
|
+
return {
|
|
159
|
+
type: 'unknown',
|
|
160
|
+
message: t('Une erreur a empêché le chargement de l\'aperçu de ce fichier.'),
|
|
161
|
+
userCta: t('Signaler un problème avec cet aperçu'),
|
|
162
|
+
producerCta: t('Signaler un problème'),
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Get error information for preview failures
|
|
169
|
+
*/
|
|
170
|
+
export function getPreviewErrorInfo(resource: Resource, fileType?: string): PreviewErrorInfo {
|
|
171
|
+
return getPreviewErrorInfoByType(getPreviewErrorType(resource), resource, fileType)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* The error type to pass as `errorType` to `PreviewError` when a runtime
|
|
176
|
+
* failure occurred but the metadata alone gives no cause: describe a failure
|
|
177
|
+
* rather than claiming the file can't be previewed.
|
|
178
|
+
*/
|
|
179
|
+
export function getTransientErrorType(resource: Resource): PreviewErrorType | undefined {
|
|
180
|
+
return getPreviewErrorType(resource) === 'none' ? 'load_failed' : undefined
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Check if a resource has any preview error
|
|
185
|
+
*/
|
|
186
|
+
export function hasPreviewError(resource: Resource): boolean {
|
|
187
|
+
return getPreviewErrorType(resource) !== 'none'
|
|
188
|
+
}
|
|
@@ -207,6 +207,27 @@ export function isImagePreviewFormat(format: string | undefined | null): boolean
|
|
|
207
207
|
return IMAGE_PREVIEW_FORMATS.includes(format.toLowerCase() as typeof IMAGE_PREVIEW_FORMATS[number])
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
+
// Formats turned into an interactive table server-side. Source of truth is
|
|
211
|
+
// hydra's `data_formats/`: csv_like (Csv handling *.gz, Xls, Xlsx) and parquet
|
|
212
|
+
// both convert to a PostgreSQL table; hydra does not expose this list via its
|
|
213
|
+
// API yet (get it there before drifting).
|
|
214
|
+
const TABULAR_PIPELINE_FORMATS = ['csv', 'csv.gz', 'xls', 'xlsx', 'parquet']
|
|
215
|
+
|
|
216
|
+
export function isTabularPipelineFormat(format: string | undefined | null): boolean {
|
|
217
|
+
if (!format) return false
|
|
218
|
+
const normalized = format.toLowerCase()
|
|
219
|
+
return TABULAR_PIPELINE_FORMATS.includes(normalized)
|
|
220
|
+
|| (normalized.endsWith('.gz') && TABULAR_PIPELINE_FORMATS.includes(normalized.slice(0, -3)))
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// GeoJSON is the only source hydra turns into a pmtiles map. Used to detect a
|
|
224
|
+
// pmtiles-export failure beyond the `analysis:parsing:error` step (e.g. a source
|
|
225
|
+
// too large to download). The payload may be wrapped in .zip/.gz.
|
|
226
|
+
export function isPmtilesSourceFormat(format: string | undefined | null): boolean {
|
|
227
|
+
if (!format) return false
|
|
228
|
+
return format.toLowerCase().replace(/\.(zip|gz)$/, '') === 'geojson'
|
|
229
|
+
}
|
|
230
|
+
|
|
210
231
|
// Parsing errors are stored as `<step>:<message>`, where `<step>` names the
|
|
211
232
|
// analysis step that failed (e.g. `pmtiles_export`, `geojson_export`).
|
|
212
233
|
|
|
@@ -274,7 +295,7 @@ export const getResourceCorsStatus = (resource: Resource): CorsStatus => {
|
|
|
274
295
|
const allowedMethods = rawMethods
|
|
275
296
|
? rawMethods.split(',').map(m => m.trim().toUpperCase())
|
|
276
297
|
: []
|
|
277
|
-
const supportsGet = allowedMethods.length === 0 || allowedMethods.
|
|
298
|
+
const supportsGet = allowedMethods.length === 0 || allowedMethods.some(m => m === '*' || m === 'GET')
|
|
278
299
|
|
|
279
300
|
return isOriginAllowed && supportsGet ? 'allowed' : 'blocked'
|
|
280
301
|
}
|
package/src/main.ts
CHANGED
|
@@ -147,6 +147,7 @@ export * from './functions/metrics'
|
|
|
147
147
|
export * from './functions/never'
|
|
148
148
|
export * from './functions/organizations'
|
|
149
149
|
export * from './functions/owned'
|
|
150
|
+
export * from './functions/previewErrors'
|
|
150
151
|
export * from './functions/resources'
|
|
151
152
|
export * from './functions/reuses'
|
|
152
153
|
export * from './functions/schemas'
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { o as e, t } from "./PreviewUnavailable-BJkpCiyL.js";
|
|
2
|
-
import { computed as n, createBlock as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, defineComponent as s, openBlock as c, toDisplayString as l, unref as u, withCtx as d } from "vue";
|
|
3
|
-
//#region src/components/ResourceAccordion/Datafair.client.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
-
var f = { class: "fr-text--xs" }, p = { key: 0 }, m = ["src"], h = /* @__PURE__ */ s({
|
|
5
|
-
__name: "Datafair.client",
|
|
6
|
-
props: {
|
|
7
|
-
resource: {},
|
|
8
|
-
dataset: {}
|
|
9
|
-
},
|
|
10
|
-
setup(s) {
|
|
11
|
-
let h = s, { t: g } = e(), _ = n(() => h.resource.extras.datafairOrigin || h.dataset.extras.datafairOrigin), v = n(() => h.resource.extras.datafairDatasetId || h.dataset.extras.datafairDatasetId), y = n(() => h.resource.extras.datafairEmbed), b = n(() => !_.value || !v.value ? null : `${_.value}/embed/dataset/${v.value}/${y.value}`);
|
|
12
|
-
return (e, n) => (c(), i("div", f, [b.value ? (c(), i("div", p, [a("iframe", {
|
|
13
|
-
src: b.value,
|
|
14
|
-
width: "100%",
|
|
15
|
-
height: "500px",
|
|
16
|
-
style: {
|
|
17
|
-
"background-color": "transparent",
|
|
18
|
-
border: "none"
|
|
19
|
-
}
|
|
20
|
-
}, null, 8, m)])) : (c(), r(t, { key: 1 }, {
|
|
21
|
-
default: d(() => [o(l(u(g)("L'aperçu de ce fichier n'a pas pu être chargé. Téléchargez-le pour le consulter.")), 1)]),
|
|
22
|
-
_: 1
|
|
23
|
-
}))]));
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
//#endregion
|
|
27
|
-
export { h as default };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { n as e } from "./config-jrnuUDOH.js";
|
|
2
|
-
import { o as t, t as n } from "./PreviewUnavailable-BJkpCiyL.js";
|
|
3
|
-
import { l as r } from "./resources-CmwQ4DAB.js";
|
|
4
|
-
import { computed as i, createBlock as a, createElementBlock as o, createTextVNode as s, defineComponent as c, openBlock as l, ref as u, toDisplayString as d, unref as f, withCtx as p } from "vue";
|
|
5
|
-
//#region src/components/ResourceAccordion/ImagePreview.client.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
-
var m = { class: "text-xs" }, h = ["src"], g = /* @__PURE__ */ c({
|
|
7
|
-
__name: "ImagePreview.client",
|
|
8
|
-
props: { resource: {} },
|
|
9
|
-
setup(c) {
|
|
10
|
-
let g = c, { t: _ } = t(), v = e(), y = u(!1), b = i(() => g.resource.format?.toUpperCase() ?? _("Fichier")), x = i(() => r(g.resource)), S = i(() => {
|
|
11
|
-
let e = x.value, t = v.maxImagePreviewByteSize;
|
|
12
|
-
return !e || !t ? !1 : e <= t;
|
|
13
|
-
});
|
|
14
|
-
return (e, t) => (l(), o("div", m, [S.value ? y.value ? (l(), a(n, { key: 1 }, {
|
|
15
|
-
default: p(() => [s(d(f(_)("L'aperçu de ce fichier n'a pas pu être chargé. Téléchargez-le pour le consulter.")), 1)]),
|
|
16
|
-
_: 1
|
|
17
|
-
})) : (l(), o("img", {
|
|
18
|
-
key: 2,
|
|
19
|
-
src: c.resource.url,
|
|
20
|
-
alt: "",
|
|
21
|
-
class: "block w-full h-auto max-w-[800px]",
|
|
22
|
-
onError: t[0] ||= (e) => y.value = !0
|
|
23
|
-
}, null, 40, h)) : (l(), a(n, { key: 0 }, {
|
|
24
|
-
default: p(() => [s(d(x.value ? f(_)("Le fichier {fileType} est trop volumineux pour être prévisualisé. Téléchargez-le pour le consulter.", { fileType: b.value }) : f(_)("La taille du fichier est inconnue, l'aperçu n'est pas disponible. Téléchargez-le pour le consulter.")), 1)]),
|
|
25
|
-
_: 1
|
|
26
|
-
}))]));
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
//#endregion
|
|
30
|
-
export { g as default };
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { o as e, t } from "./PreviewUnavailable-BJkpCiyL.js";
|
|
2
|
-
import { createBlock as n, createElementBlock as r, createTextVNode as i, defineComponent as a, onMounted as o, openBlock as s, ref as c, toDisplayString as l, unref as u, useTemplateRef as d, withCtx as f } from "vue";
|
|
3
|
-
//#endregion
|
|
4
|
-
//#region src/components/ResourceAccordion/MapContainer.client.vue
|
|
5
|
-
var p = /* @__PURE__ */ a({
|
|
6
|
-
__name: "MapContainer.client",
|
|
7
|
-
props: { resource: {} },
|
|
8
|
-
setup(a) {
|
|
9
|
-
let p = a, { t: m } = e(), h = null, g = d("mapRef"), _ = c(!1);
|
|
10
|
-
async function v() {
|
|
11
|
-
let [{ default: e }, { default: t }, { default: n }, { default: r }, { default: i }, a] = 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: o, GeoportalAttribution: s, GeoportalFullScreen: c, GeoportalZoom: l, LayerImport: u, LayerSwitcher: d } = a;
|
|
19
|
-
await Promise.resolve({ }), await Promise.resolve({ }), await Promise.resolve({ }), await Promise.resolve({ }), o.load(), h = new t({
|
|
20
|
-
target: g.value,
|
|
21
|
-
layers: [new r({ source: new i() })],
|
|
22
|
-
view: new e({
|
|
23
|
-
center: [288074.8449901076, 6247982.515792289],
|
|
24
|
-
zoom: 8,
|
|
25
|
-
constrainResolution: !0
|
|
26
|
-
})
|
|
27
|
-
});
|
|
28
|
-
let f = new n({
|
|
29
|
-
units: "metric",
|
|
30
|
-
bar: !1
|
|
31
|
-
});
|
|
32
|
-
h.addControl(f);
|
|
33
|
-
let m = new c({ position: "top-right" });
|
|
34
|
-
h.addControl(m);
|
|
35
|
-
let v = new l({ position: "bottom-left" });
|
|
36
|
-
h.addControl(v);
|
|
37
|
-
let y = new d({ options: { position: "top-right" } });
|
|
38
|
-
h.addControl(y);
|
|
39
|
-
let b = new s({
|
|
40
|
-
position: "bottom-right",
|
|
41
|
-
collapsed: !1
|
|
42
|
-
});
|
|
43
|
-
h.addControl(b);
|
|
44
|
-
let x = new u({
|
|
45
|
-
position: "bottom-left",
|
|
46
|
-
listable: !0,
|
|
47
|
-
layerTypes: ["WMS"]
|
|
48
|
-
}), S = x;
|
|
49
|
-
S._serviceUrlImportInput.value = p.resource.url, S._formContainer.dispatchEvent(new CustomEvent("submit", { cancelable: !0 })), h.addControl(x);
|
|
50
|
-
let C = 20;
|
|
51
|
-
function w() {
|
|
52
|
-
if (!S._getCapResponseWMSLayers) C--, C > 0 ? setTimeout(w, 500) : _.value = !0;
|
|
53
|
-
else {
|
|
54
|
-
let e = S._getCapResponseWMSLayers.filter((e) => e.Name == p.resource.title)[0];
|
|
55
|
-
S._addGetCapWMSLayer(e);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
setTimeout(w, 500);
|
|
59
|
-
}
|
|
60
|
-
return o(() => {
|
|
61
|
-
v();
|
|
62
|
-
}), (e, a) => _.value ? (s(), n(t, { key: 0 }, {
|
|
63
|
-
default: f(() => [i(l(u(m)("L'aperçu cartographique de ce fichier n'a pas pu être chargé.")), 1)]),
|
|
64
|
-
_: 1
|
|
65
|
-
})) : (s(), r("div", {
|
|
66
|
-
key: 1,
|
|
67
|
-
ref_key: "mapRef",
|
|
68
|
-
ref: g,
|
|
69
|
-
class: "size-full"
|
|
70
|
-
}, null, 512));
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
//#endregion
|
|
74
|
-
export { p as default };
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { createElementBlock as e, createElementVNode as t, defineComponent as n, openBlock as r, ref as i, renderSlot as a, toDisplayString as o, unref as s } from "vue";
|
|
2
|
-
//#region src/composables/useTranslation.ts
|
|
3
|
-
var c = /\{(\w+)\}/g, l = /* #__PURE__ */ Object.assign({ "../../../locales/en.json": () => import("./en-C_qOt4Jn.js").then((e) => e.default) }), u = /^[a-z]{2,3}$/;
|
|
4
|
-
function d(e) {
|
|
5
|
-
if (!e) return null;
|
|
6
|
-
let t = e.split(";")[0].split(",")[0].split("-")[0].toLowerCase();
|
|
7
|
-
return u.test(t) ? t : null;
|
|
8
|
-
}
|
|
9
|
-
function f() {
|
|
10
|
-
try {
|
|
11
|
-
let e = d(useRequestHeader?.("accept-language"));
|
|
12
|
-
if (e) return e;
|
|
13
|
-
} catch {}
|
|
14
|
-
if (typeof window < "u") {
|
|
15
|
-
let e = d(navigator.language);
|
|
16
|
-
if (e) return e;
|
|
17
|
-
}
|
|
18
|
-
return "fr";
|
|
19
|
-
}
|
|
20
|
-
async function p(e) {
|
|
21
|
-
let t = l[`../../../locales/${e}.json`];
|
|
22
|
-
if (!t) return {};
|
|
23
|
-
try {
|
|
24
|
-
return await t();
|
|
25
|
-
} catch {
|
|
26
|
-
return {};
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
function m(e, t) {
|
|
30
|
-
return e.replace(c, (e, n) => n in t ? String(t[n]) : e);
|
|
31
|
-
}
|
|
32
|
-
function h(e) {
|
|
33
|
-
let t = [], n = new RegExp(c.source, c.flags), r;
|
|
34
|
-
for (; (r = n.exec(e)) !== null;) t.push(r[1]);
|
|
35
|
-
return t;
|
|
36
|
-
}
|
|
37
|
-
function g(e) {
|
|
38
|
-
let t = [], n = new RegExp(c.source, c.flags), r = 0, i;
|
|
39
|
-
for (; (i = n.exec(e)) !== null;) i.index > r && t.push({ text: e.slice(r, i.index) }), t.push({ placeholder: i[1] }), r = n.lastIndex;
|
|
40
|
-
return r < e.length && t.push({ text: e.slice(r) }), t;
|
|
41
|
-
}
|
|
42
|
-
function _(e, t) {
|
|
43
|
-
let n = e.split("|").map((e) => e.trim());
|
|
44
|
-
return n.length === 1 ? n[0] : n.length === 2 ? t <= 1 ? n[0] : n[1] : n.length >= 3 ? t === 0 ? n[0] : t === 1 ? n[1] : n[2] : n[0];
|
|
45
|
-
}
|
|
46
|
-
var v = i({}), y = async () => {
|
|
47
|
-
let e = f();
|
|
48
|
-
e in v.value || (v.value[e] = await p(e));
|
|
49
|
-
}, b = () => {
|
|
50
|
-
let e = f();
|
|
51
|
-
return y(), {
|
|
52
|
-
t: (t, n) => {
|
|
53
|
-
let r = t;
|
|
54
|
-
typeof n == "number" && (n = {
|
|
55
|
-
count: n,
|
|
56
|
-
n
|
|
57
|
-
}), v.value && v.value[e] && v.value[e][t] && (r = v.value[e][t]);
|
|
58
|
-
let i = n?.n ?? n?.count;
|
|
59
|
-
return i !== void 0 && (r = _(r, Number(i))), n && Object.keys(n).length > 0 && (r = m(r, n)), r;
|
|
60
|
-
},
|
|
61
|
-
locale: e
|
|
62
|
-
};
|
|
63
|
-
}, x = async (e, t) => {
|
|
64
|
-
let { t: n } = b();
|
|
65
|
-
return n(e, t);
|
|
66
|
-
}, S = "data:image/svg+xml,%3csvg%20width='208'%20height='282'%20viewBox='0%200%20208%20282'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M151.061%20143.285C146.388%20142.719%20144.831%20139.887%20144.265%20135.781C143.132%20127.71%20141.716%20119.64%20140.3%20111.428H138.743C134.354%20112.419%20129.681%20111.994%20125.575%20110.012C125.009%20109.729%20124.301%20109.587%20123.593%20109.587C122.885%20109.587%20122.177%20109.871%20121.752%20110.437C112.408%20117.516%20106.744%20126.436%20108.302%20138.471C109.01%20142.294%20110.284%20145.833%20112.266%20149.232C119.062%20161.974%20127.133%20173.868%20136.477%20184.911C137.327%20186.044%20138.318%20186.893%20139.451%20187.46C140.583%20188.026%20141.999%20188.309%20143.273%20188.309C162.529%20188.593%20181.785%20189.159%20201.041%20189.584C202.032%20189.584%20203.023%20189.584%20204.014%20190.008C205.147%20190.292%20206.138%20191%20206.846%20191.849C207.554%20192.84%20207.979%20193.831%20207.979%20195.105C207.979%20196.38%20207.412%20197.512%20206.563%20198.362C205.713%20199.212%20204.58%20199.919%20203.448%20200.061C202.032%20200.203%20200.616%20200.203%20199.2%20200.061L143.273%20198.928H140.159C139.734%20200.061%20139.309%20200.911%20138.884%20201.902C139.309%20202.185%20139.592%20202.468%20139.875%20202.468C146.105%20202.751%20152.193%20203.034%20158.282%20203.176C169.042%20203.459%20179.803%20203.884%20190.705%20204.167C192.262%20204.167%20193.82%20204.45%20195.236%20204.733C196.368%20205.017%20197.501%20205.583%20198.351%20206.574C199.059%20207.565%20199.483%20208.698%20199.483%20209.972C199.483%20211.105%20198.917%20212.237%20198.067%20213.087C197.218%20213.937%20196.227%20214.503%20195.094%20214.786C194.245%20214.928%20193.254%20215.069%20192.404%20214.928L138.884%20213.087C137.752%20213.087%20136.619%20212.945%20135.061%20212.804L128.69%20230.644C129.398%20231.068%20130.248%20231.493%20130.955%20231.776L184.192%20251.032C185.466%20251.457%20186.599%20251.881%20187.732%20252.448C189.147%20253.014%20190.422%20254.005%20191.13%20255.421C191.838%20256.837%20192.121%20258.395%20191.696%20259.952C190.705%20265.332%20189.714%20270.571%20188.581%20275.81C187.307%20281.473%20184.475%20283.03%20179.095%20281.331C163.662%20276.376%20148.371%20271.279%20132.938%20266.182L53.9324%20240.271C46.4283%20237.723%2045.4372%20236.165%2047.561%20228.378C47.9857%20226.254%2048.5521%20224.131%2049.26%20222.148C52.3749%20215.069%2050.8175%20207.848%2049.8264%20200.627C47.561%20183.071%2046.1451%20165.372%2047.7026%20147.674C49.6848%20125.02%2057.7552%20104.774%2072.905%2087.6416C78.1437%2081.5534%2084.9398%2077.0228%2092.4439%2074.3326C101.081%2071.2178%20110.001%2068.6692%20118.779%2065.979C120.053%2065.5543%20121.894%2065.1294%20122.885%2065.6958C126.283%2067.5364%20129.256%2066.2622%20132.371%2065.2711C132.371%2064.9879%20132.654%2064.8464%20132.654%2064.5632C132.654%2058.6166%20133.787%2056.9175%20139.592%2056.2096C149.079%2054.9353%20158.423%2053.6611%20167.768%2052.3868C173.148%2051.6789%20175.272%2053.2362%20176.405%2058.6165C179.52%2073.3414%20182.493%2088.0665%20185.466%20102.65C187.024%20110.012%20188.44%20117.233%20189.855%20124.596C190.563%20127.994%20191.13%20131.392%20187.59%20134.082C187.024%20134.507%20186.882%20135.923%20186.882%20136.914C186.882%20139.321%20187.024%20141.727%20186.882%20144.276C186.882%20148.099%20185.325%20150.081%20181.643%20150.789C174.422%20152.205%20167.343%20153.621%20160.122%20154.895C156.441%20155.461%20153.892%20153.904%20152.618%20150.364C151.91%20148.382%20151.344%20146.258%20150.494%20143.71L151.061%20143.285ZM114.39%2078.0138C113.682%2078.0138%20112.974%2078.1553%20112.266%2078.4385C106.319%2080.5623%20100.373%2082.5446%2094.5677%2084.9516C88.7627%2087.5001%2083.6656%2091.323%2079.7011%2096.2785C74.3209%20102.65%2069.7901%20109.729%2066.392%20117.375C60.8701%20129.976%2058.0384%20143.71%2058.0384%20157.444C58.0384%20167.779%2058.7463%20178.257%2059.4542%20188.593C59.879%20194.681%2060.8701%20200.769%2061.7196%20206.999L118.354%20227.387C118.637%20226.962%20118.921%20226.396%20119.062%20225.83C122.602%20215.919%20126%20206.008%20129.54%20196.097C129.823%20195.389%20129.823%20194.681%20129.54%20194.114C129.398%20193.406%20128.973%20192.84%20128.407%20192.415C118.496%20180.664%20109.717%20167.921%20102.213%20154.47C94.143%20140.17%2095.2756%20123.888%20105.611%20111.287C108.443%20107.747%20111.841%20104.49%20114.673%20101.517C113.965%2097.6943%20112.691%2094.013%20112.549%2090.1902C112.549%2086.509%20113.54%2082.403%20114.107%2078.1554L114.39%2078.0138ZM58.4632%20230.219L178.953%20269.863L180.652%20260.943C160.689%20253.722%20141.008%20246.501%20121.186%20239.422C101.364%20232.343%2081.8249%20224.98%2061.7196%20218.184C60.5869%20222.29%2059.5959%20225.971%2058.4632%20230.077V230.219ZM144.265%2065.8375C160.122%2074.3326%20162.388%2093.3052%20150.211%20105.482C151.627%20114.26%20153.043%20122.755%20154.459%20131.392L179.661%20125.02C175.414%20104.066%20171.166%2083.5356%20166.918%2062.864L144.265%2065.979V65.8375ZM123.31%2090.615C123.31%2097.5528%20130.389%20103.074%20138.176%20100.384C141.291%2099.1101%20143.981%2096.8448%20145.539%2093.7299C147.096%2090.7566%20147.663%2087.2169%20146.813%2083.8188C146.388%2081.8366%20145.397%2080.1376%20144.123%2078.7218C142.707%2077.3059%20141.008%2076.1731%20139.167%2075.6068C137.327%2075.0404%20135.203%2075.0405%20133.362%2075.4652C131.38%2075.89%20129.681%2076.8811%20128.265%2078.297C125.009%2081.1287%20123.168%2084.8099%20123.31%2090.4733V90.615ZM161.821%20140.453C161.821%20143.143%20163.096%20143.285%20164.653%20143.002C168.476%20142.294%20172.44%20141.444%20176.263%20140.595C176.405%20140.595%20176.688%20140.312%20176.971%20139.887L176.546%20136.631L161.68%20140.312L161.821%20140.453Z'%20fill='%23102185'/%3e%3cpath%20d='M29.8625%2091.1813C26.8892%2091.1813%2024.907%2089.1991%2024.199%2086.0842C23.3495%2081.5535%2022.2168%2077.0227%2020.9426%2072.6335C18.6772%2065.5542%2014.8543%2058.8997%209.7572%2053.5194C7.77499%2051.6788%205.79279%2049.9798%203.5274%2048.2808C-1.00337%2044.7412%20-1.14495%2041.343%202.96106%2037.3786C5.65121%2034.6884%208.48293%2031.9984%2011.3147%2029.3082C16.2702%2024.3527%2019.6683%2018.123%2021.0841%2011.3269C21.6505%209.06151%2022.0752%206.79603%2022.7832%204.67224C23.7743%201.55734%2025.7565%200%2028.1634%200C30.5704%200%2032.6942%201.84058%2033.6854%205.09706C33.9685%206.37134%2034.2517%207.64554%2034.3933%208.91982C34.9596%2012.7426%2036.3755%2016.4238%2038.4993%2019.6803C40.6231%2022.9368%2043.4548%2025.6271%2046.7113%2027.6093C49.6846%2029.4499%2052.6579%2031.1489%2055.7728%2032.7063C60.5868%2035.2549%2061.4363%2038.7944%2058.0382%2043.042C55.9144%2045.7322%2053.7906%2048.4224%2051.3837%2051.1125C44.0212%2059.4661%2038.6409%2068.8108%2036.9418%2079.9961C36.5171%2083.111%2035.526%2085.9427%2033.9685%2088.6328C33.5437%2089.3408%2032.8358%2089.907%2032.1279%2090.3318C31.42%2090.7566%2030.5704%2091.0397%2029.7209%2091.1813H29.8625ZM29.7209%2065.6958C33.6853%2055.5016%2040.0567%2047.856%2046.8529%2039.9272C38.924%2036.5291%2032.411%2030.5825%2028.1634%2023.0784C24.7654%2031.0072%2019.3851%2036.8123%2013.2969%2042.1925C20.8009%2048.4223%2025.6149%2056.3511%2029.7209%2065.6958Z'%20fill='%23102185'/%3e%3c/svg%3e", C = { class: "flex flex-col items-center py-12" }, w = ["src"], T = { class: "fr-text--bold mb-1" }, E = { class: "text-sm text-gray-medium mb-0 text-center max-w-lg" }, D = /* @__PURE__ */ n({
|
|
67
|
-
__name: "PreviewUnavailable",
|
|
68
|
-
setup(n) {
|
|
69
|
-
let { t: i } = b();
|
|
70
|
-
return (n, c) => (r(), e("div", C, [
|
|
71
|
-
t("img", {
|
|
72
|
-
src: s(S),
|
|
73
|
-
class: "h-20 mb-3",
|
|
74
|
-
alt: ""
|
|
75
|
-
}, null, 8, w),
|
|
76
|
-
t("p", T, o(s(i)("Aucun aperçu disponible")), 1),
|
|
77
|
-
t("p", E, [a(n.$slots, "default")])
|
|
78
|
-
]));
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
//#endregion
|
|
82
|
-
export { x as a, g as i, h as n, b as o, y as r, D as t };
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { o as e, t } from "./PreviewUnavailable-BJkpCiyL.js";
|
|
2
|
-
import { l as n, s as r } from "./resources-CmwQ4DAB.js";
|
|
3
|
-
import { computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, defineComponent as u, nextTick as d, normalizeClass as f, onMounted as p, openBlock as m, ref as h, renderSlot as g, toDisplayString as _, unref as v, withCtx as y } from "vue";
|
|
4
|
-
//#region src/components/ResourceAccordion/PreviewWrapper.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
-
var b = { class: "text-gray-medium" }, x = /* @__PURE__ */ u({
|
|
6
|
-
__name: "PreviewWrapper",
|
|
7
|
-
props: {
|
|
8
|
-
fileType: {},
|
|
9
|
-
resource: {},
|
|
10
|
-
maxSize: {},
|
|
11
|
-
load: { type: Function },
|
|
12
|
-
fill: { type: Boolean }
|
|
13
|
-
},
|
|
14
|
-
emits: ["loaded"],
|
|
15
|
-
setup(u, { emit: x }) {
|
|
16
|
-
let S = u, C = x, { t: w } = e(), T = h(null), E = h(!1), D = h(null), O = i(() => n(S.resource)), k = i(() => r(S.resource)), A = i(() => {
|
|
17
|
-
let e = O.value, t = S.maxSize;
|
|
18
|
-
return !e || !t ? !1 : e <= t;
|
|
19
|
-
});
|
|
20
|
-
return p(async () => {
|
|
21
|
-
if (A.value && k.value !== "blocked") {
|
|
22
|
-
E.value = !0;
|
|
23
|
-
try {
|
|
24
|
-
T.value = await S.load(), await d(), C("loaded");
|
|
25
|
-
} catch (e) {
|
|
26
|
-
console.error("Error loading preview:", e), D.value = e instanceof TypeError ? "network" : "generic";
|
|
27
|
-
} finally {
|
|
28
|
-
E.value = !1;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}), (e, n) => (m(), s("div", { class: f(["text-xs", u.fill ? "flex min-h-0 flex-1 flex-col" : ""]) }, [T.value === null ? E.value ? g(e.$slots, "loading", {}, () => [c("div", b, _(v(w)("Chargement de l'aperçu {fileType}...", { fileType: u.fileType })), 1)], void 0, 1) : A.value ? k.value === "blocked" ? (m(), a(t, { key: 3 }, {
|
|
32
|
-
default: y(() => [l(_(v(w)("Ce fichier {fileType} ne peut pas être prévisualisé car il est hébergé sur un site distant qui restreint l'accès (CORS). Téléchargez-le pour le consulter.", { fileType: u.fileType })), 1)]),
|
|
33
|
-
_: 1
|
|
34
|
-
})) : D.value === "network" ? (m(), a(t, { key: 4 }, {
|
|
35
|
-
default: y(() => [l(_(v(w)("Ce fichier est hébergé sur un site externe qui ne permet pas la prévisualisation. Téléchargez-le pour le consulter.")), 1)]),
|
|
36
|
-
_: 1
|
|
37
|
-
})) : D.value ? (m(), a(t, { key: 5 }, {
|
|
38
|
-
default: y(() => [l(_(v(w)("L'aperçu de ce fichier n'a pas pu être chargé. Téléchargez-le pour le consulter.")), 1)]),
|
|
39
|
-
_: 1
|
|
40
|
-
})) : o("", !0) : (m(), a(t, { key: 2 }, {
|
|
41
|
-
default: y(() => [l(_(O.value ? v(w)("Le fichier {fileType} est trop volumineux pour être prévisualisé. Téléchargez-le pour le consulter.", { fileType: u.fileType }) : v(w)("La taille du fichier est inconnue, l'aperçu n'est pas disponible. Téléchargez-le pour le consulter.")), 1)]),
|
|
42
|
-
_: 1
|
|
43
|
-
})) : g(e.$slots, "default", { data: T.value }, void 0, void 0, 0)], 2));
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
//#endregion
|
|
47
|
-
export { x as t };
|