@datagouv/components-next 1.0.2-dev.140 → 1.0.2-dev.142
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/{Datafair.client-DXPU1V24.js → Datafair.client-CUFx7zqu.js} +1 -1
- package/dist/{JsonPreview.client-D1SnGfWG.js → JsonPreview.client-DZybGNCG.js} +2 -2
- package/dist/{MapContainer.client-DlsaEVGx.js → MapContainer.client-BAjTALQR.js} +2 -2
- package/dist/{PdfPreview.client-C9OrLR0z.js → PdfPreview.client-Cm6eOYo7.js} +2 -2
- package/dist/{Pmtiles.client-CyylWfTy.js → Pmtiles.client-DJ16FVkY.js} +1 -1
- package/dist/{PreviewWrapper.vue_vue_type_script_setup_true_lang-CtXZOHXI.js → PreviewWrapper.vue_vue_type_script_setup_true_lang-CDp0lyiF.js} +1 -1
- package/dist/{XmlPreview.client-DoX7RurH.js → XmlPreview.client-OfSTJWDJ.js} +3 -3
- package/dist/components-next.js +1 -1
- package/dist/{index-Br1sa7wQ.js → index-C_GWB10O.js} +4602 -4516
- package/dist/{leaflet-src-DWG7tmpQ.js → leaflet-src-Bar__oCQ.js} +1 -1
- package/dist/{main-BU6kP4dE.js → main-BpmTmbJK.js} +7644 -7639
- package/dist/{vue3-xml-viewer.common-Cpui-Yi9.js → vue3-xml-viewer.common-DFRPttwN.js} +1 -1
- package/package.json +1 -1
- package/src/components/TabularExplorer/TabularExplorer.vue +31 -5
- package/src/functions/resources.ts +15 -0
package/package.json
CHANGED
|
@@ -597,6 +597,7 @@
|
|
|
597
597
|
<script setup lang="ts">
|
|
598
598
|
import { computed, nextTick, onUnmounted, ref, watch, useTemplateRef } from 'vue'
|
|
599
599
|
import { ofetch } from 'ofetch'
|
|
600
|
+
import { useElementSize } from '@vueuse/core'
|
|
600
601
|
import { flip, shift, autoUpdate, useFloating } from '@floating-ui/vue'
|
|
601
602
|
import { Dialog, DialogPanel, DialogTitle, Popover, PopoverButton, PopoverPanel, TransitionChild, TransitionRoot } from '@headlessui/vue'
|
|
602
603
|
import {
|
|
@@ -832,18 +833,43 @@ function redistributeColumnWidths() {
|
|
|
832
833
|
columnWidths.value = widths
|
|
833
834
|
}
|
|
834
835
|
|
|
835
|
-
// Measure
|
|
836
|
-
//
|
|
836
|
+
// Measure the natural widths once (the <th> must still be auto-sized) and
|
|
837
|
+
// distribute them. No-op once measured or while no column is displayed.
|
|
838
|
+
function ensureMeasured() {
|
|
839
|
+
if (Object.keys(naturalWidths.value).length > 0) return
|
|
840
|
+
if (displayedColumns.value.length === 0) return
|
|
841
|
+
measureNaturalWidths()
|
|
842
|
+
redistributeColumnWidths()
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
// Drive measurement and re-stretch off the container's reactive width
|
|
846
|
+
// (`useElementSize` wraps a ResizeObserver and disconnects it on unmount). The
|
|
847
|
+
// width goes 0 -> N once the table is laid out in the DOM, which is also when
|
|
848
|
+
// the <thead> carries its content-driven natural widths: the first non-zero
|
|
849
|
+
// width measures the stable base, later changes (window resize) only
|
|
850
|
+
// redistribute it.
|
|
851
|
+
const { width: containerWidth } = useElementSize(scrollContainerRef)
|
|
852
|
+
|
|
853
|
+
watch(containerWidth, (width) => {
|
|
854
|
+
if (width === 0) return
|
|
855
|
+
if (Object.keys(naturalWidths.value).length === 0) {
|
|
856
|
+
ensureMeasured()
|
|
857
|
+
}
|
|
858
|
+
else {
|
|
859
|
+
redistributeColumnWidths()
|
|
860
|
+
}
|
|
861
|
+
})
|
|
862
|
+
|
|
863
|
+
// Fallback: re-run once columns appear if they weren't available when the
|
|
864
|
+
// container was first sized (standalone usage where the profile resolves late).
|
|
837
865
|
watch(
|
|
838
866
|
() => [tableData.value !== null, displayedColumns.value.length] as const,
|
|
839
867
|
async ([dataReady, colCount]) => {
|
|
840
868
|
if (!dataReady || colCount === 0) return
|
|
841
869
|
if (Object.keys(naturalWidths.value).length > 0) return
|
|
842
870
|
await nextTick()
|
|
843
|
-
|
|
844
|
-
redistributeColumnWidths()
|
|
871
|
+
ensureMeasured()
|
|
845
872
|
},
|
|
846
|
-
{ immediate: true },
|
|
847
873
|
)
|
|
848
874
|
|
|
849
875
|
// Re-stretch the remaining columns whenever the displayed set changes (columns
|
|
@@ -105,14 +105,29 @@ export const getResourceLabel = (type: ResourceType, count?: number) => {
|
|
|
105
105
|
}
|
|
106
106
|
return t('Fichiers principaux')
|
|
107
107
|
case 'documentation':
|
|
108
|
+
if (typeof count === 'number') {
|
|
109
|
+
return t('Aucun fichier de documentation | 1 fichier de documentation | {n} fichiers de documentation', count)
|
|
110
|
+
}
|
|
108
111
|
return t('Documentation')
|
|
109
112
|
case 'update':
|
|
113
|
+
if (typeof count === 'number') {
|
|
114
|
+
return t('Aucune mise à jour | 1 mise à jour | {n} mises à jour', count)
|
|
115
|
+
}
|
|
110
116
|
return t('Mise à jour')
|
|
111
117
|
case 'api':
|
|
118
|
+
if (typeof count === 'number') {
|
|
119
|
+
return t('Aucune API | 1 API | {n} API', count)
|
|
120
|
+
}
|
|
112
121
|
return t('API')
|
|
113
122
|
case 'code':
|
|
123
|
+
if (typeof count === 'number') {
|
|
124
|
+
return t('Aucun fichier de code source | 1 fichier de code source | {n} fichiers de code source', count)
|
|
125
|
+
}
|
|
114
126
|
return t('Code source')
|
|
115
127
|
case 'other':
|
|
128
|
+
if (typeof count === 'number') {
|
|
129
|
+
return t('Aucun autre fichier | 1 autre fichier | {n} autres fichiers', count)
|
|
130
|
+
}
|
|
116
131
|
return t('Autre')
|
|
117
132
|
}
|
|
118
133
|
}
|