@datagouv/components-next 1.0.2-dev.17 → 1.0.2-dev.170

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 (124) hide show
  1. package/README.md +7 -6
  2. package/assets/main.css +4 -0
  3. package/dist/{Control-DuZJdKV_.js → Control-B9WQxlpJ.js} +1 -1
  4. package/dist/{Datafair.client-Ds3VQrRi.js → Datafair.client-B-OG5WtK.js} +4 -4
  5. package/dist/{Event--kp8kMdJ.js → Event-iXDrp-fy.js} +31 -31
  6. package/dist/{Image-34hvypZI.js → Image-mNMBOofs.js} +9 -9
  7. package/dist/ImagePreview.client-D0c-ifUi.js +36 -0
  8. package/dist/JsonPreview.client-Dwh9sW9M.js +40 -0
  9. package/dist/{Map-BjUnLyj8.js → Map-BfqKMw0S.js} +1739 -1599
  10. package/dist/{MapContainer.client-B2BijMx5.js → MapContainer.client-C2AZ7sOB.js} +38 -39
  11. package/dist/{OSM-s40W6sQ2.js → OSM-CcrUhItr.js} +15 -23
  12. package/dist/{PdfPreview.client-DJBMzrlC.js → PdfPreview.client-8NzNfW8b.js} +823 -855
  13. package/dist/Pmtiles.client-BFH4rTB7.js +26324 -0
  14. package/dist/PreviewWrapper.vue_vue_type_script_setup_true_lang-BOgE441d.js +58 -0
  15. package/dist/{ScaleLine-KW-nXqp3.js → ScaleLine-VGQ7nkMS.js} +2 -2
  16. package/dist/{Tile-DbNFNPfU.js → Tile-CSpn0Ca8.js} +160 -163
  17. package/dist/{TileImage-BsXBxMtq.js → TileImage-CpbaEFwd.js} +143 -131
  18. package/dist/{View-BR92hTWP.js → View-BYBpt-AU.js} +483 -422
  19. package/dist/XmlPreview.client-DMOUO508.js +34 -0
  20. package/dist/{common-PJfpC179.js → common-BoeTUnDZ.js} +52 -52
  21. package/dist/components-next.css +1 -52
  22. package/dist/components-next.js +183 -146
  23. package/dist/components.css +2 -2
  24. package/dist/{index-BFQX7Ccz.js → index-C9obT9DJ.js} +21834 -15810
  25. package/dist/{leaflet-src-7m1mB8LI.js → leaflet-src-B4AZU0vr.js} +185 -187
  26. package/dist/{main-vqhkVhVS.js → main-DNoYWfit.js} +40723 -73240
  27. package/dist/{proj-DsetBcW7.js → proj-DxGbobp7.js} +662 -626
  28. package/dist/{text-clamp.esm-B5kW_XMt.js → text-clamp.esm-DVseBqZZ.js} +4 -4
  29. package/dist/{tilecoord-Db24Px13.js → tilecoord-DvX7WWiA.js} +273 -264
  30. package/dist/{vue3-json-viewer-BXwup7nO.js → vue3-json-viewer-CJLQFzXZ.js} +10 -16
  31. package/dist/{vue3-xml-viewer.common-BcNJo35o.js → vue3-xml-viewer.common-Cp7Cu5ME.js} +16 -16
  32. package/package.json +47 -38
  33. package/src/chart.ts +5 -0
  34. package/src/components/ActivityList/ActivityList.vue +3 -2
  35. package/src/components/Chart/ChartViewer.vue +320 -0
  36. package/src/components/Chart/ChartViewerWrapper.vue +182 -0
  37. package/src/components/DataserviceCard.vue +9 -0
  38. package/src/components/DataserviceQuality.vue +82 -0
  39. package/src/components/DataserviceQualityInline.vue +31 -0
  40. package/src/components/DataserviceQualityTooltipContent.vue +79 -0
  41. package/src/components/DatasetCard.vue +9 -4
  42. package/src/components/DatasetQuality.vue +11 -11
  43. package/src/components/DatasetQualityInline.vue +2 -2
  44. package/src/components/DatasetQualityTooltipContent.vue +1 -1
  45. package/src/components/Form/Listbox.vue +101 -0
  46. package/src/components/InfiniteLoader.vue +53 -0
  47. package/src/components/ObjectCardHeader.vue +11 -4
  48. package/src/components/OpenApiViewer/ContentTypeSelect.vue +48 -0
  49. package/src/components/OpenApiViewer/EndpointRequest.vue +164 -0
  50. package/src/components/OpenApiViewer/EndpointResponses.vue +149 -0
  51. package/src/components/OpenApiViewer/OpenApiViewer.vue +308 -0
  52. package/src/components/OpenApiViewer/SchemaPanel.vue +53 -0
  53. package/src/components/OpenApiViewer/SchemaTree.vue +77 -0
  54. package/src/components/OpenApiViewer/openapi.ts +150 -0
  55. package/src/components/OrganizationNameWithCertificate.vue +3 -2
  56. package/src/components/Pagination.vue +8 -5
  57. package/src/components/RadioInput.vue +7 -2
  58. package/src/components/ResourceAccordion/DataStructure.vue +11 -33
  59. package/src/components/ResourceAccordion/Downloads.vue +160 -0
  60. package/src/components/ResourceAccordion/ImagePreview.client.vue +48 -0
  61. package/src/components/ResourceAccordion/JsonPreview.client.vue +23 -104
  62. package/src/components/ResourceAccordion/MapContainer.client.vue +1 -3
  63. package/src/components/ResourceAccordion/Metadata.vue +1 -2
  64. package/src/components/ResourceAccordion/PdfPreview.client.vue +24 -87
  65. package/src/components/ResourceAccordion/Pmtiles.client.vue +3 -1
  66. package/src/components/ResourceAccordion/Preview.vue +11 -11
  67. package/src/components/ResourceAccordion/PreviewWrapper.vue +82 -0
  68. package/src/components/ResourceAccordion/ResourceAccordion.vue +19 -113
  69. package/src/components/ResourceAccordion/XmlPreview.client.vue +16 -98
  70. package/src/components/ResourceExplorer/ResourceExplorer.vue +22 -19
  71. package/src/components/ResourceExplorer/ResourceExplorerSidebar.vue +2 -2
  72. package/src/components/ResourceExplorer/ResourceExplorerViewer.vue +64 -148
  73. package/src/components/ResourceExplorer/ResourceSelector.vue +113 -0
  74. package/src/components/ReuseCard.vue +14 -6
  75. package/src/components/ReuseDetails.vue +2 -2
  76. package/src/components/ReuseHorizontalCard.vue +2 -2
  77. package/src/components/Search/GlobalSearch.vue +219 -117
  78. package/src/components/Search/SearchInput.vue +5 -4
  79. package/src/components/TabularExplorer/TabularCell.vue +52 -0
  80. package/src/components/TabularExplorer/TabularCellPopover.vue +170 -0
  81. package/src/components/TabularExplorer/TabularExplorer.vue +1225 -0
  82. package/src/components/TabularExplorer/TabularFilterContent.vue +370 -0
  83. package/src/components/TabularExplorer/TabularFilterPopover.vue +107 -0
  84. package/src/components/TabularExplorer/types.ts +86 -0
  85. package/src/composables/useHasTabularData.ts +15 -1
  86. package/src/composables/useMetrics.ts +1 -1
  87. package/src/composables/useResourceCapabilities.ts +28 -15
  88. package/src/composables/useSearchFilter.ts +120 -0
  89. package/src/composables/useStableQueryParams.ts +38 -6
  90. package/src/composables/useTabularProfile.ts +70 -0
  91. package/src/config.ts +21 -3
  92. package/src/functions/activities.ts +3 -3
  93. package/src/functions/api.ts +20 -42
  94. package/src/functions/api.types.ts +1 -0
  95. package/src/functions/charts.ts +99 -0
  96. package/src/functions/datasets.ts +0 -17
  97. package/src/functions/dates.ts +3 -2
  98. package/src/functions/metrics.ts +6 -4
  99. package/src/functions/resources.ts +117 -1
  100. package/src/functions/tabular.ts +214 -0
  101. package/src/functions/tabularApi.ts +96 -11
  102. package/src/main.ts +109 -14
  103. package/src/types/dataservices.ts +17 -0
  104. package/src/types/organizations.ts +10 -0
  105. package/src/types/pages.ts +0 -5
  106. package/src/types/posts.ts +2 -2
  107. package/src/types/reports.ts +5 -1
  108. package/src/types/resources.ts +0 -1
  109. package/src/types/reuses.ts +12 -1
  110. package/src/types/search.ts +63 -1
  111. package/src/types/site.ts +5 -3
  112. package/src/types/ui.ts +2 -0
  113. package/src/types/users.ts +2 -1
  114. package/src/types/visualizations.ts +93 -0
  115. package/assets/swagger-themes/newspaper.css +0 -1670
  116. package/dist/JsonPreview.client-CYxmz0yV.js +0 -72
  117. package/dist/Pmtiles.client-C_hvRDuy.js +0 -25185
  118. package/dist/Swagger.client-B4y0hXME.js +0 -4
  119. package/dist/XmlPreview.client-LETEfNBH.js +0 -64
  120. package/src/components/ResourceAccordion/Swagger.client.vue +0 -48
  121. package/src/functions/pagination.ts +0 -9
  122. /package/src/components/{DatasetQualityItem.vue → QualityItem.vue} +0 -0
  123. /package/src/components/{DatasetQualityItemWarning.vue → QualityItemWarning.vue} +0 -0
  124. /package/src/components/{DatasetQualityScore.vue → QualityScore.vue} +0 -0
