@datagouv/components-next 1.0.0 → 1.0.1
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/assets/main.css +0 -28
- package/dist/{Datafair.client-Dls5AHTE.js → Datafair.client-B5lBpOl8.js} +2 -2
- package/dist/{JsonPreview.client-DPDTs433.js → JsonPreview.client-Doz1Z0BS.js} +16 -16
- package/dist/{MapContainer.client-BdAzd7bj.js → MapContainer.client-oiieO8H-.js} +3 -3
- package/dist/PdfPreview.client-CdAhkDFJ.js +14513 -0
- package/dist/{Pmtiles.client-mF6xaOO_.js → Pmtiles.client-B0v8tGJQ.js} +2 -2
- package/dist/Swagger.client-CsK65JnG.js +4 -0
- package/dist/{XmlPreview.client-C0OgBkSq.js → XmlPreview.client-CrjHf74q.js} +15 -15
- package/dist/components-next.css +1 -1
- package/dist/components-next.js +130 -125
- package/dist/components.css +1 -1
- package/dist/{index-BRGqW8aQ.js → index-Bbu9rOHt.js} +1 -1
- package/dist/{main-CNHxAJ8J.js → main-CiH8ZmBI.js} +22114 -21911
- package/dist/{vue3-xml-viewer.common-CmAdQfIy.js → vue3-xml-viewer.common-Bi_bsV6C.js} +1 -1
- package/package.json +2 -2
- package/src/components/DataserviceCard.vue +3 -3
- package/src/components/DatasetCard.vue +2 -2
- package/src/components/DatasetQuality.vue +23 -16
- package/src/components/DatasetQualityInline.vue +13 -17
- package/src/components/DatasetQualityScore.vue +12 -15
- package/src/components/DiscussionMessageCard.vue +1 -1
- package/src/components/ObjectCard.vue +2 -2
- package/src/components/ObjectCardHeader.vue +1 -1
- package/src/components/OrganizationHorizontalCard.vue +87 -0
- package/src/components/OrganizationNameWithCertificate.vue +1 -1
- package/src/components/ProgressBar.vue +31 -0
- package/src/components/ResourceAccordion/Datafair.client.vue +1 -1
- package/src/components/ResourceAccordion/JsonPreview.client.vue +3 -3
- package/src/components/ResourceAccordion/MapContainer.client.vue +1 -1
- package/src/components/ResourceAccordion/PdfPreview.client.vue +70 -74
- package/src/components/ResourceAccordion/Pmtiles.client.vue +1 -1
- package/src/components/ResourceAccordion/Preview.vue +1 -1
- package/src/components/ResourceAccordion/ResourceAccordion.vue +5 -8
- package/src/components/ResourceAccordion/XmlPreview.client.vue +3 -3
- package/src/components/ResourceExplorer/ResourceExplorerViewer.vue +50 -1
- package/src/components/ReuseHorizontalCard.vue +1 -1
- package/src/components/Search/Filter/ProducerTypeFilter.vue +13 -3
- package/src/components/Search/GlobalSearch.vue +124 -28
- package/src/components/Toggletip.vue +5 -2
- package/src/components/TopicCard.vue +1 -1
- package/src/composables/useHasTabularData.ts +15 -0
- package/src/composables/useResourceCapabilities.ts +18 -5
- package/src/composables/useTranslation.ts +2 -1
- package/src/functions/api.ts +11 -3
- package/src/functions/api.types.ts +1 -1
- package/src/functions/resourceCapabilities.ts +55 -0
- package/src/main.ts +8 -1
- package/src/types/resources.ts +10 -0
- package/src/types/search.ts +29 -1
- package/dist/PdfPreview.client-CopqSDyt.js +0 -107
- package/dist/Swagger.client-eJ7gpfZA.js +0 -4
- package/dist/pdf-vue3-IkJO65RH.js +0 -273
- package/dist/pdf.min-f72cfa08-CdgJTooZ.js +0 -9501
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { Resource, WfsMetadata, OgcLayerInfo } from '../types/resources'
|
|
2
|
+
|
|
3
|
+
const WFS_EXPORT_FORMATS = [
|
|
4
|
+
{
|
|
5
|
+
name: 'csv',
|
|
6
|
+
mimetype: 'csv',
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
name: 'json',
|
|
10
|
+
mimetype: 'application/json',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: 'shp',
|
|
14
|
+
mimetype: 'SHAPE-ZIP',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: 'gml',
|
|
18
|
+
mimetype: 'application/gml+xml',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: 'kml',
|
|
22
|
+
mimetype: 'KML',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'gpkg',
|
|
26
|
+
mimetype: 'application/geopackage+sqlite3',
|
|
27
|
+
},
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
function buildWfsDownloadUrl(baseUrl: string, wfsMetadata: WfsMetadata, format: { name: string, mimetype: string }, layer: OgcLayerInfo) {
|
|
31
|
+
const version = wfsMetadata.version
|
|
32
|
+
const query = new URLSearchParams({
|
|
33
|
+
SERVICE: 'WFS',
|
|
34
|
+
REQUEST: 'GetFeature',
|
|
35
|
+
VERSION: version,
|
|
36
|
+
...(Number(version.split('.')[0]) >= 2 ? { TYPENAMES: layer.name } : { TYPENAME: layer.name }),
|
|
37
|
+
OUTPUTFORMAT: format.mimetype,
|
|
38
|
+
...(layer.default_crs ? { SRSNAME: layer.default_crs } : {}),
|
|
39
|
+
})
|
|
40
|
+
return `${baseUrl.split('?')[0]}?${query.toString()}`
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function getWfsExportFormats(resource: Pick<Resource, 'extras' | 'url'>) {
|
|
44
|
+
const wfsMetadata = resource.extras['analysis:parsing:ogc_metadata'] as WfsMetadata | null
|
|
45
|
+
if (!wfsMetadata || wfsMetadata.format !== `wfs`) return []
|
|
46
|
+
const outputFormats = wfsMetadata.output_formats.map((format: string) => format.toLowerCase())
|
|
47
|
+
const layer = wfsMetadata.detected_layer
|
|
48
|
+
if (!layer) return []
|
|
49
|
+
const formats = WFS_EXPORT_FORMATS.filter(format => outputFormats.includes(format.mimetype.toLowerCase()))
|
|
50
|
+
.map(format => ({
|
|
51
|
+
url: buildWfsDownloadUrl(resource.url, wfsMetadata, format, layer),
|
|
52
|
+
format: format.name,
|
|
53
|
+
}))
|
|
54
|
+
return formats
|
|
55
|
+
}
|
package/src/main.ts
CHANGED
|
@@ -24,7 +24,7 @@ import type { Weight, WellType } from './types/ui'
|
|
|
24
24
|
import type { User, UserReference } from './types/users'
|
|
25
25
|
import type { Report, ReportSubject, ReportReason } from './types/reports'
|
|
26
26
|
import type { GlobalSearchConfig, SearchType, SortOption } from './types/search'
|
|
27
|
-
import { getDefaultDatasetConfig, getDefaultDataserviceConfig, getDefaultReuseConfig, getDefaultGlobalSearchConfig, defaultDatasetSortOptions, defaultDataserviceSortOptions, defaultReuseSortOptions } from './types/search'
|
|
27
|
+
import { getDefaultDatasetConfig, getDefaultDataserviceConfig, getDefaultReuseConfig, getDefaultOrganizationConfig, getDefaultGlobalSearchConfig, defaultDatasetSortOptions, defaultDataserviceSortOptions, defaultReuseSortOptions, defaultOrganizationSortOptions } from './types/search'
|
|
28
28
|
|
|
29
29
|
import ActivityList from './components/ActivityList/ActivityList.vue'
|
|
30
30
|
import UserActivityList from './components/ActivityList/UserActivityList.vue'
|
|
@@ -49,12 +49,14 @@ import DatasetQuality from './components/DatasetQuality.vue'
|
|
|
49
49
|
import DatasetQualityInline from './components/DatasetQualityInline.vue'
|
|
50
50
|
import DatasetQualityItem from './components/DatasetQualityItem.vue'
|
|
51
51
|
import DatasetQualityScore from './components/DatasetQualityScore.vue'
|
|
52
|
+
import ProgressBar from './components/ProgressBar.vue'
|
|
52
53
|
import DatasetQualityTooltipContent from './components/DatasetQualityTooltipContent.vue'
|
|
53
54
|
import ExtraAccordion from './components/ExtraAccordion.vue'
|
|
54
55
|
import LabelTag from './components/DatasetLabelTag.vue'
|
|
55
56
|
import LoadingBlock from './components/LoadingBlock.vue'
|
|
56
57
|
import MarkdownViewer from './components/MarkdownViewer.vue'
|
|
57
58
|
import OrganizationCard from './components/OrganizationCard.vue'
|
|
59
|
+
import OrganizationHorizontalCard from './components/OrganizationHorizontalCard.vue'
|
|
58
60
|
import OrganizationLogo from './components/OrganizationLogo.vue'
|
|
59
61
|
import OrganizationNameWithCertificate from './components/OrganizationNameWithCertificate.vue'
|
|
60
62
|
import OwnerType from './components/OwnerType.vue'
|
|
@@ -101,6 +103,7 @@ export * from './composables/useActiveDescendant'
|
|
|
101
103
|
export * from './composables/useMetrics'
|
|
102
104
|
export * from './composables/useReuseType'
|
|
103
105
|
export * from './composables/useTranslation'
|
|
106
|
+
export * from './composables/useHasTabularData'
|
|
104
107
|
|
|
105
108
|
export * from './functions/activities'
|
|
106
109
|
export * from './functions/datasets'
|
|
@@ -221,10 +224,12 @@ export {
|
|
|
221
224
|
getDefaultDatasetConfig,
|
|
222
225
|
getDefaultDataserviceConfig,
|
|
223
226
|
getDefaultReuseConfig,
|
|
227
|
+
getDefaultOrganizationConfig,
|
|
224
228
|
getDefaultGlobalSearchConfig,
|
|
225
229
|
defaultDatasetSortOptions,
|
|
226
230
|
defaultDataserviceSortOptions,
|
|
227
231
|
defaultReuseSortOptions,
|
|
232
|
+
defaultOrganizationSortOptions,
|
|
228
233
|
}
|
|
229
234
|
|
|
230
235
|
// Vue Plugin
|
|
@@ -273,6 +278,7 @@ export {
|
|
|
273
278
|
Tag,
|
|
274
279
|
MarkdownViewer,
|
|
275
280
|
OrganizationCard,
|
|
281
|
+
OrganizationHorizontalCard,
|
|
276
282
|
OrganizationLogo,
|
|
277
283
|
OrganizationNameWithCertificate,
|
|
278
284
|
OwnerType,
|
|
@@ -280,6 +286,7 @@ export {
|
|
|
280
286
|
PaddedContainer,
|
|
281
287
|
Pagination,
|
|
282
288
|
Placeholder,
|
|
289
|
+
ProgressBar,
|
|
283
290
|
PostCard,
|
|
284
291
|
RadioGroup,
|
|
285
292
|
RadioInput,
|
package/src/types/resources.ts
CHANGED
|
@@ -41,3 +41,13 @@ export interface ResourceGroup {
|
|
|
41
41
|
total: number
|
|
42
42
|
items: Resource[]
|
|
43
43
|
}
|
|
44
|
+
|
|
45
|
+
export type OgcLayerInfo = { name: string, default_crs: string | null }
|
|
46
|
+
|
|
47
|
+
export type WfsMetadata = {
|
|
48
|
+
format: string
|
|
49
|
+
layers: Array<OgcLayerInfo>
|
|
50
|
+
version: string
|
|
51
|
+
detected_layer: OgcLayerInfo | null
|
|
52
|
+
output_formats: Array<string>
|
|
53
|
+
}
|
package/src/types/search.ts
CHANGED
|
@@ -201,6 +201,7 @@ export type OrganizationSearchSort = 'reuses' | 'datasets' | 'followers' | 'view
|
|
|
201
201
|
|
|
202
202
|
export type OrganizationSearchFilters = {
|
|
203
203
|
badge?: OrganizationBadgeFilter
|
|
204
|
+
producer_type?: ProducerType
|
|
204
205
|
}
|
|
205
206
|
|
|
206
207
|
export type OrganizationSearchQueryParams = BaseSearchQueryParams<OrganizationSearchSort> & OrganizationSearchFilters
|
|
@@ -315,7 +316,16 @@ export type ReuseSearchConfig = {
|
|
|
315
316
|
sortOptions?: SortOption<ReuseSearchSort>[]
|
|
316
317
|
}
|
|
317
318
|
|
|
318
|
-
export type
|
|
319
|
+
export type OrganizationSearchConfig = {
|
|
320
|
+
class: 'organizations'
|
|
321
|
+
name?: string
|
|
322
|
+
hiddenFilters?: HiddenFilter<OrganizationSearchFilters>[]
|
|
323
|
+
basicFilters?: (keyof OrganizationSearchFilters)[]
|
|
324
|
+
advancedFilters?: (keyof OrganizationSearchFilters)[]
|
|
325
|
+
sortOptions?: SortOption<OrganizationSearchSort>[]
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export type SearchTypeConfig = DatasetSearchConfig | DataserviceSearchConfig | ReuseSearchConfig | OrganizationSearchConfig
|
|
319
329
|
|
|
320
330
|
export type SearchType = SearchTypeConfig['class']
|
|
321
331
|
|
|
@@ -340,6 +350,13 @@ export const defaultReuseSortOptions: SortOption<ReuseSearchSort>[] = [
|
|
|
340
350
|
{ value: '-datasets', label: 'Nombre de jeux de données' },
|
|
341
351
|
]
|
|
342
352
|
|
|
353
|
+
export const defaultOrganizationSortOptions: SortOption<OrganizationSearchSort>[] = [
|
|
354
|
+
{ value: '-created', label: 'Date de création' },
|
|
355
|
+
{ value: '-followers', label: `Nombre d'abonnés` },
|
|
356
|
+
{ value: '-datasets', label: 'Nombre de jeux de données' },
|
|
357
|
+
{ value: '-reuses', label: 'Nombre de réutilisations' },
|
|
358
|
+
]
|
|
359
|
+
|
|
343
360
|
export function getDefaultDatasetConfig(overrides?: Partial<Omit<DatasetSearchConfig, 'class'>>): DatasetSearchConfig {
|
|
344
361
|
return {
|
|
345
362
|
class: 'datasets',
|
|
@@ -370,10 +387,21 @@ export function getDefaultReuseConfig(overrides?: Partial<Omit<ReuseSearchConfig
|
|
|
370
387
|
}
|
|
371
388
|
}
|
|
372
389
|
|
|
390
|
+
export function getDefaultOrganizationConfig(overrides?: Partial<Omit<OrganizationSearchConfig, 'class'>>): OrganizationSearchConfig {
|
|
391
|
+
return {
|
|
392
|
+
class: 'organizations',
|
|
393
|
+
basicFilters: ['producer_type'],
|
|
394
|
+
advancedFilters: [],
|
|
395
|
+
sortOptions: defaultOrganizationSortOptions,
|
|
396
|
+
...overrides,
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
373
400
|
export function getDefaultGlobalSearchConfig(): GlobalSearchConfig {
|
|
374
401
|
return [
|
|
375
402
|
getDefaultDatasetConfig(),
|
|
376
403
|
getDefaultDataserviceConfig(),
|
|
377
404
|
getDefaultReuseConfig(),
|
|
405
|
+
getDefaultOrganizationConfig(),
|
|
378
406
|
]
|
|
379
407
|
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { defineComponent as B, defineAsyncComponent as q, ref as n, computed as w, onMounted as O, createElementBlock as p, openBlock as s, createBlock as d, createCommentVNode as L, createVNode as a, unref as o, toDisplayString as u, withCtx as f, createElementVNode as g } from "vue";
|
|
2
|
-
import { u as S, a as $, g as N, _ as h, F as m } from "./main-CNHxAJ8J.js";
|
|
3
|
-
const V = { class: "text-xs" }, A = { key: 0 }, H = {
|
|
4
|
-
key: 1,
|
|
5
|
-
class: "text-gray-medium"
|
|
6
|
-
}, M = /* @__PURE__ */ B({
|
|
7
|
-
__name: "PdfPreview.client",
|
|
8
|
-
props: {
|
|
9
|
-
resource: {}
|
|
10
|
-
},
|
|
11
|
-
setup(x) {
|
|
12
|
-
const _ = q(
|
|
13
|
-
() => import("./pdf-vue3-IkJO65RH.js").then((e) => e.default)
|
|
14
|
-
), c = x, F = S(), { t } = $(), r = n(!1), i = n(!1), l = n(null), P = n(!1), v = w(() => N(c.resource)), b = w(() => {
|
|
15
|
-
const e = v.value;
|
|
16
|
-
if (!e)
|
|
17
|
-
return !1;
|
|
18
|
-
const y = F.maxPdfPreviewByteSize ?? 1e7;
|
|
19
|
-
return e <= y;
|
|
20
|
-
}), D = async () => {
|
|
21
|
-
if (!b.value) {
|
|
22
|
-
P.value = !0;
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
i.value = !0, l.value = null;
|
|
26
|
-
try {
|
|
27
|
-
const e = await fetch(c.resource.url, { method: "HEAD" });
|
|
28
|
-
if (!e.ok)
|
|
29
|
-
throw new Error(`HTTP error! status: ${e.status}`);
|
|
30
|
-
r.value = !0;
|
|
31
|
-
} catch (e) {
|
|
32
|
-
console.error("Error testing PDF URL:", e), e instanceof TypeError ? l.value = "network" : l.value = "generic", r.value = !1;
|
|
33
|
-
} finally {
|
|
34
|
-
i.value = !1;
|
|
35
|
-
}
|
|
36
|
-
}, k = (e) => {
|
|
37
|
-
console.log(`PDF loading progress: ${e}%`);
|
|
38
|
-
}, z = () => {
|
|
39
|
-
console.log("PDF download completed");
|
|
40
|
-
}, C = (e) => {
|
|
41
|
-
console.log(`PDF page changed to: ${e}`);
|
|
42
|
-
}, E = (e) => {
|
|
43
|
-
console.log("PDF initialized:", e);
|
|
44
|
-
}, T = (e) => {
|
|
45
|
-
console.error("PDF loading error:", e), e instanceof TypeError ? l.value = "network" : l.value = "generic", r.value = !1;
|
|
46
|
-
};
|
|
47
|
-
return O(() => {
|
|
48
|
-
D();
|
|
49
|
-
}), (e, y) => (s(), p("div", V, [
|
|
50
|
-
r.value ? (s(), p("div", A, [
|
|
51
|
-
a(o(_), {
|
|
52
|
-
src: c.resource.url,
|
|
53
|
-
"show-progress": !0,
|
|
54
|
-
"progress-color": "#0063cb",
|
|
55
|
-
"show-page-tooltip": !0,
|
|
56
|
-
"show-back-to-top-btn": !0,
|
|
57
|
-
"scroll-threshold": 300,
|
|
58
|
-
"pdf-width": "100%",
|
|
59
|
-
"row-gap": 12,
|
|
60
|
-
"use-system-fonts": !0,
|
|
61
|
-
"disable-range": !1,
|
|
62
|
-
"disable-stream": !1,
|
|
63
|
-
"disable-auto-fetch": !1,
|
|
64
|
-
class: "w-full",
|
|
65
|
-
onOnProgress: k,
|
|
66
|
-
onOnComplete: z,
|
|
67
|
-
onOnPageChange: C,
|
|
68
|
-
onOnPdfInit: E,
|
|
69
|
-
onOnError: T
|
|
70
|
-
}, null, 8, ["src"])
|
|
71
|
-
])) : i.value ? (s(), p("div", H, u(o(t)("Chargement de l'aperçu PDF...")), 1)) : P.value ? (s(), d(h, {
|
|
72
|
-
key: 2,
|
|
73
|
-
type: "warning",
|
|
74
|
-
class: "flex items-center space-x-2"
|
|
75
|
-
}, {
|
|
76
|
-
default: f(() => [
|
|
77
|
-
a(o(m), { class: "flex-none size-6" }),
|
|
78
|
-
g("span", null, u(v.value ? o(t)("Fichier PDF 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.") : o(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.")), 1)
|
|
79
|
-
]),
|
|
80
|
-
_: 1
|
|
81
|
-
})) : l.value === "network" ? (s(), d(h, {
|
|
82
|
-
key: 3,
|
|
83
|
-
type: "warning",
|
|
84
|
-
class: "flex items-center space-x-2"
|
|
85
|
-
}, {
|
|
86
|
-
default: f(() => [
|
|
87
|
-
a(o(m), { class: "flex-none size-6" }),
|
|
88
|
-
g("span", null, u(o(t)("Ce fichier PDF 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)
|
|
89
|
-
]),
|
|
90
|
-
_: 1
|
|
91
|
-
})) : l.value ? (s(), d(h, {
|
|
92
|
-
key: 4,
|
|
93
|
-
type: "warning",
|
|
94
|
-
class: "flex items-center space-x-2"
|
|
95
|
-
}, {
|
|
96
|
-
default: f(() => [
|
|
97
|
-
a(o(m), { class: "flex-none size-6" }),
|
|
98
|
-
g("span", null, u(o(t)("Erreur lors du chargement de l'aperçu PDF. Pour consulter le fichier, téléchargez-le depuis l'onglet Téléchargements.")), 1)
|
|
99
|
-
]),
|
|
100
|
-
_: 1
|
|
101
|
-
})) : L("", !0)
|
|
102
|
-
]));
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
export {
|
|
106
|
-
M as default
|
|
107
|
-
};
|