@datagouv/components-next 1.0.2-dev.107 → 1.0.2-dev.108
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-Ctao4Iiu.js → Datafair.client-rf4T1IkA.js} +1 -1
- package/dist/{JsonPreview.client-0l5_Fh_V.js → JsonPreview.client-dzar6iuh.js} +2 -2
- package/dist/{MapContainer.client-DWejyPHW.js → MapContainer.client-D-MoRNhG.js} +2 -2
- package/dist/{PdfPreview.client-DOIyEjFr.js → PdfPreview.client-DoDYLmJD.js} +2 -2
- package/dist/{Pmtiles.client-DDEjyjo6.js → Pmtiles.client-Dzm01Zfm.js} +1 -1
- package/dist/{PreviewWrapper.vue_vue_type_script_setup_true_lang-DZTNohgY.js → PreviewWrapper.vue_vue_type_script_setup_true_lang-BRNYswg3.js} +1 -1
- package/dist/{XmlPreview.client-C-Q4ybiL.js → XmlPreview.client-cOhwff6P.js} +3 -3
- package/dist/components-next.js +173 -176
- package/dist/{index-Cd4yx9jU.js → index-NofRBuyf.js} +1 -1
- package/dist/{main-CHzPTZLX.js → main-Iz1ZCL6k.js} +31302 -79106
- package/dist/{vue3-xml-viewer.common-BC-WWluw.js → vue3-xml-viewer.common-tVI9uXUz.js} +1 -1
- package/package.json +10 -3
- package/src/chart.ts +5 -0
- package/src/components/Search/GlobalSearch.vue +10 -3
- package/src/composables/useStableQueryParams.ts +7 -3
- package/src/main.ts +0 -6
- package/src/types/search.ts +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datagouv/components-next",
|
|
3
|
-
"version": "1.0.2-dev.
|
|
3
|
+
"version": "1.0.2-dev.108",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -10,6 +10,12 @@
|
|
|
10
10
|
"yarn": "use-pnpm-instead"
|
|
11
11
|
},
|
|
12
12
|
"main": "./src/main.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": "./src/main.ts",
|
|
15
|
+
"./chart": "./src/chart.ts",
|
|
16
|
+
"./assets/*": "./assets/*",
|
|
17
|
+
"./dist/*": "./dist/*"
|
|
18
|
+
},
|
|
13
19
|
"sideEffects": false,
|
|
14
20
|
"files": [
|
|
15
21
|
"assets",
|
|
@@ -26,7 +32,6 @@
|
|
|
26
32
|
"@vueuse/router": "^14.2.1",
|
|
27
33
|
"chart.js": "^4.4.8",
|
|
28
34
|
"dompurify": "^3.2.5",
|
|
29
|
-
"echarts": "^6.0.0",
|
|
30
35
|
"geopf-extensions-openlayers": "^1.0.0-beta.10",
|
|
31
36
|
"leaflet": "^1.9.4",
|
|
32
37
|
"maplibre-gl": "^5.6.2",
|
|
@@ -67,6 +72,7 @@
|
|
|
67
72
|
"@vue/eslint-config-prettier": "^10.2.0",
|
|
68
73
|
"@vue/eslint-config-typescript": "^14.3.0",
|
|
69
74
|
"@vue/tsconfig": "^0.8.0",
|
|
75
|
+
"echarts": "^6.0.0",
|
|
70
76
|
"eslint": "^9.18.0",
|
|
71
77
|
"eslint-plugin-vue": "^10.0",
|
|
72
78
|
"jiti": "^2.4.2",
|
|
@@ -83,7 +89,8 @@
|
|
|
83
89
|
},
|
|
84
90
|
"peerDependencies": {
|
|
85
91
|
"vue": "^3.5.13",
|
|
86
|
-
"vue-router": "^4.5.0 || ^5.0.0"
|
|
92
|
+
"vue-router": "^4.5.0 || ^5.0.0",
|
|
93
|
+
"echarts": "^6.0.0"
|
|
87
94
|
},
|
|
88
95
|
"scarfSettings": {
|
|
89
96
|
"enabled": false
|
package/src/chart.ts
ADDED
|
@@ -200,10 +200,13 @@
|
|
|
200
200
|
<div class="fr-col">
|
|
201
201
|
<select
|
|
202
202
|
id="sort-search"
|
|
203
|
-
v-model="
|
|
203
|
+
v-model="effectiveSort"
|
|
204
204
|
class="fr-select text-sm shadow-input-blue!"
|
|
205
205
|
>
|
|
206
|
-
<option
|
|
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) {
|
|
@@ -759,7 +766,7 @@ const rssUrl = computed(() => {
|
|
|
759
766
|
}, currentTypeConfig.value ? configKey(currentTypeConfig.value) : undefined)
|
|
760
767
|
|
|
761
768
|
// Add sort if set
|
|
762
|
-
if (
|
|
769
|
+
if (effectiveSort.value) params.set('sort', effectiveSort.value)
|
|
763
770
|
|
|
764
771
|
const queryString = params.toString()
|
|
765
772
|
const basePath = '/api/1/datasets/recent.atom'
|
|
@@ -72,10 +72,14 @@ export function useStableQueryParams(options: StableQueryParamsOptions) {
|
|
|
72
72
|
if (q.value) {
|
|
73
73
|
params.q = q.value
|
|
74
74
|
}
|
|
75
|
-
|
|
75
|
+
const sortToUse = sort.value ?? typeConfig?.defaultSort
|
|
76
|
+
if (sortToUse) {
|
|
76
77
|
const validSortValues = typeConfig?.sortOptions?.map(o => o.value as string) ?? []
|
|
77
|
-
if (validSortValues.includes(
|
|
78
|
-
params.sort =
|
|
78
|
+
if (validSortValues.includes(sortToUse)) {
|
|
79
|
+
params.sort = sortToUse
|
|
80
|
+
}
|
|
81
|
+
else if (import.meta.env.DEV && typeConfig?.defaultSort && typeConfig?.sortOptions && sortToUse === typeConfig.defaultSort) {
|
|
82
|
+
console.warn(`[GlobalSearch] defaultSort "${typeConfig.defaultSort}" is not in sortOptions for "${typeConfig.class}". Valid values: ${validSortValues.join(', ')}`)
|
|
79
83
|
}
|
|
80
84
|
}
|
|
81
85
|
params.page = page.value
|
package/src/main.ts
CHANGED
|
@@ -87,9 +87,6 @@ import ReuseHorizontalCard from './components/ReuseHorizontalCard.vue'
|
|
|
87
87
|
import ReuseDetails from './components/ReuseDetails.vue'
|
|
88
88
|
import SchemaCard from './components/SchemaCard.vue'
|
|
89
89
|
import SimpleBanner from './components/SimpleBanner.vue'
|
|
90
|
-
import SmallChart from './components/SmallChart.vue'
|
|
91
|
-
import ChartViewer from './components/Chart/ChartViewer.vue'
|
|
92
|
-
import ChartViewerWrapper from './components/Chart/ChartViewerWrapper.vue'
|
|
93
90
|
import StatBox from './components/StatBox.vue'
|
|
94
91
|
import Tab from './components/Tabs/Tab.vue'
|
|
95
92
|
import TabGroup from './components/Tabs/TabGroup.vue'
|
|
@@ -383,9 +380,6 @@ export {
|
|
|
383
380
|
ReuseHorizontalCard,
|
|
384
381
|
SchemaCard,
|
|
385
382
|
SimpleBanner,
|
|
386
|
-
SmallChart,
|
|
387
|
-
ChartViewer,
|
|
388
|
-
ChartViewerWrapper,
|
|
389
383
|
StatBox,
|
|
390
384
|
OpenApiViewer,
|
|
391
385
|
Tab,
|
package/src/types/search.ts
CHANGED
|
@@ -305,6 +305,7 @@ export type DatasetSearchConfig = {
|
|
|
305
305
|
basicFilters?: (keyof DatasetSearchFilters)[]
|
|
306
306
|
advancedFilters?: (keyof DatasetSearchFilters)[]
|
|
307
307
|
sortOptions?: SortOption<DatasetSearchSort>[]
|
|
308
|
+
defaultSort?: DatasetSearchSort
|
|
308
309
|
}
|
|
309
310
|
|
|
310
311
|
export type DataserviceSearchConfig = {
|
|
@@ -317,6 +318,7 @@ export type DataserviceSearchConfig = {
|
|
|
317
318
|
basicFilters?: (keyof DataserviceSearchFilters)[]
|
|
318
319
|
advancedFilters?: (keyof DataserviceSearchFilters)[]
|
|
319
320
|
sortOptions?: SortOption<DataserviceSearchSort>[]
|
|
321
|
+
defaultSort?: DataserviceSearchSort
|
|
320
322
|
}
|
|
321
323
|
|
|
322
324
|
export type ReuseSearchConfig = {
|
|
@@ -329,6 +331,7 @@ export type ReuseSearchConfig = {
|
|
|
329
331
|
basicFilters?: (keyof ReuseSearchFilters)[]
|
|
330
332
|
advancedFilters?: (keyof ReuseSearchFilters)[]
|
|
331
333
|
sortOptions?: SortOption<ReuseSearchSort>[]
|
|
334
|
+
defaultSort?: ReuseSearchSort
|
|
332
335
|
}
|
|
333
336
|
|
|
334
337
|
export type OrganizationSearchConfig = {
|
|
@@ -341,6 +344,7 @@ export type OrganizationSearchConfig = {
|
|
|
341
344
|
basicFilters?: (keyof OrganizationSearchFilters)[]
|
|
342
345
|
advancedFilters?: (keyof OrganizationSearchFilters)[]
|
|
343
346
|
sortOptions?: SortOption<OrganizationSearchSort>[]
|
|
347
|
+
defaultSort?: OrganizationSearchSort
|
|
344
348
|
}
|
|
345
349
|
|
|
346
350
|
export type TopicSearchConfig = {
|
|
@@ -353,6 +357,7 @@ export type TopicSearchConfig = {
|
|
|
353
357
|
basicFilters?: (keyof TopicSearchFilters)[]
|
|
354
358
|
advancedFilters?: (keyof TopicSearchFilters)[]
|
|
355
359
|
sortOptions?: SortOption<TopicSearchSort>[]
|
|
360
|
+
defaultSort?: TopicSearchSort
|
|
356
361
|
}
|
|
357
362
|
|
|
358
363
|
export type SearchTypeConfig = DatasetSearchConfig | DataserviceSearchConfig | ReuseSearchConfig | OrganizationSearchConfig | TopicSearchConfig
|