@@ -0,0 +1,182 @@
1
+ <template>
2
+ <LoadingBlock
3
+ :status="status"
4
+ :data="series"
5
+ >
6
+ <template #default="{ data }">
7
+ <ChartViewer
8
+ ref="chartViewerRef"
9
+ :chart="chart"
10
+ :series="data"
11
+ />
12
+ </template>
13
+ <template #error>
14
+ <div class="text-center py-8 text-gray-500">
15
+ {{ t('Une erreur est survenue lors du chargement des données du graphique.') }}
16
+ </div>
17
+ </template>
18
+ </LoadingBlock>
19
+ </template>
20
+
21
+ <script setup lang="ts">
22
+ import { computed, reactive, ref, watch } from 'vue'
23
+ import ChartViewer from './ChartViewer.vue'
24
+ import LoadingBlock from '../../components/LoadingBlock.vue'
25
+ import { useComponentsConfig } from '../../config'
26
+ import { fetchTabularData, useGetProfile } from '../../functions/tabularApi'
27
+ import type { Chart, ChartForApi, ColumnsDefinition } from '../../types/visualizations'
28
+ import { useTranslation } from '../../composables/useTranslation'
29
+ import { watchDebounced } from '@vueuse/shared'
30
+ import { buildColumnsFromProfile } from '../../functions/charts'
31
+
32
+ const props = defineProps<{
33
+ chart: Chart | ChartForApi
34
+ }>()
35
+
36
+ const { t } = useTranslation()
37
+ const chartViewerRef = ref<InstanceType<typeof ChartViewer> | null>(null)
38
+
39
+ function capture(): string | null {
40
+ return chartViewerRef.value?.capture() ?? null
41
+ }
42
+
43
+ defineExpose({ capture })
44
+ const config = useComponentsConfig()
45
+ const getProfile = useGetProfile()
46
+
47
+ const status = ref<'idle' | 'pending' | 'success' | 'error'>('idle')
48
+ const error = ref<Error | null>(null)
49
+
50
+ const pendingOperations = ref(0)
51
+
52
+ const series = reactive<{
53
+ data: Record<string, Array<Record<string, unknown>>>
54
+ columns: ColumnsDefinition
55
+ }>({
56
+ data: {},
57
+ columns: {},
58
+ })
59
+
60
+ const resourceIds = computed(() => {
61
+ return props.chart.series
62
+ .filter(s => s.resource_id)
63
+ .map(s => s.resource_id)
64
+ })
65
+
66
+ async function fetchSeriesProfile() {
67
+ pendingOperations.value++
68
+ status.value = 'pending'
69
+ error.value = null
70
+
71
+ try {
72
+ if (props.chart.series.length === 0) {
73
+ status.value = 'success'
74
+ series.data = {}
75
+ series.columns = {}
76
+ return
77
+ }
78
+
79
+ const fetchPromises = props.chart.series
80
+ .filter(serie => serie.resource_id)
81
+ .map(async (serie) => {
82
+ return {
83
+ id: serie.resource_id,
84
+ profile: await getProfile(serie.resource_id),
85
+ }
86
+ })
87
+
88
+ const results = (await Promise.allSettled(fetchPromises))
89
+ .filter(r => r.status === 'fulfilled')
90
+ .map(r => r.value)
91
+ series.columns = Object.fromEntries(results.map(result => [
92
+ result.id,
93
+ buildColumnsFromProfile(result.profile),
94
+ ]))
95
+ }
96
+ catch (err) {
97
+ error.value = err instanceof Error ? err : new Error('Failed to fetch series profile')
98
+ status.value = 'error'
99
+ console.error(err)
100
+ series.columns = {}
101
+ series.data = {}
102
+ }
103
+ finally {
104
+ pendingOperations.value--
105
+ }
106
+ }
107
+
108
+ async function fetchSeriesData() {
109
+ pendingOperations.value++
110
+ status.value = 'pending'
111
+ error.value = null
112
+
113
+ try {
114
+ if (props.chart.series.length === 0 || !props.chart.x_axis.column_x) {
115
+ status.value = 'success'
116
+ series.data = {}
117
+ return
118
+ }
119
+
120
+ const fetchPromises = props.chart.series
121
+ .filter((serie) => {
122
+ const xColumn = serie.column_x_name_override ?? props.chart.x_axis.column_x
123
+ return xColumn && serie.resource_id && serie.column_y
124
+ })
125
+ .map(async (serie) => {
126
+ const xColumn = serie.column_x_name_override ?? props.chart.x_axis.column_x
127
+ return {
128
+ id: serie.resource_id,
129
+ data: await fetchTabularData(config, {
130
+ columns: serie.aggregate_y ? undefined : [xColumn, serie.column_y],
131
+ resourceId: serie.resource_id,
132
+ page: 1,
133
+ pageSize: 100,
134
+ groupBy: xColumn,
135
+ aggregation: serie.column_y && serie.aggregate_y
136
+ ? {
137
+ column: serie.column_y,
138
+ type: serie.aggregate_y,
139
+ }
140
+ : undefined,
141
+ filters: serie.filters ?? undefined,
142
+ }),
143
+ }
144
+ })
145
+
146
+ const results = (await Promise.allSettled(fetchPromises))
147
+ .filter(r => r.status === 'fulfilled')
148
+ .map(r => r.value)
149
+ series.data = Object.fromEntries(results.map(result => [
150
+ result.id,
151
+ result.data.data,
152
+ ]))
153
+ }
154
+ catch (err) {
155
+ error.value = err instanceof Error ? err : new Error('Failed to fetch series data')
156
+ status.value = 'error'
157
+ series.data = {}
158
+ }
159
+ finally {
160
+ pendingOperations.value--
161
+ }
162
+ }
163
+
164
+ watch(resourceIds, async () => {
165
+ await fetchSeriesProfile()
166
+ }, { immediate: true })
167
+
168
+ watchDebounced([
169
+ () => props.chart.series,
170
+ () => props.chart.x_axis.column_x,
171
+ ], async () => {
172
+ await fetchSeriesData()
173
+ }, { debounce: config.searchDebounce ?? 300, immediate: true, deep: true })
174
+
175
+ watch(pendingOperations, (count) => {
176
+ if (count === 0) {
177
+ if (error.value === null && status.value === 'pending') {
178
+ status.value = 'success'
179
+ }
180
+ }
181
+ })
182
+ </script>
@@ -53,6 +53,7 @@
53
53
  <ObjectCardHeader
