@datagouv/components-next 1.0.2-dev.127 → 1.0.2-dev.129
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-B1CFLBVW.js → Datafair.client-CFl7MKdB.js} +1 -1
- package/dist/{JsonPreview.client-DMal7Zvi.js → JsonPreview.client-CowJU7XP.js} +2 -2
- package/dist/{MapContainer.client-D4TU557F.js → MapContainer.client-CgdBWq2S.js} +2 -2
- package/dist/{PdfPreview.client-BPKxdMlu.js → PdfPreview.client-Dm4l4fyb.js} +2 -2
- package/dist/{Pmtiles.client-DW9JBIOy.js → Pmtiles.client-DsjzH41p.js} +1 -1
- package/dist/{PreviewWrapper.vue_vue_type_script_setup_true_lang-B54_WCDL.js → PreviewWrapper.vue_vue_type_script_setup_true_lang-BgFVrfFi.js} +1 -1
- package/dist/{XmlPreview.client-DfIA3_I8.js → XmlPreview.client-DBceFnA1.js} +3 -3
- package/dist/components-next.js +158 -153
- package/dist/components.css +1 -1
- package/dist/{index-CtZYQyKo.js → index-DWmJJEjk.js} +1 -1
- package/dist/{leaflet-src-DcM2vBl8.js → leaflet-src-CGmV0V-K.js} +1 -1
- package/dist/{main-BOGKXwyT.js → main-CQREzlRN.js} +12210 -12030
- package/dist/{vue3-xml-viewer.common-DuOzEGKy.js → vue3-xml-viewer.common-d08lX8ER.js} +1 -1
- package/package.json +1 -1
- package/src/components/Chart/ChartViewer.vue +10 -9
- package/src/components/Chart/ChartViewerWrapper.vue +20 -16
- package/src/components/TabularExplorer/TabularCellPopover.vue +2 -2
- package/src/components/TabularExplorer/TabularExplorer.vue +215 -82
- package/src/components/TabularExplorer/TabularFilterContent.vue +15 -13
- package/src/components/TabularExplorer/TabularFilterPopover.vue +21 -26
- package/src/components/TabularExplorer/types.ts +14 -11
- package/src/functions/charts.ts +12 -1
- package/src/functions/tabular.ts +112 -1
- package/src/functions/tabularApi.ts +1 -43
- package/src/main.ts +6 -1
- package/src/types/visualizations.ts +4 -0
package/package.json
CHANGED
|
@@ -22,7 +22,7 @@ const props = defineProps<{
|
|
|
22
22
|
chart: Chart | ChartForApi
|
|
23
23
|
series: {
|
|
24
24
|
data: Record<string, Array<Record<string, unknown>>>
|
|
25
|
-
columns: Record<string, Array<string>>
|
|
25
|
+
columns: Record<string, Array<{ name: string, type: string }>>
|
|
26
26
|
}
|
|
27
27
|
}>()
|
|
28
28
|
|
|
@@ -32,7 +32,7 @@ let echartsInstance: EChartsType | null = null
|
|
|
32
32
|
|
|
33
33
|
function mapXAxisType(xAxis: XAxis | XAxisForm): 'category' | 'value' {
|
|
34
34
|
if (!xAxis) return 'category'
|
|
35
|
-
return
|
|
35
|
+
return xAxis.type === 'continuous' ? 'value' : 'category'
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
function buildYAxisFormatter(yAxis: YAxis): ((value: number) => string) | undefined {
|
|
@@ -53,7 +53,8 @@ const echartsOption = computed(() => {
|
|
|
53
53
|
const yColumn = s.aggregate_y ? `${s.column_y}__${s.aggregate_y}` : s.column_y
|
|
54
54
|
const resourceId = s.resource_id
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
const resourceColumns = props.series.columns[resourceId]
|
|
57
|
+
if (!xColumn || !yColumn || !resourceId || !s.type || !props.series.data[resourceId] || !resourceColumns) {
|
|
57
58
|
return null
|
|
58
59
|
}
|
|
59
60
|
|
|
@@ -110,7 +111,7 @@ const echartsOption = computed(() => {
|
|
|
110
111
|
return {
|
|
111
112
|
series: {
|
|
112
113
|
type: s.type === 'histogram' ? 'bar' : 'line',
|
|
113
|
-
dimensions: s.aggregate_y ? [xColumn, yColumn] :
|
|
114
|
+
dimensions: s.aggregate_y ? [xColumn, yColumn] : resourceColumns.map(c => c.name),
|
|
114
115
|
name: yColumn,
|
|
115
116
|
encode: {
|
|
116
117
|
x: xColumn,
|
|
@@ -119,7 +120,7 @@ const echartsOption = computed(() => {
|
|
|
119
120
|
} as LineSeriesOption | BarSeriesOption,
|
|
120
121
|
data: {
|
|
121
122
|
source: sortedData,
|
|
122
|
-
dimensions: s.aggregate_y ? [xColumn, yColumn] :
|
|
123
|
+
dimensions: s.aggregate_y ? [xColumn, yColumn] : resourceColumns.map(c => c.name),
|
|
123
124
|
},
|
|
124
125
|
}
|
|
125
126
|
})
|
|
@@ -137,10 +138,10 @@ const echartsOption = computed(() => {
|
|
|
137
138
|
|
|
138
139
|
return {
|
|
139
140
|
dataset: [...seriesData.data],
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
left: 'center',
|
|
141
|
+
textStyle: {
|
|
142
|
+
fontFamily: 'Marianne, arial, sans-serif',
|
|
143
143
|
},
|
|
144
|
+
color: '#000091',
|
|
144
145
|
tooltip: {
|
|
145
146
|
trigger: 'axis' as const,
|
|
146
147
|
formatter: (params: Array<{ value: Record<string, unknown>, axisValueLabel: string, seriesName: string }>) => {
|
|
@@ -154,7 +155,7 @@ const echartsOption = computed(() => {
|
|
|
154
155
|
},
|
|
155
156
|
},
|
|
156
157
|
legend: {
|
|
157
|
-
show:
|
|
158
|
+
show: false,
|
|
158
159
|
bottom: 0,
|
|
159
160
|
},
|
|
160
161
|
grid: {
|
|
@@ -18,22 +18,20 @@
|
|
|
18
18
|
</template>
|
|
19
19
|
|
|
20
20
|
<script setup lang="ts">
|
|
21
|
-
import { reactive, ref, watch } from 'vue'
|
|
21
|
+
import { computed, reactive, ref, watch } from 'vue'
|
|
22
22
|
import ChartViewer from './ChartViewer.vue'
|
|
23
23
|
import LoadingBlock from '../../components/LoadingBlock.vue'
|
|
24
24
|
import { useComponentsConfig } from '../../config'
|
|
25
25
|
import { fetchTabularData, useGetProfile } from '../../functions/tabularApi'
|
|
26
|
-
import type { Chart, ChartForApi } from '../../types/visualizations'
|
|
26
|
+
import type { Chart, ChartForApi, ColumnsDefinition } from '../../types/visualizations'
|
|
27
27
|
import { useTranslation } from '../../composables/useTranslation'
|
|
28
|
+
import { watchDebounced } from '@vueuse/shared'
|
|
29
|
+
import { buildColumnsFromProfile } from '../../functions/charts'
|
|
28
30
|
|
|
29
31
|
const props = defineProps<{
|
|
30
32
|
chart: Chart | ChartForApi
|
|
31
33
|
}>()
|
|
32
34
|
|
|
33
|
-
const emit = defineEmits<{
|
|
34
|
-
columns: [columns: Record<string, Array<string>>]
|
|
35
|
-
}>()
|
|
36
|
-
|
|
37
35
|
const { t } = useTranslation()
|
|
38
36
|
const config = useComponentsConfig()
|
|
39
37
|
const getProfile = useGetProfile()
|
|
@@ -45,12 +43,18 @@ const pendingOperations = ref(0)
|
|
|
45
43
|
|
|
46
44
|
const series = reactive<{
|
|
47
45
|
data: Record<string, Array<Record<string, unknown>>>
|
|
48
|
-
columns:
|
|
46
|
+
columns: ColumnsDefinition
|
|
49
47
|
}>({
|
|
50
48
|
data: {},
|
|
51
49
|
columns: {},
|
|
52
50
|
})
|
|
53
51
|
|
|
52
|
+
const resourceIds = computed(() => {
|
|
53
|
+
return props.chart.series
|
|
54
|
+
.filter(s => s.resource_id)
|
|
55
|
+
.map(s => s.resource_id)
|
|
56
|
+
})
|
|
57
|
+
|
|
54
58
|
async function fetchSeriesProfile() {
|
|
55
59
|
pendingOperations.value++
|
|
56
60
|
status.value = 'pending'
|
|
@@ -78,7 +82,7 @@ async function fetchSeriesProfile() {
|
|
|
78
82
|
.map(r => r.value)
|
|
79
83
|
series.columns = Object.fromEntries(results.map(result => [
|
|
80
84
|
result.id,
|
|
81
|
-
result.profile
|
|
85
|
+
buildColumnsFromProfile(result.profile),
|
|
82
86
|
]))
|
|
83
87
|
}
|
|
84
88
|
catch (err) {
|
|
@@ -86,6 +90,7 @@ async function fetchSeriesProfile() {
|
|
|
86
90
|
status.value = 'error'
|
|
87
91
|
console.error(err)
|
|
88
92
|
series.columns = {}
|
|
93
|
+
series.data = {}
|
|
89
94
|
}
|
|
90
95
|
finally {
|
|
91
96
|
pendingOperations.value--
|
|
@@ -148,17 +153,16 @@ async function fetchSeriesData() {
|
|
|
148
153
|
}
|
|
149
154
|
}
|
|
150
155
|
|
|
151
|
-
watch(
|
|
156
|
+
watch(resourceIds, async () => {
|
|
152
157
|
await fetchSeriesProfile()
|
|
153
|
-
}, { immediate: true
|
|
158
|
+
}, { immediate: true })
|
|
154
159
|
|
|
155
|
-
|
|
160
|
+
watchDebounced([
|
|
161
|
+
() => props.chart.series,
|
|
162
|
+
() => props.chart.x_axis.column_x,
|
|
163
|
+
], async () => {
|
|
156
164
|
await fetchSeriesData()
|
|
157
|
-
}, { immediate: true, deep: true })
|
|
158
|
-
|
|
159
|
-
watch(() => series.columns, () => {
|
|
160
|
-
emit('columns', series.columns)
|
|
161
|
-
})
|
|
165
|
+
}, { debounce: config.searchDebounce ?? 300, immediate: true, deep: true })
|
|
162
166
|
|
|
163
167
|
watch(pendingOperations, (count) => {
|
|
164
168
|
if (count === 0) {
|
|
@@ -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
|
-
<
|
|
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
|
-
|
|
74
|
+
RiFilterLine,
|
|
75
75
|
RiFileCopyLine,
|
|
76
76
|
RiCheckLine,
|
|
77
77
|
} from '@remixicon/vue'
|