@datagouv/components-next 1.0.2-dev.237 → 1.0.2-dev.239

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.
@@ -261,16 +261,13 @@ function V(e) {
261
261
  function H(e, t) {
262
262
  return `${e.page}${V(t) ? "/community-resources" : ""}?resource_id=${t.id}`;
263
263
  }
264
- function U(e) {
265
- return e.geopf?.push_status != null || typeof e.geopf?.offering_id == "string";
266
- }
267
- function W(e, t, n) {
264
+ function U(e, t, n) {
268
265
  return n ? n(t) : H(e, t);
269
266
  }
270
- function G(e) {
267
+ function W(e) {
271
268
  return e.filesize ? e.filesize : "analysis:content-length" in e.extras ? e.extras["analysis:content-length"] : null;
272
269
  }
273
- var K = [
270
+ var G = [
274
271
  "png",
275
272
  "jpg",
276
273
  "jpeg",
@@ -278,27 +275,27 @@ var K = [
278
275
  "gif",
279
276
  "webp"
280
277
  ];
281
- function q(e) {
282
- return e ? K.includes(e.toLowerCase()) : !1;
278
+ function K(e) {
279
+ return e ? G.includes(e.toLowerCase()) : !1;
283
280
  }
284
- function J(e) {
281
+ function q(e) {
285
282
  let t = e.extras["analysis:parsing:error"];
286
283
  if (typeof t != "string" || !t) return null;
287
284
  let [n] = t.split(":", 1);
288
285
  return n ?? null;
289
286
  }
290
- function Y(e) {
287
+ function J(e) {
291
288
  let t = e.extras["analysis:parsing:error"];
292
289
  if (typeof t != "string" || !t) return null;
293
290
  let n = t.indexOf(":");
294
291
  return n === -1 ? t : t.slice(n + 1);
295
292
  }
296
- var X = ["pmtiles_export", "geojson_export"];
297
- function Z(e) {
298
- let t = J(e);
299
- return t !== null && !X.includes(t);
293
+ var Y = ["pmtiles_export", "geojson_export"];
294
+ function X(e) {
295
+ let t = q(e);
296
+ return t !== null && !Y.includes(t);
300
297
  }
301
- var Q = (e) => {
298
+ var Z = (e) => {
302
299
  let t = e.extras;
303
300
  if (!t || !("check:cors:allow-origin" in t)) return "unknown";
304
301
  let r = t["check:cors:allow-origin"], i = t["check:cors:allow-methods"], a = n().trustedDomains ?? [], o = r === "*", s = r ? a.some((e) => {
@@ -312,4 +309,4 @@ var Q = (e) => {
312
309
  return c && u ? "allowed" : "blocked";
313
310
  };
314
311
  //#endregion
315
- export { q as _, Y as a, H as c, P as d, R as f, U as g, V as h, B as i, G as l, Z as m, L as n, J as o, F as p, I as r, Q as s, z as t, N as u, W as v, c as y };
312
+ export { U as _, J as a, H as c, P as d, R as f, K as g, V as h, B as i, W as l, X as m, L as n, q as o, F as p, I as r, Z as s, z as t, N as u, c as v };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datagouv/components-next",
3
- "version": "1.0.2-dev.237",
3
+ "version": "1.0.2-dev.239",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "engines": {
@@ -4,8 +4,7 @@
4
4
  icon-only
5
5
  :icon="RiPencilLine"
6
6
  color="warning"
7
- :disabled="!!disabledReason"
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()
@@ -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, isGeopfSynced, isImagePreviewFormat, resolveResourceExternalUrl } from '../../functions/resources'
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.
@@ -74,7 +74,7 @@
74
74
  <strong>
75
75
  + {{ summarize(lastValue, 2) }}
76
76
  </strong>
77
- {{ t(" en ") }}
77
+ {{ t("en") }}
78
78
  <FormattedDate
79
79
  :date="lastMonth"
80
80
  :options="{ dateStyle: undefined, year: 'numeric', month: 'short', day: undefined }"
@@ -146,12 +146,12 @@
146
146
  </div>
147
147
  <p
148
148
  v-if="lastValue && lastMonth"
149
- class="mt-2 font-normal normal-case fr-badge fr-badge--no-icon fr-badge--success"
149
+ class="mt-2 gap-1 font-normal normal-case fr-badge fr-badge--no-icon fr-badge--success"
150
150
  >
151
- <strong class="mr-1">
151
+ <strong>
152
152
  + {{ summarize(lastValue, 2) }}
153
153
  </strong>
154
- {{ t(" en ") }}
154
+ {{ t("en") }}
155
155
  <FormattedDate
156
156
  :date="lastMonth"
157
157
  :options="{ dateStyle: undefined, year: 'numeric', month: 'short', day: undefined }"
@@ -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,
@@ -70,6 +70,7 @@ export type Dataset = BaseDataset & {
70
70
  id: DatasetReference['id']
71
71
  badges: Badges
72
72
  deleted: string | null
73
+ doi: string | null
73
74
  page: DatasetReference['page']
74
75
  resources: Array<Resource>
75
76
  community_resources: Array<Resource>
@@ -1,3 +1,4 @@
1
1
  export type Harvest = Record<string, unknown> & {
2
2
  backend?: string
3
+ doi?: string | null
3
4
  } | null
@@ -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