54
54
  :icon="isTabularApi ? RiSparklingLine : RiTerminalLine"
55
55
  :url="dataserviceUrl || dataservice.self_web_url"
56
+ :title-tag="titleTag"
56
57
  >
57
58
  {{ dataservice.title }}
58
59
  </ObjectCardHeader>
@@ -98,6 +99,11 @@
98
99
  </p>
99
100
  </div>
100
101
  </div>
102
+ <DataserviceQualityInline
103
+ v-if="dataservice.quality"
104
+ :quality="dataservice.quality"
105
+ />
106
+
101
107
  <ObjectCardShortDescription
102
108
  v-if="showDescription"
103
109
  :text="dataservice.description"
@@ -115,6 +121,7 @@ import { useComponentsConfig } from '../config'
115
121
  import { useFormatDate } from '../functions/dates'
116
122
  import { summarize } from '../functions/helpers'
117
123
  import type { Dataservice } from '../types/dataservices'
124
+ import type { TitleTag } from '../types/ui'
118
125
  import { useTranslation } from '../composables/useTranslation'
119
126
  import OrganizationLogo from './OrganizationLogo.vue'
120
127
  import Avatar from './Avatar.vue'
@@ -124,12 +131,14 @@ import ObjectCardBadge from './ObjectCardBadge.vue'
124
131
  import ObjectCardHeader from './ObjectCardHeader.vue'
