@datagouv/components-next 1.1.2 → 1.3.0

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.
Files changed (62) hide show
  1. package/README.md +7 -6
  2. package/dist/{Control-ZFh5ta_U.js → Control-b-43UT2B.js} +10 -10
  3. package/dist/{Datafair.client-8bXp6UeQ.js → Datafair.client-BrjISlaZ.js} +4 -4
  4. package/dist/{Event-DSQcW7OF.js → Event-py_AAwJY.js} +18 -18
  5. package/dist/{Image-BijNEG0p.js → Image-BHQYZWzH.js} +23 -23
  6. package/dist/{JsonPreview.client-BxuoPK_w.js → JsonPreview.client-DivFAnbN.js} +5 -5
  7. package/dist/{Map-BUtPf5GN.js → Map-CtP7leHl.js} +1313 -1173
  8. package/dist/{MapContainer.client-CTz0wmJG.js → MapContainer.client-Cq8tNLZZ.js} +17 -17
  9. package/dist/{OSM-D4MTdBtk.js → OSM-gdDSIsDA.js} +15 -23
  10. package/dist/{PdfPreview.client-DpVreUSl.js → PdfPreview.client-BNBgLsK2.js} +6 -10
  11. package/dist/Pmtiles.client-CQi5Rw8W.js +26123 -0
  12. package/dist/{PreviewWrapper.vue_vue_type_script_setup_true_lang-stmU5qEB.js → PreviewWrapper.vue_vue_type_script_setup_true_lang-C3dDzrIr.js} +2 -2
  13. package/dist/{ScaleLine-hJQIqcZm.js → ScaleLine-hG-FhNqy.js} +2 -2
  14. package/dist/{Tile-Dcl7oIVu.js → Tile-D6rFonpT.js} +163 -166
  15. package/dist/{TileImage-BJeHipMX.js → TileImage-cfrEgz5y.js} +131 -119
  16. package/dist/{View-xp_P_OHw.js → View-vp7vDb9q.js} +169 -119
  17. package/dist/{XmlPreview.client-DAOs89cR.js → XmlPreview.client-XCsNvnsZ.js} +5 -5
  18. package/dist/{common-BjQlan3k.js → common-C8efyyuc.js} +49 -49
  19. package/dist/components-next.css +1 -52
  20. package/dist/components-next.js +166 -157
  21. package/dist/components.css +2 -2
  22. package/dist/{index-JqjPja1u.js → index-CXUamc8Z.js} +6382 -6057
  23. package/dist/{leaflet-src-7m1mB8LI.js → leaflet-src-BRKv9Ksv.js} +162 -164
  24. package/dist/{main-D4WQMky0.js → main-DKu5SOAl.js} +48480 -97188
  25. package/dist/{proj-CsNo9yH1.js → proj-CsjVeojN.js} +322 -306
  26. package/dist/{text-clamp.esm-B5kW_XMt.js → text-clamp.esm-DVseBqZZ.js} +4 -4
  27. package/dist/{tilecoord-A0fLnBZr.js → tilecoord-CPcQJnrF.js} +270 -261
  28. package/dist/{vue3-json-viewer-BXwup7nO.js → vue3-json-viewer-CJLQFzXZ.js} +10 -16
  29. package/dist/{vue3-xml-viewer.common-BGsoNyZe.js → vue3-xml-viewer.common-BIaEIFYG.js} +1 -1
  30. package/package.json +42 -35
  31. package/src/chart.ts +5 -0
  32. package/src/components/ActivityList/ActivityList.vue +3 -0
  33. package/src/components/DatasetCard.vue +6 -4
  34. package/src/components/ObjectCardHeader.vue +1 -1
  35. package/src/components/RadioInput.vue +7 -2
  36. package/src/components/ResourceAccordion/DataStructure.vue +11 -33
  37. package/src/components/ResourceAccordion/Downloads.vue +160 -0
  38. package/src/components/ResourceAccordion/Pmtiles.client.vue +3 -1
  39. package/src/components/ResourceAccordion/ResourceAccordion.vue +7 -104
  40. package/src/components/ResourceExplorer/ResourceExplorer.vue +10 -64
  41. package/src/components/ResourceExplorer/ResourceExplorerViewer.vue +30 -136
  42. package/src/components/ResourceExplorer/ResourceSelector.vue +113 -0
  43. package/src/components/Search/GlobalSearch.vue +27 -6
  44. package/src/components/TabularExplorer/TabularCellPopover.vue +2 -2
  45. package/src/components/TabularExplorer/TabularExplorer.vue +404 -163
  46. package/src/components/TabularExplorer/TabularFilterContent.vue +15 -13
  47. package/src/components/TabularExplorer/TabularFilterPopover.vue +21 -26
  48. package/src/components/TabularExplorer/types.ts +9 -9
  49. package/src/composables/useHasTabularData.ts +7 -0
  50. package/src/composables/useResourceCapabilities.ts +1 -1
  51. package/src/composables/useSearchFilter.ts +7 -5
  52. package/src/composables/useStableQueryParams.ts +7 -3
  53. package/src/composables/useTabularProfile.ts +70 -0
  54. package/src/functions/activities.ts +3 -3
  55. package/src/functions/api.ts +13 -7
  56. package/src/functions/resources.ts +5 -0
  57. package/src/functions/tabular.ts +103 -1
  58. package/src/main.ts +12 -6
  59. package/src/types/resources.ts +0 -1
  60. package/src/types/search.ts +11 -0
  61. package/src/types/ui.ts +1 -1
  62. package/dist/Pmtiles.client-BwmHo3T8.js +0 -25185
