@datagouv/components-next 1.1.1 → 1.2.0
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/{Control-DuZJdKV_.js → Control-ZFh5ta_U.js} +1 -1
- package/dist/{Datafair.client-BzW-ctDf.js → Datafair.client-rf4T1IkA.js} +1 -1
- package/dist/{Event--kp8kMdJ.js → Event-DSQcW7OF.js} +24 -24
- package/dist/{Image-34hvypZI.js → Image-BijNEG0p.js} +6 -6
- package/dist/{JsonPreview.client-BfMSzR07.js → JsonPreview.client-dzar6iuh.js} +2 -2
- package/dist/{Map-BjUnLyj8.js → Map-BUtPf5GN.js} +756 -756
- package/dist/{MapContainer.client-CLs-im9i.js → MapContainer.client-D-MoRNhG.js} +37 -38
- package/dist/{OSM-s40W6sQ2.js → OSM-D4MTdBtk.js} +2 -2
- package/dist/{PdfPreview.client-C13PQCU_.js → PdfPreview.client-DoDYLmJD.js} +2 -2
- package/dist/{Pmtiles.client-CL7PXXDl.js → Pmtiles.client-Dzm01Zfm.js} +1 -1
- package/dist/{PreviewWrapper.vue_vue_type_script_setup_true_lang-C6XnsZ-7.js → PreviewWrapper.vue_vue_type_script_setup_true_lang-BRNYswg3.js} +1 -1
- package/dist/{ScaleLine-KW-nXqp3.js → ScaleLine-hJQIqcZm.js} +2 -2
- package/dist/{Tile-DbNFNPfU.js → Tile-Dcl7oIVu.js} +35 -35
- package/dist/{TileImage-BsXBxMtq.js → TileImage-BJeHipMX.js} +4 -4
- package/dist/{View-BR92hTWP.js → View-xp_P_OHw.js} +412 -401
- package/dist/{XmlPreview.client-KaENrbbG.js → XmlPreview.client-cOhwff6P.js} +3 -3
- package/dist/{common-PJfpC179.js → common-BjQlan3k.js} +36 -36
- package/dist/components-next.css +4 -4
- package/dist/components-next.js +160 -155
- package/dist/components.css +1 -1
- package/dist/{index-C7WVVGgD.js → index-NofRBuyf.js} +32886 -27183
- package/dist/{main-K-42Oe8-.js → main-Iz1ZCL6k.js} +41753 -89461
- package/dist/{proj-DsetBcW7.js → proj-CsNo9yH1.js} +532 -512
- package/dist/{tilecoord-Db24Px13.js → tilecoord-A0fLnBZr.js} +28 -28
- package/dist/{vue3-xml-viewer.common-sHPSE-jD.js → vue3-xml-viewer.common-tVI9uXUz.js} +1 -1
- package/package.json +11 -4
- package/src/chart.ts +5 -0
- package/src/components/ActivityList/ActivityList.vue +3 -0
- package/src/components/DataserviceCard.vue +3 -0
- package/src/components/DatasetCard.vue +9 -4
- package/src/components/ObjectCardHeader.vue +11 -4
- package/src/components/RadioInput.vue +7 -2
- package/src/components/ResourceAccordion/DataStructure.vue +11 -33
- package/src/components/ResourceAccordion/Downloads.vue +160 -0
- package/src/components/ResourceAccordion/MapContainer.client.vue +1 -3
- package/src/components/ResourceAccordion/ResourceAccordion.vue +5 -102
- package/src/components/ResourceExplorer/ResourceExplorer.vue +2 -55
- package/src/components/ResourceExplorer/ResourceExplorerViewer.vue +26 -135
- package/src/components/ResourceExplorer/ResourceSelector.vue +113 -0
- package/src/components/ReuseCard.vue +12 -4
- package/src/components/Search/GlobalSearch.vue +30 -7
- package/src/components/Search/SearchInput.vue +2 -1
- package/src/components/TabularExplorer/TabularExplorer.vue +257 -154
- package/src/composables/useHasTabularData.ts +7 -0
- package/src/composables/useMetrics.ts +1 -1
- package/src/composables/useStableQueryParams.ts +7 -3
- package/src/composables/useTabularProfile.ts +70 -0
- package/src/config.ts +17 -3
- package/src/functions/activities.ts +3 -3
- package/src/functions/api.ts +5 -34
- package/src/functions/metrics.ts +6 -4
- package/src/main.ts +39 -6
- package/src/types/search.ts +11 -0
- package/src/types/ui.ts +2 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { computed, inject, provide, toValue, type MaybeRefOrGetter, type Ref } from 'vue'
|
|
2
|
+
import { useComponentsConfig } from '../config'
|
|
3
|
+
import { useFetch } from '../functions/api'
|
|
4
|
+
import type { AsyncDataRequestStatus } from '../functions/api.types'
|
|
5
|
+
import type { TabularProfileResponse } from '../components/TabularExplorer/types'
|
|
6
|
+
|
|
7
|
+
const TABULAR_PROFILE_KEY = Symbol('tabular-profile')
|
|
8
|
+
|
|
9
|
+
export type TabularProfileState = {
|
|
10
|
+
resourceId: Readonly<Ref<string>>
|
|
11
|
+
data: Readonly<Ref<TabularProfileResponse | null>>
|
|
12
|
+
error: Readonly<Ref<unknown | null>>
|
|
13
|
+
status: Readonly<Ref<AsyncDataRequestStatus>>
|
|
14
|
+
refresh: () => Promise<void>
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// What is shared through provide/inject: the resourceId (to let descendants
|
|
18
|
+
// check they target the same resource) and the in-flight fetch promise. We
|
|
19
|
+
// share the promise rather than the resolved state because `provide()` must
|
|
20
|
+
// run synchronously during setup — see `provideTabularProfile`.
|
|
21
|
+
type TabularProfileShared = {
|
|
22
|
+
resourceId: Readonly<Ref<string>>
|
|
23
|
+
state: Promise<TabularProfileState>
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async function createProfileState(resourceId: MaybeRefOrGetter<string>): Promise<TabularProfileState> {
|
|
27
|
+
const config = useComponentsConfig()
|
|
28
|
+
const ridRef = computed(() => toValue(resourceId))
|
|
29
|
+
|
|
30
|
+
// Goes through the package's useFetch, which delegates to the host's
|
|
31
|
+
// customUseFetch (Nuxt useFetch in cdata) so the response is shared
|
|
32
|
+
// between SSR and CSR via the Nuxt payload — avoiding a double fetch.
|
|
33
|
+
const profileUrl = computed(() =>
|
|
34
|
+
ridRef.value ? `${config.tabularApiUrl}/api/resources/${ridRef.value}/profile/` : null,
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
const { data, error, status, refresh } = await useFetch<TabularProfileResponse>(profileUrl, { raw: true })
|
|
38
|
+
|
|
39
|
+
return { resourceId: ridRef, data, error, status, refresh }
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Parent: fetch the tabular profile once and share it with descendants
|
|
44
|
+
* (TabularExplorer, DataStructure...) via provide/inject.
|
|
45
|
+
*
|
|
46
|
+
* Not async on purpose: `provide()` only works while the active component
|
|
47
|
+
* instance is set, which is lost after the first `await`. So we kick off the
|
|
48
|
+
* fetch, `provide()` the resulting promise synchronously, then return it for
|
|
49
|
+
* the caller to await.
|
|
50
|
+
*/
|
|
51
|
+
export function provideTabularProfile(resourceId: MaybeRefOrGetter<string>): Promise<TabularProfileState> {
|
|
52
|
+
const ridRef = computed(() => toValue(resourceId))
|
|
53
|
+
const state = createProfileState(resourceId)
|
|
54
|
+
provide<TabularProfileShared>(TABULAR_PROFILE_KEY, { resourceId: ridRef, state })
|
|
55
|
+
return state
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Child: get the tabular profile from an ancestor that called
|
|
60
|
+
* `provideTabularProfile` for the same resourceId. Falls back to
|
|
61
|
+
* fetching on its own if no compatible ancestor is found — preserves
|
|
62
|
+
* standalone usage of TabularExplorer / DataStructure.
|
|
63
|
+
*/
|
|
64
|
+
export async function injectTabularProfile(resourceId: MaybeRefOrGetter<string>): Promise<TabularProfileState> {
|
|
65
|
+
const injected = inject<TabularProfileShared | null>(TABULAR_PROFILE_KEY, null)
|
|
66
|
+
if (injected && injected.resourceId.value === toValue(resourceId)) {
|
|
67
|
+
return await injected.state
|
|
68
|
+
}
|
|
69
|
+
return await createProfileState(resourceId)
|
|
70
|
+
}
|
package/src/config.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { inject, type Component, type InjectionKey } from 'vue'
|
|
2
2
|
import type { UseFetchFunction } from './functions/api.types'
|
|
3
|
-
import type { FetchOptions } from 'ofetch'
|
|
3
|
+
import type { $Fetch, FetchOptions } from 'ofetch'
|
|
4
4
|
|
|
5
5
|
export type PluginConfig = {
|
|
6
6
|
name: string // Name of the application (ex: data.gouv.fr)
|
|
@@ -25,6 +25,16 @@ export type PluginConfig = {
|
|
|
25
25
|
tabularAllowRemote?: boolean
|
|
26
26
|
tabularApiDataserviceId?: string
|
|
27
27
|
customUseFetch?: UseFetchFunction | null
|
|
28
|
+
/**
|
|
29
|
+
* Imperative configured fetch (auth, headers, error handling): the single source of truth for
|
|
30
|
+
* requests. The default `useFetch` uses it as its transport, and imperative helpers (metrics CSV
|
|
31
|
+
* export, …) call it directly — so they never need a `?? ofetch` fallback.
|
|
32
|
+
* Optional for consumers: when omitted, the plugin defaults it to an `ofetch` instance built from
|
|
33
|
+
* the `onRequest`/`onResponse` hooks below (see the `datagouv` plugin install). A consumer can
|
|
34
|
+
* instead provide its own (e.g. a Bearer-authenticated `$fetch`) and skip the hooks entirely.
|
|
35
|
+
*/
|
|
36
|
+
$fetch?: $Fetch | null
|
|
37
|
+
/** Auth/headers/error hooks. Folded into the default `$fetch` when no `$fetch` is provided. */
|
|
28
38
|
onRequest?: FetchOptions['onRequest']
|
|
29
39
|
onRequestError?: FetchOptions['onRequestError']
|
|
30
40
|
onResponse?: FetchOptions['onResponse']
|
|
@@ -38,8 +48,12 @@ export type PluginConfig = {
|
|
|
38
48
|
|
|
39
49
|
export const configKey = Symbol() as InjectionKey<PluginConfig>
|
|
40
50
|
|
|
41
|
-
|
|
51
|
+
// After the `datagouv` plugin install, `$fetch` is always set (defaulted to an ofetch instance), so
|
|
52
|
+
// consumers of the config can rely on it without a fallback.
|
|
53
|
+
export type ResolvedPluginConfig = PluginConfig & { $fetch: $Fetch }
|
|
54
|
+
|
|
55
|
+
export function useComponentsConfig(): ResolvedPluginConfig {
|
|
42
56
|
const config = inject(configKey)
|
|
43
57
|
if (!config) throw new Error('Calling `useComponentsConfig` outside @datagouv/components')
|
|
44
|
-
return config
|
|
58
|
+
return config as ResolvedPluginConfig
|
|
45
59
|
}
|
|
@@ -11,9 +11,9 @@ export function getActivityTranslation(activity: Activity): string {
|
|
|
11
11
|
'dataset:deleted': t('a supprimé le jeu de données'),
|
|
12
12
|
'dataset:discussed': t('a discuté du jeu de données'),
|
|
13
13
|
'dataset:followed': t('suit le jeu de données'),
|
|
14
|
-
'dataset:resource:added': t('a ajouté
|
|
15
|
-
'dataset:resource:updated': t('a mis à jour
|
|
16
|
-
'dataset:resource:deleted': t('a supprimé
|
|
14
|
+
'dataset:resource:added': t('a ajouté la ressource'),
|
|
15
|
+
'dataset:resource:updated': t('a mis à jour la ressource'),
|
|
16
|
+
'dataset:resource:deleted': t('a supprimé la ressource'),
|
|
17
17
|
'dataservice:created': t('a créé le service de données'),
|
|
18
18
|
'dataservice:updated': t('a mis à jour le service de données'),
|
|
19
19
|
'dataservice:deleted': t('a supprimé le service de données'),
|
package/src/functions/api.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ref, toValue, watchEffect, onMounted, type ComputedRef, type MaybeRefOrGetter, type Ref } from 'vue'
|
|
2
2
|
import { ofetch } from 'ofetch'
|
|
3
3
|
import { useComponentsConfig } from '../config'
|
|
4
|
-
import { useTranslation } from '../composables/useTranslation'
|
|
5
4
|
import type { AsyncData, AsyncDataRequestStatus, UseFetchOptions } from './api.types'
|
|
6
5
|
|
|
7
6
|
function deepToValue(obj: MaybeRefOrGetter<Record<string, unknown> | undefined>): Record<string, unknown> | undefined {
|
|
@@ -18,8 +17,6 @@ export async function useFetch<DataT, ErrorT = never>(
|
|
|
18
17
|
): Promise<AsyncData<DataT, ErrorT>> {
|
|
19
18
|
const config = useComponentsConfig()
|
|
20
19
|
|
|
21
|
-
const { locale } = useTranslation()
|
|
22
|
-
|
|
23
20
|
if (config.customUseFetch) {
|
|
24
21
|
return await config.customUseFetch(url, options)
|
|
25
22
|
}
|
|
@@ -37,38 +34,12 @@ export async function useFetch<DataT, ErrorT = never>(
|
|
|
37
34
|
status.value = 'pending'
|
|
38
35
|
try {
|
|
39
36
|
data.value = isRaw
|
|
37
|
+
// Raw targets another data.gouv service (the Tabular API in TabularExplorer) via its own
|
|
38
|
+
// absolute URL, so it must stay bare ofetch: no datagouv apiBase, no datagouv auth attached.
|
|
40
39
|
? await ofetch<DataT | null>(urlValue, { params: params ?? query })
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
onRequest(param) {
|
|
45
|
-
if (config.onRequest) {
|
|
46
|
-
if (Array.isArray(config.onRequest)) {
|
|
47
|
-
config.onRequest.forEach(r => r(param))
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
config.onRequest(param)
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
const { options } = param
|
|
54
|
-
options.headers.set('Content-Type', 'application/json')
|
|
55
|
-
options.headers.set('Accept', 'application/json')
|
|
56
|
-
options.credentials = 'include'
|
|
57
|
-
if (config.devApiKey) {
|
|
58
|
-
options.headers.set('X-API-KEY', config.devApiKey)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (locale) {
|
|
62
|
-
if (!options.params) {
|
|
63
|
-
options.params = {}
|
|
64
|
-
}
|
|
65
|
-
options.params['lang'] = locale
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
onRequestError: config.onRequestError,
|
|
69
|
-
onResponse: config.onResponse,
|
|
70
|
-
onResponseError: config.onResponseError,
|
|
71
|
-
})
|
|
40
|
+
// The configured `$fetch` carries baseURL + auth + headers (see the `datagouv` plugin install
|
|
41
|
+
// for the default one). We only forward the URL and params here.
|
|
42
|
+
: await config.$fetch<DataT | null>(urlValue, { baseURL: config.apiBase, params: params ?? query })
|
|
72
43
|
status.value = 'success'
|
|
73
44
|
}
|
|
74
45
|
catch (e) {
|
package/src/functions/metrics.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { escapeCsvValue } from './helpers'
|
|
2
|
-
import { ofetch } from 'ofetch'
|
|
2
|
+
import { ofetch, type $Fetch } from 'ofetch'
|
|
3
3
|
import type { DatasetV2 } from '../types/datasets'
|
|
4
4
|
import type { PaginatedArray } from '../types/api'
|
|
5
5
|
|
|
@@ -119,14 +119,16 @@ export async function getDatasetMetrics(datasetId: string, metricsApi: string):
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
export async function createDatasetsForOrganizationMetricsUrl(organizationId: string, metricsApi: string, apiBase: string) {
|
|
122
|
+
export async function createDatasetsForOrganizationMetricsUrl(organizationId: string, metricsApi: string, apiBase: string, apiFetch: $Fetch) {
|
|
123
123
|
let data = 'dataset_title,dataset_id,month,monthly_visit,monthly_download_resource\n'
|
|
124
124
|
|
|
125
|
-
// fetch datasets info from organization datasets
|
|
125
|
+
// fetch datasets info from organization datasets through the configured fetch, so it carries the
|
|
126
|
+
// consumer's auth (cookie for cdata via `$api`, Bearer for verticals) instead of a hardcoded
|
|
127
|
+
// `credentials: 'include'`, which breaks CORS cross-origin on the verticals.
|
|
126
128
|
const datasets: Record<string, Record<string, string>> = {}
|
|
127
129
|
let datasetsUrl: string | null = `/api/2/datasets/?organization=${organizationId}&page_size=200`
|
|
128
130
|
while (datasetsUrl) {
|
|
129
|
-
const body: PaginatedArray<DatasetV2> = await
|
|
131
|
+
const body: PaginatedArray<DatasetV2> = await apiFetch(datasetsUrl, { baseURL: apiBase })
|
|
130
132
|
datasetsUrl = body.next_page
|
|
131
133
|
for (const row of body.data) {
|
|
132
134
|
datasets[row.id] = { title: row.title }
|
package/src/main.ts
CHANGED
|
@@ -40,6 +40,9 @@ import BrandedButton from './components/BrandedButton.vue'
|
|
|
40
40
|
import CopyButton from './components/CopyButton.vue'
|
|
41
41
|
import DataserviceCard from './components/DataserviceCard.vue'
|
|
42
42
|
import DatasetCard from './components/DatasetCard.vue'
|
|
43
|
+
import DataStructure from './components/ResourceAccordion/DataStructure.vue'
|
|
44
|
+
import Downloads from './components/ResourceAccordion/Downloads.vue'
|
|
45
|
+
import Metadata from './components/ResourceAccordion/Metadata.vue'
|
|
43
46
|
import DescriptionListTerm from './components/DescriptionListTerm.vue'
|
|
44
47
|
import DescriptionListDetails from './components/DescriptionListDetails.vue'
|
|
45
48
|
import DiscussionMessageCard from './components/DiscussionMessageCard.vue'
|
|
@@ -60,6 +63,7 @@ import LoadingBlock from './components/LoadingBlock.vue'
|
|
|
60
63
|
import MarkdownViewer from './components/MarkdownViewer.vue'
|
|
61
64
|
import OrganizationCard from './components/OrganizationCard.vue'
|
|
62
65
|
import OrganizationHorizontalCard from './components/OrganizationHorizontalCard.vue'
|
|
66
|
+
import ObjectCardOwner from './components/ObjectCardOwner.vue'
|
|
63
67
|
import OrganizationLogo from './components/OrganizationLogo.vue'
|
|
64
68
|
import OrganizationNameWithCertificate from './components/OrganizationNameWithCertificate.vue'
|
|
65
69
|
import OwnerType from './components/OwnerType.vue'
|
|
@@ -73,6 +77,7 @@ import PostCard from './components/PostCard.vue'
|
|
|
73
77
|
import ReadMore from './components/ReadMore.vue'
|
|
74
78
|
import ResourceAccordion from './components/ResourceAccordion/ResourceAccordion.vue'
|
|
75
79
|
import ResourceIcon from './components/ResourceAccordion/ResourceIcon.vue'
|
|
80
|
+
import ResourceSelector from './components/ResourceExplorer/ResourceSelector.vue'
|
|
76
81
|
import ResourceExplorer from './components/ResourceExplorer/ResourceExplorer.vue'
|
|
77
82
|
import ResourceExplorerSidebar from './components/ResourceExplorer/ResourceExplorerSidebar.vue'
|
|
78
83
|
import ResourceExplorerViewer from './components/ResourceExplorer/ResourceExplorerViewer.vue'
|
|
@@ -82,9 +87,6 @@ import ReuseHorizontalCard from './components/ReuseHorizontalCard.vue'
|
|
|
82
87
|
import ReuseDetails from './components/ReuseDetails.vue'
|
|
83
88
|
import SchemaCard from './components/SchemaCard.vue'
|
|
84
89
|
import SimpleBanner from './components/SimpleBanner.vue'
|
|
85
|
-
import SmallChart from './components/SmallChart.vue'
|
|
86
|
-
import ChartViewer from './components/Chart/ChartViewer.vue'
|
|
87
|
-
import ChartViewerWrapper from './components/Chart/ChartViewerWrapper.vue'
|
|
88
90
|
import StatBox from './components/StatBox.vue'
|
|
89
91
|
import Tab from './components/Tabs/Tab.vue'
|
|
90
92
|
import TabGroup from './components/Tabs/TabGroup.vue'
|
|
@@ -104,6 +106,8 @@ import InfiniteLoader from './components/InfiniteLoader.vue'
|
|
|
104
106
|
import TabularExplorer from './components/TabularExplorer/TabularExplorer.vue'
|
|
105
107
|
import type { UseFetchFunction } from './functions/api.types'
|
|
106
108
|
import { configKey, useComponentsConfig, type PluginConfig } from './config.js'
|
|
109
|
+
import { ofetch } from 'ofetch'
|
|
110
|
+
import { useTranslation } from './composables/useTranslation'
|
|
107
111
|
|
|
108
112
|
export { Toaster, toast } from 'vue-sonner'
|
|
109
113
|
|
|
@@ -113,6 +117,8 @@ export * from './composables/useMetrics'
|
|
|
113
117
|
export * from './composables/useReuseType'
|
|
114
118
|
export * from './composables/useTranslation'
|
|
115
119
|
export * from './composables/useHasTabularData'
|
|
120
|
+
export * from './composables/useResourceCapabilities'
|
|
121
|
+
export * from './composables/useTabularProfile'
|
|
116
122
|
|
|
117
123
|
export * from './functions/activities'
|
|
118
124
|
export * from './functions/datasets'
|
|
@@ -278,6 +284,31 @@ export {
|
|
|
278
284
|
// Vue Plugin
|
|
279
285
|
const datagouv: Plugin<PluginConfig> = {
|
|
280
286
|
async install(app: App, options) {
|
|
287
|
+
// Default `$fetch` to an ofetch instance carrying the datagouv API specifics + the consumer's
|
|
288
|
+
// auth hooks, so everything downstream (the default `useFetch`, imperative helpers) can rely on
|
|
289
|
+
// a single configured fetch. A consumer that provides its own `$fetch` keeps full control.
|
|
290
|
+
if (!options.$fetch) {
|
|
291
|
+
options.$fetch = ofetch.create({
|
|
292
|
+
baseURL: options.apiBase,
|
|
293
|
+
onRequest(context) {
|
|
294
|
+
if (options.onRequest) {
|
|
295
|
+
if (Array.isArray(options.onRequest)) options.onRequest.forEach(hook => hook(context))
|
|
296
|
+
else options.onRequest(context)
|
|
297
|
+
}
|
|
298
|
+
context.options.headers.set('Content-Type', 'application/json')
|
|
299
|
+
context.options.headers.set('Accept', 'application/json')
|
|
300
|
+
if (options.devApiKey) context.options.headers.set('X-API-KEY', options.devApiKey)
|
|
301
|
+
const { locale } = useTranslation()
|
|
302
|
+
if (locale) {
|
|
303
|
+
context.options.params ??= {}
|
|
304
|
+
context.options.params['lang'] = locale
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
onRequestError: options.onRequestError,
|
|
308
|
+
onResponse: options.onResponse,
|
|
309
|
+
onResponseError: options.onResponseError,
|
|
310
|
+
})
|
|
311
|
+
}
|
|
281
312
|
app.provide(configKey, options)
|
|
282
313
|
if (!options.textClamp) {
|
|
283
314
|
const textClamp = await import('vue3-text-clamp')
|
|
@@ -299,6 +330,9 @@ export {
|
|
|
299
330
|
CopyButton,
|
|
300
331
|
DataserviceCard,
|
|
301
332
|
DatasetCard,
|
|
333
|
+
DataStructure,
|
|
334
|
+
Downloads,
|
|
335
|
+
Metadata,
|
|
302
336
|
DatasetInformationSection,
|
|
303
337
|
DatasetTemporalitySection,
|
|
304
338
|
DatasetSpatialSection,
|
|
@@ -338,15 +372,14 @@ export {
|
|
|
338
372
|
ResourceExplorer,
|
|
339
373
|
ResourceExplorerSidebar,
|
|
340
374
|
ResourceExplorerViewer,
|
|
375
|
+
ObjectCardOwner,
|
|
341
376
|
ResourceIcon,
|
|
377
|
+
ResourceSelector,
|
|
342
378
|
ReuseCard,
|
|
343
379
|
ReuseDetails,
|
|
344
380
|
ReuseHorizontalCard,
|
|
345
381
|
SchemaCard,
|
|
346
382
|
SimpleBanner,
|
|
347
|
-
SmallChart,
|
|
348
|
-
ChartViewer,
|
|
349
|
-
ChartViewerWrapper,
|
|
350
383
|
StatBox,
|
|
351
384
|
OpenApiViewer,
|
|
352
385
|
Tab,
|
package/src/types/search.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Component } from 'vue'
|
|
1
2
|
import type { PaginatedArray } from './api'
|
|
2
3
|
import type { AccessType } from './access_types'
|
|
3
4
|
import type { Dataset } from './datasets'
|
|
@@ -298,55 +299,65 @@ export type DatasetSearchConfig = {
|
|
|
298
299
|
class: 'datasets'
|
|
299
300
|
key?: string
|
|
300
301
|
name?: string
|
|
302
|
+
icon?: Component | string
|
|
301
303
|
placeholder?: string | null
|
|
302
304
|
hiddenFilters?: HiddenFilter<DatasetSearchFilters>[]
|
|
303
305
|
basicFilters?: (keyof DatasetSearchFilters)[]
|
|
304
306
|
advancedFilters?: (keyof DatasetSearchFilters)[]
|
|
305
307
|
sortOptions?: SortOption<DatasetSearchSort>[]
|
|
308
|
+
defaultSort?: DatasetSearchSort
|
|
306
309
|
}
|
|
307
310
|
|
|
308
311
|
export type DataserviceSearchConfig = {
|
|
309
312
|
class: 'dataservices'
|
|
310
313
|
key?: string
|
|
311
314
|
name?: string
|
|
315
|
+
icon?: Component | string
|
|
312
316
|
placeholder?: string | null
|
|
313
317
|
hiddenFilters?: HiddenFilter<DataserviceSearchFilters>[]
|
|
314
318
|
basicFilters?: (keyof DataserviceSearchFilters)[]
|
|
315
319
|
advancedFilters?: (keyof DataserviceSearchFilters)[]
|
|
316
320
|
sortOptions?: SortOption<DataserviceSearchSort>[]
|
|
321
|
+
defaultSort?: DataserviceSearchSort
|
|
317
322
|
}
|
|
318
323
|
|
|
319
324
|
export type ReuseSearchConfig = {
|
|
320
325
|
class: 'reuses'
|
|
321
326
|
key?: string
|
|
322
327
|
name?: string
|
|
328
|
+
icon?: Component | string
|
|
323
329
|
placeholder?: string | null
|
|
324
330
|
hiddenFilters?: HiddenFilter<ReuseSearchFilters>[]
|
|
325
331
|
basicFilters?: (keyof ReuseSearchFilters)[]
|
|
326
332
|
advancedFilters?: (keyof ReuseSearchFilters)[]
|
|
327
333
|
sortOptions?: SortOption<ReuseSearchSort>[]
|
|
334
|
+
defaultSort?: ReuseSearchSort
|
|
328
335
|
}
|
|
329
336
|
|
|
330
337
|
export type OrganizationSearchConfig = {
|
|
331
338
|
class: 'organizations'
|
|
332
339
|
key?: string
|
|
333
340
|
name?: string
|
|
341
|
+
icon?: Component | string
|
|
334
342
|
placeholder?: string | null
|
|
335
343
|
hiddenFilters?: HiddenFilter<OrganizationSearchFilters>[]
|
|
336
344
|
basicFilters?: (keyof OrganizationSearchFilters)[]
|
|
337
345
|
advancedFilters?: (keyof OrganizationSearchFilters)[]
|
|
338
346
|
sortOptions?: SortOption<OrganizationSearchSort>[]
|
|
347
|
+
defaultSort?: OrganizationSearchSort
|
|
339
348
|
}
|
|
340
349
|
|
|
341
350
|
export type TopicSearchConfig = {
|
|
342
351
|
class: 'topics'
|
|
343
352
|
key?: string
|
|
344
353
|
name?: string
|
|
354
|
+
icon?: Component | string
|
|
345
355
|
placeholder?: string | null
|
|
346
356
|
hiddenFilters?: HiddenFilter<TopicSearchFilters>[]
|
|
347
357
|
basicFilters?: (keyof TopicSearchFilters)[]
|
|
348
358
|
advancedFilters?: (keyof TopicSearchFilters)[]
|
|
349
359
|
sortOptions?: SortOption<TopicSearchSort>[]
|
|
360
|
+
defaultSort?: TopicSearchSort
|
|
350
361
|
}
|
|
351
362
|
|
|
352
363
|
export type SearchTypeConfig = DatasetSearchConfig | DataserviceSearchConfig | ReuseSearchConfig | OrganizationSearchConfig | TopicSearchConfig
|