125
132
  import ObjectCardOwner from './ObjectCardOwner.vue'
126
133
  import ObjectCardShortDescription from './ObjectCardShortDescription.vue'
134
+ import DataserviceQualityInline from './DataserviceQualityInline.vue'
127
135
 
128
136
  type Props = {
129
137
  dataservice: Dataservice
130
138
  dataserviceUrl?: RouteLocationRaw
131
139
  organizationUrl?: RouteLocationRaw
132
140
  showDescription?: boolean
141
+ titleTag?: TitleTag
133
142
  }
134
143
 
135
144
  const props = withDefaults(defineProps<Props>(), {
@@ -0,0 +1,82 @@
1
+ <template>
2
+ <Toggletip
3
+ :styled-button="false"
4
+ button-class="flex items-center gap-1 rounded-sm p-1.5 -m-1.5 border-transparent -outline-offset-2 hover:bg-gray-some transition-colors w-full text-left"
5
+ :button-props="{ title: t('Qualité des métadonnées') }"
6
+ >
7
+ <QualityScore
8
+ :score="quality.score"
9
+ class="w-full"
10
+ />
11
+ <RiInformationLine
12
+ class="size-5 shrink-0"
13
+ aria-hidden="true"
14
+ />
15
+ <template #toggletip>
16
+ <DataserviceQualityTooltipContent :quality />
17
+ </template>
18
+ </Toggletip>
19
+ <template v-if="!hideWarnings">
20
+ <ul class="list-none pl-0">
21
+ <QualityItemWarning
22
+ :quality-item="quality.has_description"
23
+ :message="t('Description non renseignée')"
24
+ />
25
+ <QualityItemWarning
26
+ :quality-item="quality.has_machine_documentation"
27
+ :message="t('Documentation machine (OpenAPI) manquante')"
28
+ />
29
+ <QualityItemWarning
30
+ :quality-item="quality.has_technical_documentation"
31
+ :message="t('Documentation technique manquante')"
32
+ />
33
+ <QualityItemWarning
34
+ :quality-item="quality.has_business_documentation"
35
+ :message="t('Documentation métier manquante')"
36
+ />
37
+ <QualityItemWarning
38
+ :quality-item="quality.license"
39
+ :message="t('Licence non renseignée')"
40
+ />
41
+ <QualityItemWarning
42
+ :quality-item="quality.has_contact_point"
43
+ :message="t('Point de contact non renseigné')"
44
+ />
45
+ <QualityItemWarning
46
+ :quality-item="quality.has_base_api_url"
47
+ :message="t(`URL de base de l'API non renseignée`)"
48
+ />
49
+ <QualityItemWarning
50
+ :quality-item="quality.availability_documented"
51
+ :message="t('Disponibilité non documentée')"
52
+ />
53
+ <QualityItemWarning
54
+ :quality-item="quality.rate_limiting_documented"
55
+ :message="t(`Limite d'appels non documentée`)"
56
+ />
57
+ <QualityItemWarning
58
+ :quality-item="quality.access_conditions_clear"
59
+ :message="t(`Conditions d'accès non précisées`)"
60
+ />
61
+ </ul>
62
+ </template>
63
+ </template>
64
+
65
+ <script setup lang="ts">
66
+ import { RiInformationLine } from '@remixicon/vue'
67
+ import type { DataserviceQuality } from '../types/dataservices'
68
+ import QualityScore from './QualityScore.vue'
69
+ import QualityItemWarning from './QualityItemWarning.vue'
70
+ import DataserviceQualityTooltipContent from './DataserviceQualityTooltipContent.vue'
71
+ import Toggletip from './Toggletip.vue'
72
+ import { useTranslation } from '../composables/useTranslation'
73
+
74
+ withDefaults(defineProps<{
75
+ quality: DataserviceQuality
76
+ hideWarnings?: boolean
77
+ }>(), {
78
+ hideWarnings: false,
79
+ })
80
+
81
+ const { t } = useTranslation()
82
+ </script>
@@ -0,0 +1,31 @@
1
+ <template>
2
+ <div class="m-0 text-sm text-gray-medium">
3
+ <Toggletip
4
+ :styled-button="false"
5
+ button-class="border-transparent -outline-offset-2 inline-flex items-center justify-center hover:bg-gray-lower transition-colors"
6
+ :button-props="{ class: 'relative z-2 gap-1 rounded-sm px-1 -mx-1 group/quality', title: t('Qualité des métadonnées') }"
7
+ >
8
+ <RiInformationLine class="size-3.5 shrink-0" />
9
+ <span class="text-gray-medium text-sm group-hover/quality:underline">{{ t('Métadonnées :') }}</span>
10
+ <QualityScore :score="quality.score" />
11
+ <template #toggletip>
12
+ <DataserviceQualityTooltipContent :quality />
13
+ </template>
14
+ </Toggletip>
15
+ </div>
16
+ </template>
17
+
18
+ <script setup lang="ts">
19
+ import { RiInformationLine } from '@remixicon/vue'
20
+ import type { DataserviceQuality } from '../types/dataservices'
21
+ import QualityScore from './QualityScore.vue'
22
+ import DataserviceQualityTooltipContent from './DataserviceQualityTooltipContent.vue'
23
+ import Toggletip from './Toggletip.vue'
24
+ import { useTranslation } from '../composables/useTranslation'
25
+
26
+ defineProps<{
27
+ quality: DataserviceQuality
28
+ }>()
29
+
30
+ const { t } = useTranslation()
31
+ </script>
@@ -0,0 +1,79 @@
1
+ <template>
2
+ <p class="text-sm text-gray-plain font-bold mb-0">
3
+ {{ t("Qualité des métadonnées :") }}
4
+ </p>
5
+ <ul class="list-none pl-0 space-y-2">
6
+ <QualityItem
7
+ :passed="quality.has_description"
8
+ :message-passed="t('Description renseignée')"
9
+ :message-failed="t('Description non renseignée')"
10
+ class="pb-0"
11
+ />
12
+ <QualityItem
13
+ :passed="quality.has_machine_documentation"
14
+ :message-passed="t('Documentation machine (OpenAPI) disponible')"
15
+ :message-failed="t('Documentation machine (OpenAPI) manquante')"
16
+ class="pb-0"
17
+ />
18
+ <QualityItem
19
+ :passed="quality.has_technical_documentation"
20
+ :message-passed="t('Documentation technique renseignée')"
21
+ :message-failed="t('Documentation technique manquante')"
22
+ class="pb-0"
23
+ />
24
+ <QualityItem
25
+ :passed="quality.has_business_documentation"
26
+ :message-passed="t('Documentation métier renseignée')"
27
+ :message-failed="t('Documentation métier manquante')"
28
+ class="pb-0"
29
+ />
30
+ <QualityItem
31
+ :passed="quality.license"
32
+ :message-passed="t('Licence renseignée')"
33
+ :message-failed="t('Licence non renseignée')"
34
+ class="pb-0"
35
+ />
36
+ <QualityItem
37
+ :passed="quality.has_contact_point"
38
+ :message-passed="t('Point de contact renseigné')"
39
+ :message-failed="t('Point de contact non renseigné')"
40
+ class="pb-0"
41
+ />
42
+ <QualityItem
43
+ :passed="quality.has_base_api_url"
44
+ :message-passed="t(`URL de base de l'API renseignée`)"
45
+ :message-failed="t(`URL de base de l'API non renseignée`)"
46
+ class="pb-0"
47
+ />
48
+ <QualityItem
49
+ :passed="quality.availability_documented"
50
+ :message-passed="t('Disponibilité documentée')"
51
+ :message-failed="t('Disponibilité non documentée')"
52
+ class="pb-0"
53
+ />
54
+ <QualityItem
55
+ :passed="quality.rate_limiting_documented"
56
+ :message-passed="t(`Limite d'appels documentée`)"
57
+ :message-failed="t(`Limite d'appels non documentée`)"
58
+ class="pb-0"
59
+ />
60
+ <QualityItem
61
+ :passed="quality.access_conditions_clear"
62
+ :message-passed="t(`Conditions d'accès claires`)"
63
+ :message-failed="t(`Conditions d'accès non précisées`)"
64
+ class="pb-0"
65
+ />
66
+ </ul>
67
+ </template>
68
+
69
+ <script setup lang="ts">
70
+ import type { DataserviceQuality } from '../types/dataservices'
71
+ import { useTranslation } from '../composables/useTranslation'
72
+ import QualityItem from './QualityItem.vue'
73
+
74
+ defineProps<{
75
+ quality: DataserviceQuality
76
+ }>()
77
+
78
+ const { t } = useTranslation()
79
+ </script>
@@ -36,6 +36,7 @@
36
36
  :icon="RiDatabase2Line"
37
37
  :url="datasetUrl || dataset.page"
38
38
  :target="datasetUrlInNewTab ? '_blank' : undefined"
39
+ :title-tag="titleTag"
39
40
  >
40
41
  {{ dataset.title }}
41
42
  <template
@@ -106,10 +107,12 @@
106
107
  </p>
107
108
  </div>
108
109
  </div>
109
- <ObjectCardShortDescription
110
- v-if="showDescriptionShort"
111
- :text="getDescriptionShort(props.dataset)"
112
- />
110
+ <slot>
111
+ <ObjectCardShortDescription
112
+ v-if="showDescriptionShort"
113
+ :text="getDescriptionShort(props.dataset)"
114
+ />
115
+ </slot>
113
116
  </ObjectCard>
114
117
  </template>
115
118
 
@@ -117,6 +120,7 @@
117
120
  import type { RouteLocationRaw } from 'vue-router'
118
121
  import { RiArchiveLine, RiDatabase2Line, RiDownloadLine, RiEyeLine, RiLineChartLine, RiLockLine, RiStarLine, RiSubtractLine } from '@remixicon/vue'
119
122
  import type { Dataset, DatasetV2 } from '../types/datasets'
123
+ import type { TitleTag } from '../types/ui'
120
124
  import { summarize } from '../functions/helpers'
121
125
  import { useFormatDate } from '../functions/dates'
122
126
  import { getDescriptionShort } from '../functions/description'
@@ -137,6 +141,7 @@ type Props = {
137
141
  datasetUrlInNewTab?: boolean
138
142
  organizationUrl?: RouteLocationRaw
139
143
  showDescriptionShort?: boolean
144
+ titleTag?: TitleTag
140
145
  }
141
146
 
142
147
  const props = withDefaults(defineProps<Props>(), {
@@ -13,7 +13,7 @@
13
13
  {{ t('Qualité des métadonnées:') }}
14
14
  </span>
15
15
  </span>
16
- <DatasetQualityScore
16
+ <QualityScore
17
17
  :score="quality.score"
18
18
  class="w-full"
19
19
  />
@@ -23,35 +23,35 @@
23
23
  </Toggletip>
24
24
  <template v-if="!hideWarnings">
25
25
  <ul class="list-none pl-0">
26
- <DatasetQualityItemWarning
26
+ <QualityItemWarning
27
27
  :quality-item="quality.dataset_description_quality"
28
28
  :message="t('Description des données non renseignée')"
29
29
  />
30
- <DatasetQualityItemWarning
30
+ <QualityItemWarning
31
31
  :quality-item="quality.resources_documentation"
32
32
  :message="t('Documentation des fichiers manquante')"
33
33
  />
34
- <DatasetQualityItemWarning
34
+ <QualityItemWarning
35
35
  :quality-item="quality.license"
36
36
  :message="t('Licence non renseignée')"
37
37
  />
38
- <DatasetQualityItemWarning
38
+ <QualityItemWarning
39
39
  :quality-item="quality.update_frequency && quality.update_fulfilled_in_time"
40
40
  :message="quality.update_frequency ? t('Fréquence de mise à jour non respectée') : t('Fréquence de mise à jour non renseignée')"
41
41
  />
42
- <DatasetQualityItemWarning
42
+ <QualityItemWarning
43
43
  :quality-item="quality.has_open_format"
44
44
  :message="t('Formats de fichiers non standards')"
45
45
  />
46
- <DatasetQualityItemWarning
46
+ <QualityItemWarning
47
47
  :quality-item="quality.temporal_coverage"
48
48
  :message="t('Couverture temporelle non renseignée')"
49
49
  />
50
- <DatasetQualityItemWarning
50
+ <QualityItemWarning
51
51
  :quality-item="quality.spatial"
52
52
  :message="t('Couverture spatiale non renseignée')"
53
53
  />
54
- <DatasetQualityItemWarning
54
+ <QualityItemWarning
55
55
  :quality-item="quality.all_resources_available"
56
56
  :message="t('Certains fichiers ne sont pas disponibles')"
57
57
  />
@@ -62,8 +62,8 @@
62
62
  <script setup lang="ts">
63
63
  import { RiInformationLine } from '@remixicon/vue'
64
64
  import type { Quality } from '../types/datasets'
65
- import DatasetQualityItemWarning from './DatasetQualityItemWarning.vue'
66
- import DatasetQualityScore from './DatasetQualityScore.vue'
65
+ import QualityItemWarning from './QualityItemWarning.vue'
66
+ import QualityScore from './QualityScore.vue'
67
67
  import Toggletip from './Toggletip.vue'
68
68
  import DatasetQualityTooltipContent from './DatasetQualityTooltipContent.vue'
69
69
  import { useTranslation } from '../composables/useTranslation'
@@ -7,7 +7,7 @@
7
7
  >
8
8
  <RiInformationLine class="size-3.5 shrink-0" />
9
9
  <span class="text-gray-medium text-sm group-hover/quality:underline">{{ t('Métadonnées :') }}</span>
10
- <DatasetQualityScore :score="quality.score" />
10
+ <QualityScore :score="quality.score" />
11
11
  <template #toggletip>
12
12
  <DatasetQualityTooltipContent :quality />
13
13
  </template>
@@ -18,7 +18,7 @@
18
18
  <script setup lang="ts">
19
19
  import { RiInformationLine } from '@remixicon/vue'
20
20
  import type { Quality } from '../types/datasets'
21
- import DatasetQualityScore from './DatasetQualityScore.vue'
21
+ import QualityScore from './QualityScore.vue'
22
22
  import DatasetQualityTooltipContent from './DatasetQualityTooltipContent.vue'
23
23
  import Toggletip from './Toggletip.vue'
24
24
  import { useTranslation } from '../composables/useTranslation'
@@ -68,7 +68,7 @@
68
68
  import type { Quality } from '../types/datasets'
69
69
  import { useComponentsConfig } from '../config'
70
70
  import { useTranslation } from '../composables/useTranslation'
71
- import DatasetQualityItem from './DatasetQualityItem.vue'
71
+ import DatasetQualityItem from './QualityItem.vue'
72
72
 
73
73
  defineProps<{
74
74
  quality: Quality
@@ -0,0 +1,101 @@
1
+ <template>
2
+ <Listbox v-model="model">
3
+ <div class="relative min-w-0">
4
+ <div
5
+ ref="floatingReference"
6
+ class="relative w-full cursor-default overflow-hidden bg-white text-left shadow-md focus:outline-none focus-visible:ring-2 focus-visible:ring-white/75 focus-visible:ring-offset-2 focus-visible:ring-offset-teal-300 sm:text-sm"
7
+ >
8
+ <ListboxButton class="input shadow-input text-sm flex items-center gap-2">
9
+ <slot name="button">
10
+ <div class="w-full flex items-center justify-between gap-2">
11
+ <div
12
+ class="truncate"
13
+ :class="{ 'text-new-disabled-text': isDisabled(model) }"
14
+ >
15
+ {{ displayValue(model) }}
16
+ </div>
17
+ <RiArrowDownSLine class="flex-none size-4 justify-self-end" />
18
+ </div>
19
+ </slot>
20
+ </ListboxButton>
21
+ </div>
22
+
23
+ <ListboxOptions
24
+ ref="popover"
25
+ :style="floatingStyles"
26
+ class="z-10 mt-1 absolute max-h-60 min-w-80 w-full overflow-auto rounded-md bg-white text-base shadow-lg ring-1 ring-black/5 focus:outline-none sm:text-sm pl-0"
27
+ >
28
+ <ListboxOption
29
+ v-for="option in options"
30
+ :key="getOptionId(toValue(option))"
31
+ v-slot="{ active, selected }"
32
+ as="template"
33
+ :value="option"
34
+ >
35
+ <li
36
+ class="relative cursor-default select-none py-2 pr-4 list-none flex items-center gap-2 text-gray-900"
37
+ :class="{
38
+ 'bg-gray-lower': active && !isDisabled(toValue(option)),
39
+ 'text-new-disabled-text': isDisabled(toValue(option)),
40
+ 'pl-2': selected,
41
+ 'pl-6': !selected,
42
+ }"
43
+ >
44
+ <div class="flex items-center justify-center aspect-square">
45
+ <RiCheckLine
46
+ v-if="selected"
47
+ class="size-4"
48
+ :class="isDisabled(toValue(option)) ?' text-new-disabled-text' : 'text-new-primary'"
49
+ />
50
+ </div>
51
+ <slot
52
+ name="option"
53
+ v-bind="{ option, active }"
54
+ >
55
+ {{ displayValue(option) }}
56
+ </slot>
57
+ </li>
58
+ </ListboxOption>
59
+ </ListboxOptions>
60
+ </div>
61
+ </Listbox>
62
+ </template>
63
+
64
+ <script setup lang="ts" generic="T extends string | number | object">
65
+ import { Listbox, ListboxButton, ListboxOption, ListboxOptions } from '@headlessui/vue'
66
+ import { useFloating, autoUpdate, autoPlacement } from '@floating-ui/vue'
67
+ import { toValue, useTemplateRef } from 'vue'
68
+ import { RiArrowDownSLine, RiCheckLine } from '@remixicon/vue'
69
+
70
+ withDefaults(defineProps<{
71
+ options?: Array<T>
72
+ getOptionId?: (option: T) => string | number
73
+ displayValue: (option: T | null) => string
74
+ isDisabled?: (option: T | null) => boolean
75
+ }>(), {
76
+ getOptionId: (option: T): string | number => {
77
+ if (typeof option === 'string') return option
78
+ if (typeof option === 'number') return option
79
+ if (typeof option === 'object' && 'id' in option) return option.id as string
80
+
81
+ throw new Error('Please set getOptionId()')
82
+ },
83
+ isDisabled: (option: T | null): boolean => {
84
+ if (option && typeof option === 'object' && 'disabled' in option) return option.disabled as boolean
85
+
86
+ return false
87
+ },
88
+ })
89
+
90
+ const model = defineModel<T | null>({ required: true })
91
+
92
+ const referenceRef = useTemplateRef('floatingReference')
93
+ const floatingRef = useTemplateRef<InstanceType<typeof ListboxOptions>>('popover')
94
+ const { floatingStyles } = useFloating(referenceRef, floatingRef, {
95
+ middleware: [autoPlacement({
96
+ allowedPlacements: ['bottom-start', 'bottom', 'bottom-end'],
97
+ crossAxis: true,
98
+ })],
99
+ whileElementsMounted: autoUpdate,
100
+ })
101
+ </script>