@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.
Files changed (26) hide show
  1. package/dist/{Datafair.client-B1CFLBVW.js → Datafair.client-CFl7MKdB.js} +1 -1
  2. package/dist/{JsonPreview.client-DMal7Zvi.js → JsonPreview.client-CowJU7XP.js} +2 -2
  3. package/dist/{MapContainer.client-D4TU557F.js → MapContainer.client-CgdBWq2S.js} +2 -2
  4. package/dist/{PdfPreview.client-BPKxdMlu.js → PdfPreview.client-Dm4l4fyb.js} +2 -2
  5. package/dist/{Pmtiles.client-DW9JBIOy.js → Pmtiles.client-DsjzH41p.js} +1 -1
  6. 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
  7. package/dist/{XmlPreview.client-DfIA3_I8.js → XmlPreview.client-DBceFnA1.js} +3 -3
  8. package/dist/components-next.js +158 -153
  9. package/dist/components.css +1 -1
  10. package/dist/{index-CtZYQyKo.js → index-DWmJJEjk.js} +1 -1
  11. package/dist/{leaflet-src-DcM2vBl8.js → leaflet-src-CGmV0V-K.js} +1 -1
  12. package/dist/{main-BOGKXwyT.js → main-CQREzlRN.js} +12210 -12030
  13. package/dist/{vue3-xml-viewer.common-DuOzEGKy.js → vue3-xml-viewer.common-d08lX8ER.js} +1 -1
  14. package/package.json +1 -1
  15. package/src/components/Chart/ChartViewer.vue +10 -9
  16. package/src/components/Chart/ChartViewerWrapper.vue +20 -16
  17. package/src/components/TabularExplorer/TabularCellPopover.vue +2 -2
  18. package/src/components/TabularExplorer/TabularExplorer.vue +215 -82
  19. package/src/components/TabularExplorer/TabularFilterContent.vue +15 -13
  20. package/src/components/TabularExplorer/TabularFilterPopover.vue +21 -26
  21. package/src/components/TabularExplorer/types.ts +14 -11
  22. package/src/functions/charts.ts +12 -1
  23. package/src/functions/tabular.ts +112 -1
  24. package/src/functions/tabularApi.ts +1 -43
  25. package/src/main.ts +6 -1
  26. package/src/types/visualizations.ts +4 -0
@@ -1,4 +1,4 @@
1
- import { b5 as Ke } from "./main-BOGKXwyT.js";
1
+ import { b8 as Ke } from "./main-CQREzlRN.js";
2
2
  import We from "vue";
3
3
  function Fe(I, K) {
4
4
  for (var V = 0; V < K.length; V++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datagouv/components-next",
3
- "version": "1.0.2-dev.127",
3
+ "version": "1.0.2-dev.129",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "engines": {
@@ -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 (xAxis.type ?? 'discrete') === 'continuous' ? 'value' : 'category'
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
- if (!xColumn || !yColumn || !resourceId || !s.type || !props.series.data[resourceId] || !props.series.columns[resourceId]) {
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] : props.series.columns[resourceId],
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] : props.series.columns[resourceId],
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
- title: {
141
- text: props.chart.title,
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: seriesData.series.length > 1,
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: Record<string, Array<string>>
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.profile.header,
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(() => props.chart.series, async () => {
156
+ watch(resourceIds, async () => {
152
157
  await fetchSeriesProfile()
153
- }, { immediate: true, deep: true })
158
+ }, { immediate: true })
154
159
 
155
- watch([() => props.chart.series, () => props.chart.x_axis.column_x], async () => {
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
- <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'