@datagouv/components-next 1.0.2-dev.230 → 1.0.2-dev.231
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/{ImagePreview.client-Db0MdI5N.js → ImagePreview.client-H7jGf9xS.js} +1 -1
- package/dist/{JsonPreview.client-DRCq40Q-.js → JsonPreview.client-CQSCGT6V.js} +1 -1
- package/dist/{Map-D17BKcyK.js → Map-QeL96qbQ.js} +1 -1
- package/dist/{MapContainer.client-DdPY_Iri.js → MapContainer.client-UC7wQOBj.js} +10 -10
- package/dist/{PdfPreview.client-DtKCBgGZ.js → PdfPreview.client-Cz_jnvla.js} +1 -1
- package/dist/{Pmtiles.client-DSZ_4FXc.js → Pmtiles.client-CSoax_YA.js} +2102 -2903
- package/dist/{PreviewWrapper-DegSQbMM.js → PreviewWrapper-DBlpLgs2.js} +1 -1
- package/dist/{XmlPreview.client-D9R_YF5s.js → XmlPreview.client-8vye8TAa.js} +1 -1
- package/dist/components-next.css +1 -1
- package/dist/components-next.js +4722 -4727
- package/dist/purify.es-CeeOHdER.js +805 -0
- package/dist/{resources-BOKIyTJV.js → resources-BBaRfEol.js} +13 -16
- package/dist/src-C0XyM3eg.js +68979 -0
- package/package.json +2 -2
- package/src/components/ResourceAccordion/EditButton.vue +1 -4
- package/src/components/ResourceAccordion/MapContainer.client.vue +18 -7
- package/src/components/ResourceAccordion/ResourceAccordion.vue +1 -6
- package/src/functions/resources.ts +0 -4
- package/src/types/resources.ts +0 -6
- package/dist/src-DbFybTVs.js +0 -66090
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datagouv/components-next",
|
|
3
|
-
"version": "1.0.2-dev.
|
|
3
|
+
"version": "1.0.2-dev.231",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"chart.js": "^4.5.1",
|
|
35
35
|
"dompurify": "^3.4.15",
|
|
36
36
|
"echarts": "^6.1.0",
|
|
37
|
-
"geopf-extensions-openlayers": "1.0.0-beta.
|
|
37
|
+
"geopf-extensions-openlayers": "1.0.0-beta.15",
|
|
38
38
|
"leaflet": "^1.9.4",
|
|
39
39
|
"maplibre-gl": "^5.24.0",
|
|
40
40
|
"ofetch": "^1.5.1",
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
icon-only
|
|
5
5
|
:icon="RiPencilLine"
|
|
6
6
|
color="warning"
|
|
7
|
-
:
|
|
8
|
-
:title="disabledReason ?? t('Éditer le fichier')"
|
|
7
|
+
:title="t('Éditer le fichier')"
|
|
9
8
|
data-testid="edit-button"
|
|
10
9
|
/>
|
|
11
10
|
</template>
|
|
@@ -20,12 +19,10 @@ type Props = {
|
|
|
20
19
|
datasetId: string
|
|
21
20
|
isCommunityResource?: boolean
|
|
22
21
|
resourceId: string
|
|
23
|
-
disabledReason?: string | null
|
|
24
22
|
}
|
|
25
23
|
|
|
26
24
|
const props = withDefaults(defineProps<Props>(), {
|
|
27
25
|
isCommunityResource: false,
|
|
28
|
-
disabledReason: null,
|
|
29
26
|
})
|
|
30
27
|
|
|
31
28
|
const { t } = useTranslation()
|
|
@@ -15,6 +15,15 @@ import PreviewUnavailable from './PreviewUnavailable.vue'
|
|
|
15
15
|
import type { Resource } from '../../types/resources'
|
|
16
16
|
import { useTranslation } from '../../composables/useTranslation'
|
|
17
17
|
|
|
18
|
+
type WmsCapabilitiesLayer = { Name: string }
|
|
19
|
+
|
|
20
|
+
type LayerImportInternals = {
|
|
21
|
+
_serviceUrlImportInput: HTMLInputElement
|
|
22
|
+
_formContainer: HTMLFormElement
|
|
23
|
+
_getCapResponseWMSLayers: Array<WmsCapabilitiesLayer> | null
|
|
24
|
+
_addGetCapWMSLayer: (layerInfo: WmsCapabilitiesLayer | undefined) => void
|
|
25
|
+
}
|
|
26
|
+
|
|
18
27
|
const props = defineProps<{ resource: Resource }>()
|
|
19
28
|
|
|
20
29
|
const { t } = useTranslation()
|
|
@@ -38,7 +47,6 @@ async function displayMap() {
|
|
|
38
47
|
import('ol/control/ScaleLine'),
|
|
39
48
|
import('ol/layer/Tile'),
|
|
40
49
|
import('ol/source/OSM'),
|
|
41
|
-
// @ts-expect-error no types provided
|
|
42
50
|
import('geopf-extensions-openlayers'),
|
|
43
51
|
])
|
|
44
52
|
|
|
@@ -94,12 +102,16 @@ async function displayMap() {
|
|
|
94
102
|
map.addControl(attributions)
|
|
95
103
|
|
|
96
104
|
const layerImport = new LayerImport({
|
|
105
|
+
// @ts-expect-error `position` is handled by the base control but missing from the published types
|
|
97
106
|
position: 'bottom-left',
|
|
98
107
|
listable: true,
|
|
99
108
|
layerTypes: ['WMS'],
|
|
100
109
|
})
|
|
101
|
-
|
|
102
|
-
|
|
110
|
+
// LayerImport has no public API to load a service URL: we fill and submit its form,
|
|
111
|
+
// then add the resource's layer once the GetCapabilities response is parsed.
|
|
112
|
+
const layerImportInternals = layerImport as unknown as LayerImportInternals
|
|
113
|
+
layerImportInternals._serviceUrlImportInput.value = props.resource.url
|
|
114
|
+
layerImportInternals._formContainer.dispatchEvent(new CustomEvent('submit', { cancelable: true }))
|
|
103
115
|
|
|
104
116
|
map.addControl(layerImport)
|
|
105
117
|
|
|
@@ -108,7 +120,7 @@ async function displayMap() {
|
|
|
108
120
|
const waitTimeout = 500
|
|
109
121
|
let retry = 20
|
|
110
122
|
function showLayer() {
|
|
111
|
-
if (!
|
|
123
|
+
if (!layerImportInternals._getCapResponseWMSLayers) {
|
|
112
124
|
retry--
|
|
113
125
|
if (retry > 0)
|
|
114
126
|
setTimeout(showLayer, waitTimeout)
|
|
@@ -116,9 +128,8 @@ async function displayMap() {
|
|
|
116
128
|
hasError.value = true
|
|
117
129
|
}
|
|
118
130
|
else {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
layerImport._addGetCapWMSLayer(layerInfo)
|
|
131
|
+
const layerInfo = layerImportInternals._getCapResponseWMSLayers.filter(layer => layer.Name == props.resource.title)[0]
|
|
132
|
+
layerImportInternals._addGetCapWMSLayer(layerInfo)
|
|
122
133
|
}
|
|
123
134
|
}
|
|
124
135
|
setTimeout(showLayer, waitTimeout)
|
|
@@ -173,7 +173,6 @@
|
|
|
173
173
|
:dataset-id="dataset.id"
|
|
174
174
|
:resource-id="resource.id"
|
|
175
175
|
:is-community-resource="isCommunityResource"
|
|
176
|
-
:disabled-reason="editDisabledReason"
|
|
177
176
|
size="xs"
|
|
178
177
|
/>
|
|
179
178
|
</p>
|
|
@@ -328,7 +327,7 @@ import { trackEvent } from '../../functions/matomo'
|
|
|
328
327
|
import CopyButton from '../CopyButton.vue'
|
|
329
328
|
import { useComponentsConfig } from '../../config'
|
|
330
329
|
import { getOwnerName } from '../../functions/owned'
|
|
331
|
-
import { getResourceFormatIcon, getResourceTitleId, detectOgcService, getResourceFilesize,
|
|
330
|
+
import { getResourceFormatIcon, getResourceTitleId, detectOgcService, getResourceFilesize, isImagePreviewFormat, resolveResourceExternalUrl } from '../../functions/resources'
|
|
332
331
|
import BrandedButton from '../BrandedButton.vue'
|
|
333
332
|
import { useTranslation } from '../../composables/useTranslation'
|
|
334
333
|
import { useHasTabularData } from '../../composables/useHasTabularData'
|
|
@@ -385,10 +384,6 @@ const hasPmtiles = computed(() => {
|
|
|
385
384
|
return props.resource.extras['analysis:parsing:pmtiles_url'] || props.resource.format === 'pmtiles'
|
|
386
385
|
})
|
|
387
386
|
|
|
388
|
-
const editDisabledReason = computed(() => {
|
|
389
|
-
return isGeopfSynced(props.resource) ? t('Vous ne pouvez pas modifier cette ressource car elle est synchronisée avec cartes.gouv.fr') : null
|
|
390
|
-
})
|
|
391
|
-
|
|
392
387
|
const hasDatafairPreview = computed(() => {
|
|
393
388
|
// Checks if there are the corresponding extras for a datafair preview.
|
|
394
389
|
// Limited only to datasets published by certified organizations since it will load an iframe.
|
|
@@ -179,10 +179,6 @@ export function getResourceExternalUrl(dataset: Dataset | DatasetV2 | Omit<Datas
|
|
|
179
179
|
return `${dataset.page}${isCommunityResource(resource) ? '/community-resources' : ''}?resource_id=${resource.id}`
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
export function isGeopfSynced(resource: Resource | CommunityResource): boolean {
|
|
183
|
-
return resource.geopf?.push_status != null || typeof resource.geopf?.offering_id === 'string'
|
|
184
|
-
}
|
|
185
|
-
|
|
186
182
|
export function resolveResourceExternalUrl<R extends Resource | CommunityResource>(
|
|
187
183
|
dataset: Dataset | DatasetV2 | Omit<Dataset, 'resources' | 'community_resources'>,
|
|
188
184
|
resource: R,
|
package/src/types/resources.ts
CHANGED
|
@@ -12,11 +12,6 @@ export type FileResourceFileType = 'file'
|
|
|
12
12
|
|
|
13
13
|
export type ResourceFileType = RemoteResourceFileType | FileResourceFileType
|
|
14
14
|
|
|
15
|
-
export type GeopfResourceMetadata = {
|
|
16
|
-
push_status?: 'pending' | 'done' | 'error' | 'timeout' | null
|
|
17
|
-
offering_id?: string | null
|
|
18
|
-
}
|
|
19
|
-
|
|
20
15
|
export type Resource = {
|
|
21
16
|
id: string
|
|
22
17
|
title: string
|
|
@@ -27,7 +22,6 @@ export type Resource = {
|
|
|
27
22
|
extras: Record<string, unknown>
|
|
28
23
|
metrics: { views: number }
|
|
29
24
|
harvest: Harvest
|
|
30
|
-
geopf: GeopfResourceMetadata | null
|
|
31
25
|
filesize: number | null
|
|
32
26
|
filetype: ResourceFileType
|
|
33
27
|
format: string
|