@@ -36,7 +36,7 @@
36
36
  :value="configKey(typeConfig)"
37
37
  :count="resultsMap[configKey(typeConfig)]?.data.value?.total"
38
38
  :loading="resultsMap[configKey(typeConfig)]?.status.value === 'pending' || resultsMap[configKey(typeConfig)]?.status.value === 'idle'"
39
- :icon="strategies[typeConfig.class].icon"
39
+ :icon="typeConfig.icon ?? strategies[typeConfig.class].icon"
40
40
  >
41
41
  {{ typeConfig.name || strategies[typeConfig.class].name }}
42
42
  </RadioInput>
@@ -200,10 +200,13 @@
200
200
  <div class="fr-col">
201
201
  <select
202
202
  id="sort-search"
203
- v-model="sort"
203
+ v-model="effectiveSort"
204
204
  class="fr-select text-sm shadow-input-blue!"
205
205
  >
206
- <option :value="undefined">
206
+ <option
207
+ v-if="!currentTypeConfig?.defaultSort"
208
+ :value="undefined"
209
+ >
207
210
  {{ t('Pertinence') }}
208
211
  </option>
209
212
  <option
@@ -489,6 +492,10 @@ const { debounced: qDebounced, flush: flushQ } = useDebouncedRef(q, componentsCo
489
492
  const qForParams = computed(() => props.hideSearchInput ? q.value : qDebounced.value)
490
493
  const page = useRouteQuery('page', 1, { transform: Number })
491
494
  const sort = useRouteQuery<string | undefined>('sort')
495
+ const effectiveSort = computed({
496
+ get: () => sort.value ?? currentTypeConfig.value?.defaultSort,
497
+ set: (value) => { sort.value = value },
498
+ })
492
499
 
493
500
  provide(searchFilterContextKey, {
494
501
  register(urlParam, entry) {
@@ -542,20 +549,34 @@ const allFilters: Record<string, Ref<unknown>> = {
542
549
  type: reuseType,
543
550
  }
544
551
 
545
- // Reset sort and filters when changing type if they're not valid for the new type
552
+ // Reset page, sort and filters when changing type. Every reset below goes
553
+ // through useRouteQuery, so VueUse coalesces them into a single router.replace
554
+ // (its shared _queriesQueue flushes once on nextTick). Custom filters are cleared
555
+ // here too, rather than in useSearchFilter's onunmount, so their URL change joins
556
+ // that same batch instead of racing it with a separate router.replace.
546
557
  watch(currentType, () => {
558
+ // page=1 is the default and is dropped from the URL, so only reset when needed.
559
+ if (page.value !== 1) page.value = 1
560
+
547
561
  // Reset sort if not valid
548
562
  const validSortValues = activeSortOptions.value.map(o => o.value as string)
549
563
  if (sort.value && !validSortValues.includes(sort.value)) {
550
564
  sort.value = undefined
551
565
  }
552
566
 
553
- // Reset filters that are not enabled for the new type
567
+ // Reset built-in filters that are not enabled for the new type
554
568
  for (const [filterName, filterRef] of Object.entries(allFilters)) {
555
569
  if (filterRef.value !== undefined && !activeFilters.value.includes(filterName)) {
556
570
  filterRef.value = undefined
557
571
  }
558
572
  }
573
+
574
+ // Reset type-scoped custom filters that don't apply to the new type
575
+ for (const entry of customFilterRegistry.values()) {
576
+ if (entry.typeKeys && !entry.typeKeys.includes(currentType.value) && isCustomFilterActive(entry)) {
577
+ entry.ref.value = entry.defaultValue
578
+ }
579
+ }
559
580
  })
560
581
 
561
582
  // Create stable params for each type
@@ -759,7 +780,7 @@ const rssUrl = computed(() => {
759
780
  }, currentTypeConfig.value ? configKey(currentTypeConfig.value) : undefined)
760
781
 
761
782
  // Add sort if set
762
- if (sort.value) params.set('sort', sort.value)
783
+ if (effectiveSort.value) params.set('sort', effectiveSort.value)
763
784
 
764
785
  const queryString = params.toString()
765
786
  const basePath = '/api/1/datasets/recent.atom'
@@ -38,7 +38,7 @@
38
38
  class="flex items-center gap-2.5 w-full px-3 py-2 rounded-md text-xs font-medium hover:bg-gray-50"
39
39
  @click="filterByValue"
40
40
  >
41
- <RiFilter2Line
41
+ <RiFilterLine
42
42
  class="size-4"
43
43
  aria-hidden="true"
44
44
  />
@@ -71,7 +71,7 @@ import { computed, ref, useTemplateRef, watch } from 'vue'
71
71
  import { flip, shift, autoUpdate, useFloating } from '@floating-ui/vue'
72
72
  import { onClickOutside } from '@vueuse/core'
73
73
  import {
74
- RiFilter2Line,
74
+ RiFilterLine,
75
75
  RiFileCopyLine,
76
76
  RiCheckLine,
77
77
  } from '@remixicon/vue'