@datagouv/components-next 1.0.2-dev.15 → 1.0.2-dev.150

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 (115) hide show
  1. package/README.md +7 -6
  2. package/assets/main.css +4 -0
  3. package/dist/{Control-DuZJdKV_.js → Control-B9WQxlpJ.js} +1 -1
  4. package/dist/{Datafair.client-BtQqFBTQ.js → Datafair.client-BRgmha-O.js} +4 -4
  5. package/dist/{Event--kp8kMdJ.js → Event-iXDrp-fy.js} +31 -31
  6. package/dist/{Image-34hvypZI.js → Image-mNMBOofs.js} +9 -9
  7. package/dist/JsonPreview.client-Cs87KC-b.js +40 -0
  8. package/dist/{Map-BjUnLyj8.js → Map-BfqKMw0S.js} +1739 -1599
  9. package/dist/{MapContainer.client-DB6p6KF8.js → MapContainer.client-DLJuagQI.js} +38 -39
  10. package/dist/{OSM-s40W6sQ2.js → OSM-CcrUhItr.js} +15 -23
  11. package/dist/{PdfPreview.client-Dr4VcIur.js → PdfPreview.client-BI90pK6j.js} +823 -855
  12. package/dist/Pmtiles.client-bJzz1c3r.js +26142 -0
  13. package/dist/PreviewWrapper.vue_vue_type_script_setup_true_lang-DS_Tvpti.js +61 -0
  14. package/dist/{ScaleLine-KW-nXqp3.js → ScaleLine-VGQ7nkMS.js} +2 -2
  15. package/dist/{Tile-DbNFNPfU.js → Tile-CSpn0Ca8.js} +160 -163
  16. package/dist/{TileImage-BsXBxMtq.js → TileImage-CpbaEFwd.js} +143 -131
  17. package/dist/{View-BR92hTWP.js → View-BYBpt-AU.js} +483 -422
  18. package/dist/XmlPreview.client-L8ZyxNdY.js +34 -0
  19. package/dist/{common-PJfpC179.js → common-BoeTUnDZ.js} +52 -52
  20. package/dist/components-next.css +1 -52
  21. package/dist/components-next.js +174 -142
  22. package/dist/components.css +2 -2
  23. package/dist/{index-D3rieddI.js → index-sr5KjUOp.js} +21147 -15136
  24. package/dist/{leaflet-src-7m1mB8LI.js → leaflet-src-D34jQJmR.js} +185 -187
  25. package/dist/main-CWzZZ7OE.js +73583 -0
  26. package/dist/{proj-DsetBcW7.js → proj-DxGbobp7.js} +662 -626
  27. package/dist/{text-clamp.esm-B5kW_XMt.js → text-clamp.esm-DVseBqZZ.js} +4 -4
  28. package/dist/{tilecoord-Db24Px13.js → tilecoord-DvX7WWiA.js} +273 -264
  29. package/dist/{vue3-json-viewer-BXwup7nO.js → vue3-json-viewer-CJLQFzXZ.js} +10 -16
  30. package/dist/{vue3-xml-viewer.common-CJXShyPB.js → vue3-xml-viewer.common-9Hozz8ne.js} +16 -16
  31. package/package.json +50 -36
  32. package/src/chart.ts +5 -0
  33. package/src/components/ActivityList/ActivityList.vue +3 -2
  34. package/src/components/Chart/ChartViewer.vue +233 -0
  35. package/src/components/Chart/ChartViewerWrapper.vue +182 -0
  36. package/src/components/DataserviceCard.vue +3 -0
  37. package/src/components/DatasetCard.vue +9 -4
  38. package/src/components/Form/Listbox.vue +101 -0
  39. package/src/components/Form/SearchableSelect.vue +2 -1
  40. package/src/components/InfiniteLoader.vue +53 -0
  41. package/src/components/ObjectCardHeader.vue +11 -4
  42. package/src/components/OpenApiViewer/ContentTypeSelect.vue +48 -0
  43. package/src/components/OpenApiViewer/EndpointRequest.vue +164 -0
  44. package/src/components/OpenApiViewer/EndpointResponses.vue +149 -0
  45. package/src/components/OpenApiViewer/OpenApiViewer.vue +308 -0
  46. package/src/components/OpenApiViewer/SchemaPanel.vue +53 -0
  47. package/src/components/OpenApiViewer/SchemaTree.vue +77 -0
  48. package/src/components/OpenApiViewer/openapi.ts +150 -0
  49. package/src/components/OrganizationNameWithCertificate.vue +3 -2
  50. package/src/components/Pagination.vue +8 -5
  51. package/src/components/RadioInput.vue +7 -2
  52. package/src/components/ResourceAccordion/DataStructure.vue +11 -33
  53. package/src/components/ResourceAccordion/Downloads.vue +160 -0
  54. package/src/components/ResourceAccordion/JsonPreview.client.vue +23 -104
  55. package/src/components/ResourceAccordion/MapContainer.client.vue +1 -3
  56. package/src/components/ResourceAccordion/Metadata.vue +1 -2
  57. package/src/components/ResourceAccordion/PdfPreview.client.vue +24 -87
  58. package/src/components/ResourceAccordion/Pmtiles.client.vue +3 -1
  59. package/src/components/ResourceAccordion/Preview.vue +11 -11
  60. package/src/components/ResourceAccordion/PreviewWrapper.vue +82 -0
  61. package/src/components/ResourceAccordion/ResourceAccordion.vue +12 -111
  62. package/src/components/ResourceAccordion/XmlPreview.client.vue +16 -98
  63. package/src/components/ResourceExplorer/ResourceExplorer.vue +22 -19
  64. package/src/components/ResourceExplorer/ResourceExplorerSidebar.vue +2 -2
  65. package/src/components/ResourceExplorer/ResourceExplorerViewer.vue +57 -148
  66. package/src/components/ResourceExplorer/ResourceSelector.vue +113 -0
  67. package/src/components/ReuseCard.vue +14 -6
  68. package/src/components/ReuseDetails.vue +2 -2
  69. package/src/components/ReuseHorizontalCard.vue +2 -2
  70. package/src/components/Search/GlobalSearch.vue +219 -117
  71. package/src/components/Search/SearchInput.vue +5 -4
  72. package/src/components/TabularExplorer/TabularCell.vue +51 -0
  73. package/src/components/TabularExplorer/TabularCellPopover.vue +170 -0
  74. package/src/components/TabularExplorer/TabularExplorer.vue +1132 -0
  75. package/src/components/TabularExplorer/TabularFilterContent.vue +353 -0
  76. package/src/components/TabularExplorer/TabularFilterPopover.vue +106 -0
  77. package/src/components/TabularExplorer/types.ts +86 -0
  78. package/src/composables/useHasTabularData.ts +15 -1
  79. package/src/composables/useMetrics.ts +1 -1
  80. package/src/composables/useResourceCapabilities.ts +22 -9
  81. package/src/composables/useSearchFilter.ts +120 -0
  82. package/src/composables/useStableQueryParams.ts +38 -6
  83. package/src/composables/useTabularProfile.ts +70 -0
  84. package/src/config.ts +20 -3
  85. package/src/functions/activities.ts +3 -3
  86. package/src/functions/api.ts +20 -42
  87. package/src/functions/api.types.ts +1 -0
  88. package/src/functions/charts.ts +79 -0
  89. package/src/functions/datasets.ts +0 -17
  90. package/src/functions/dates.ts +3 -2
  91. package/src/functions/metrics.ts +6 -4
  92. package/src/functions/resources.ts +110 -1
  93. package/src/functions/tabular.ts +171 -0
  94. package/src/functions/tabularApi.ts +96 -11
  95. package/src/main.ts +97 -10
  96. package/src/types/dataservices.ts +2 -0
  97. package/src/types/organizations.ts +10 -0
  98. package/src/types/pages.ts +0 -5
  99. package/src/types/posts.ts +2 -2
  100. package/src/types/reports.ts +5 -1
  101. package/src/types/resources.ts +0 -1
  102. package/src/types/reuses.ts +12 -1
  103. package/src/types/search.ts +63 -1
  104. package/src/types/site.ts +5 -3
  105. package/src/types/ui.ts +2 -0
  106. package/src/types/users.ts +2 -1
  107. package/src/types/visualizations.ts +93 -0
  108. package/assets/swagger-themes/newspaper.css +0 -1670
  109. package/dist/JsonPreview.client-DojrmGyU.js +0 -72
  110. package/dist/Pmtiles.client-DbMjfK00.js +0 -25185
  111. package/dist/Swagger.client-Db_xYKJv.js +0 -4
  112. package/dist/XmlPreview.client-CHxSFhd7.js +0 -64
  113. package/dist/main-D70Xt4a7.js +0 -105854
  114. package/src/components/ResourceAccordion/Swagger.client.vue +0 -48
  115. package/src/functions/pagination.ts +0 -9
package/src/main.ts CHANGED
@@ -13,9 +13,9 @@ import type { License } from './types/licenses'
13
13
  import type { Member, MemberRole, NewOrganization, Organization, OrganizationOrSuggest, OrganizationReference, OrganizationSuggest } from './types/organizations'
14
14
  import type { Owned, OwnedWithFullObject, OwnedWithId } from './types/owned'
15
15
  import type { Comment, Thread } from './types/discussions'
16
- import type { Page, PageBloc, ContentBloc, BlocWithTitle, DatasetsListBloc, DataservicesListBloc, ReusesListBloc, LinkInBloc, LinksListBloc, MarkdownBloc, AccordionItemBloc, AccordionListBloc, HeroBloc } from './types/pages'
16
+ import type { PageBloc, ContentBloc, BlocWithTitle, DatasetsListBloc, DataservicesListBloc, ReusesListBloc, LinkInBloc, LinksListBloc, MarkdownBloc, AccordionItemBloc, AccordionListBloc, HeroBloc } from './types/pages'
17
17
  import type { Post } from './types/posts'
18
- import type { ReuseReference, NewReuse, Reuse, ReuseTopic, ReuseType } from './types/reuses'
18
+ import type { ReuseReference, NewReuse, Reuse, ReuseV2, ReuseTopic, ReuseType } from './types/reuses'
19
19
  import type { RegisteredSchema, Schema, SchemaDetails, SchemaField, SchemaPath, SchemaPublicationMode, SchemaResponseData, SchemaVersion, ValidataError } from './types/schemas'
20
20
  import type { TopicV2, TopicElement, TopicElementClass, TopicElementRel } from './types/topics'
21
21
  import type { CommunityResource, FileResourceFileType, RemoteResourceFileType, ResourceFileType, ResourceGroup, ResourceType, Resource } from './types/resources'
@@ -23,8 +23,12 @@ import type { Site } from './types/site'
23
23
  import type { Weight, WellType } from './types/ui'
24
24
  import type { User, UserReference } from './types/users'
25
25
  import type { Report, ReportSubject, ReportReason } from './types/reports'
26
- import type { GlobalSearchConfig, SearchType, SortOption } from './types/search'
27
- import { getDefaultDatasetConfig, getDefaultDataserviceConfig, getDefaultReuseConfig, getDefaultOrganizationConfig, getDefaultGlobalSearchConfig, defaultDatasetSortOptions, defaultDataserviceSortOptions, defaultReuseSortOptions, defaultOrganizationSortOptions } from './types/search'
26
+ import type { Chart, ChartForm, ChartForApi, FilterCondition, Filter, AndFilters, GenericFilter, XAxisType, XAxisSortBy, SortDirection, XAxis, XAxisForm, UnitPosition, YAxis, DataSeriesType, DataSeries, DataSeriesForm, CombinedSort, ColumnDefinition, ColumnsDefinition } from './types/visualizations'
27
+ import type { ColumnType } from './components/TabularExplorer/types'
28
+ import type { GlobalSearchConfig, SearchType, SearchTypeConfig, SortOption, HiddenFilter, BuiltInFilterKey, DatasetSearchConfig, DatasetSearchFilters, DataserviceSearchConfig, DataserviceSearchFilters, ReuseSearchConfig, ReuseSearchFilters, OrganizationSearchConfig, OrganizationSearchFilters, TopicSearchConfig, TopicSearchFilters } from './types/search'
29
+ import { getDefaultDatasetConfig, getDefaultDataserviceConfig, getDefaultReuseConfig, getDefaultOrganizationConfig, getDefaultTopicConfig, getDefaultGlobalSearchConfig, defaultDatasetSortOptions, defaultDataserviceSortOptions, defaultReuseSortOptions, defaultOrganizationSortOptions } from './types/search'
30
+ import { useSearchFilter } from './composables/useSearchFilter'
31
+ import type { UseSearchFilterOptions } from './composables/useSearchFilter'
28
32
 
29
33
  import ActivityList from './components/ActivityList/ActivityList.vue'
30
34
  import UserActivityList from './components/ActivityList/UserActivityList.vue'
@@ -37,6 +41,9 @@ import BrandedButton from './components/BrandedButton.vue'
37
41
  import CopyButton from './components/CopyButton.vue'
38
42
  import DataserviceCard from './components/DataserviceCard.vue'
39
43
  import DatasetCard from './components/DatasetCard.vue'
44
+ import DataStructure from './components/ResourceAccordion/DataStructure.vue'
45
+ import Downloads from './components/ResourceAccordion/Downloads.vue'
46
+ import Metadata from './components/ResourceAccordion/Metadata.vue'
40
47
  import DescriptionListTerm from './components/DescriptionListTerm.vue'
41
48
  import DescriptionListDetails from './components/DescriptionListDetails.vue'
42
49
  import DiscussionMessageCard from './components/DiscussionMessageCard.vue'
@@ -57,6 +64,7 @@ import LoadingBlock from './components/LoadingBlock.vue'
57
64
  import MarkdownViewer from './components/MarkdownViewer.vue'
58
65
  import OrganizationCard from './components/OrganizationCard.vue'
59
66
  import OrganizationHorizontalCard from './components/OrganizationHorizontalCard.vue'
67
+ import ObjectCardOwner from './components/ObjectCardOwner.vue'
60
68
  import OrganizationLogo from './components/OrganizationLogo.vue'
61
69
  import OrganizationNameWithCertificate from './components/OrganizationNameWithCertificate.vue'
62
70
  import OwnerType from './components/OwnerType.vue'
@@ -70,16 +78,16 @@ import PostCard from './components/PostCard.vue'
70
78
  import ReadMore from './components/ReadMore.vue'
71
79
  import ResourceAccordion from './components/ResourceAccordion/ResourceAccordion.vue'
72
80
  import ResourceIcon from './components/ResourceAccordion/ResourceIcon.vue'
81
+ import ResourceSelector from './components/ResourceExplorer/ResourceSelector.vue'
73
82
  import ResourceExplorer from './components/ResourceExplorer/ResourceExplorer.vue'
74
83
  import ResourceExplorerSidebar from './components/ResourceExplorer/ResourceExplorerSidebar.vue'
75
84
  import ResourceExplorerViewer from './components/ResourceExplorer/ResourceExplorerViewer.vue'
76
- import Swagger from './components/ResourceAccordion/Swagger.client.vue'
85
+ import OpenApiViewer from './components/OpenApiViewer/OpenApiViewer.vue'
77
86
  import ReuseCard from './components/ReuseCard.vue'
78
87
  import ReuseHorizontalCard from './components/ReuseHorizontalCard.vue'
79
88
  import ReuseDetails from './components/ReuseDetails.vue'
80
89
  import SchemaCard from './components/SchemaCard.vue'
81
90
  import SimpleBanner from './components/SimpleBanner.vue'
82
- import SmallChart from './components/SmallChart.vue'
83
91
  import StatBox from './components/StatBox.vue'
84
92
  import Tab from './components/Tabs/Tab.vue'
85
93
  import TabGroup from './components/Tabs/TabGroup.vue'
@@ -94,16 +102,24 @@ import GlobalSearch from './components/Search/GlobalSearch.vue'
94
102
  import SearchInput from './components/Search/SearchInput.vue'
95
103
  import SearchableSelect from './components/Form/SearchableSelect.vue'
96
104
  import SelectGroup from './components/Form/SelectGroup.vue'
105
+ import Listbox from './components/Form/Listbox.vue'
106
+ import InfiniteLoader from './components/InfiniteLoader.vue'
107
+ import TabularExplorer from './components/TabularExplorer/TabularExplorer.vue'
97
108
  import type { UseFetchFunction } from './functions/api.types'
98
109
  import { configKey, useComponentsConfig, type PluginConfig } from './config.js'
110
+ import { ofetch } from 'ofetch'
111
+ import { useTranslation } from './composables/useTranslation'
99
112
 
100
113
  export { Toaster, toast } from 'vue-sonner'
101
114
 
102
115
  export * from './composables/useActiveDescendant'
116
+ export * from './composables/useDebouncedRef'
103
117
  export * from './composables/useMetrics'
104
118
  export * from './composables/useReuseType'
105
119
  export * from './composables/useTranslation'
106
120
  export * from './composables/useHasTabularData'
121
+ export * from './composables/useResourceCapabilities'
122
+ export * from './composables/useTabularProfile'
107
123
 
108
124
  export * from './functions/activities'
109
125
  export * from './functions/datasets'
@@ -116,17 +132,33 @@ export * from './functions/metrics'
116
132
  export * from './functions/never'
117
133
  export * from './functions/organizations'
118
134
  export * from './functions/owned'
119
- export * from './functions/pagination'
120
135
  export * from './functions/resources'
121
136
  export * from './functions/reuses'
122
137
  export * from './functions/schemas'
138
+ export * from './functions/tabular'
123
139
  export * from './functions/users'
140
+ export * from './functions/tabularApi'
141
+ export * from './functions/charts'
124
142
  export * from './types/access_types'
125
143
 
126
144
  export type {
127
145
  GlobalSearchConfig,
128
146
  SearchType,
147
+ SearchTypeConfig,
129
148
  SortOption,
149
+ HiddenFilter,
150
+ BuiltInFilterKey,
151
+ DatasetSearchConfig,
152
+ DatasetSearchFilters,
153
+ DataserviceSearchConfig,
154
+ DataserviceSearchFilters,
155
+ ReuseSearchConfig,
156
+ ReuseSearchFilters,
157
+ OrganizationSearchConfig,
158
+ OrganizationSearchFilters,
159
+ TopicSearchConfig,
160
+ TopicSearchFilters,
161
+ UseSearchFilterOptions,
130
162
  UseFetchFunction,
131
163
  AccessType,
132
164
  AccessAudience,
@@ -168,7 +200,6 @@ export type {
168
200
  Owned,
169
201
  OwnedWithFullObject,
170
202
  OwnedWithId,
171
- Page,
172
203
  PageBloc,
173
204
  ContentBloc,
174
205
  BlocWithTitle,
@@ -197,6 +228,7 @@ export type {
197
228
  ResourceType,
198
229
  ReuseReference,
199
230
  Reuse,
231
+ ReuseV2,
200
232
  ReuseTopic,
201
233
  ReuseType,
202
234
  Schema,
@@ -218,6 +250,27 @@ export type {
218
250
  ValidataError,
219
251
  Weight,
220
252
  WellType,
253
+ Chart,
254
+ ChartForm,
255
+ ChartForApi,
256
+ CombinedSort,
257
+ ColumnDefinition,
258
+ ColumnType,
259
+ ColumnsDefinition,
260
+ FilterCondition,
261
+ Filter,
262
+ AndFilters,
263
+ GenericFilter,
264
+ XAxisType,
265
+ XAxisSortBy,
266
+ SortDirection,
267
+ XAxis,
268
+ XAxisForm,
269
+ UnitPosition,
270
+ YAxis,
271
+ DataSeriesType,
272
+ DataSeries,
273
+ DataSeriesForm,
221
274
  }
222
275
 
223
276
  export {
@@ -225,16 +278,43 @@ export {
225
278
  getDefaultDataserviceConfig,
226
279
  getDefaultReuseConfig,
227
280
  getDefaultOrganizationConfig,
281
+ getDefaultTopicConfig,
228
282
  getDefaultGlobalSearchConfig,
229
283
  defaultDatasetSortOptions,
230
284
  defaultDataserviceSortOptions,
231
285
  defaultReuseSortOptions,
232
286
  defaultOrganizationSortOptions,
287
+ useSearchFilter,
233
288
  }
234
289
 
235
290
  // Vue Plugin
236
291
  const datagouv: Plugin<PluginConfig> = {
237
292
  async install(app: App, options) {
293
+ // Default `$fetch` to an ofetch instance carrying the datagouv API specifics + the consumer's
294
+ // auth hooks, so everything downstream (the default `useFetch`, imperative helpers) can rely on
295
+ // a single configured fetch. A consumer that provides its own `$fetch` keeps full control.
296
+ if (!options.$fetch) {
297
+ options.$fetch = ofetch.create({
298
+ baseURL: options.apiBase,
299
+ onRequest(context) {
300
+ if (options.onRequest) {
301
+ if (Array.isArray(options.onRequest)) options.onRequest.forEach(hook => hook(context))
302
+ else options.onRequest(context)
303
+ }
304
+ context.options.headers.set('Content-Type', 'application/json')
305
+ context.options.headers.set('Accept', 'application/json')
306
+ if (options.devApiKey) context.options.headers.set('X-API-KEY', options.devApiKey)
307
+ const { locale } = useTranslation()
308
+ if (locale) {
309
+ context.options.params ??= {}
310
+ context.options.params['lang'] = locale
311
+ }
312
+ },
313
+ onRequestError: options.onRequestError,
314
+ onResponse: options.onResponse,
315
+ onResponseError: options.onResponseError,
316
+ })
317
+ }
238
318
  app.provide(configKey, options)
239
319
  if (!options.textClamp) {
240
320
  const textClamp = await import('vue3-text-clamp')
@@ -256,6 +336,9 @@ export {
256
336
  CopyButton,
257
337
  DataserviceCard,
258
338
  DatasetCard,
339
+ DataStructure,
340
+ Downloads,
341
+ Metadata,
259
342
  DatasetInformationSection,
260
343
  DatasetTemporalitySection,
261
344
  DatasetSpatialSection,
@@ -295,15 +378,16 @@ export {
295
378
  ResourceExplorer,
296
379
  ResourceExplorerSidebar,
297
380
  ResourceExplorerViewer,
381
+ ObjectCardOwner,
298
382
  ResourceIcon,
383
+ ResourceSelector,
299
384
  ReuseCard,
300
385
  ReuseDetails,
301
386
  ReuseHorizontalCard,
302
387
  SchemaCard,
303
388
  SimpleBanner,
304
- SmallChart,
305
389
  StatBox,
306
- Swagger,
390
+ OpenApiViewer,
307
391
  Tab,
308
392
  TabGroup,
309
393
  TabList,
@@ -318,4 +402,7 @@ export {
318
402
  SearchInput,
319
403
  SearchableSelect,
320
404
  SelectGroup,
405
+ Listbox,
406
+ InfiniteLoader,
407
+ TabularExplorer,
321
408
  }
@@ -24,6 +24,7 @@ export type BaseDataservice = Owned & WithAccessType & {
24
24
  license: string | null
25
25
  private: boolean
26
26
  rate_limiting: string
27
+ rate_limiting_url: string | null
27
28
  title: DataserviceReference['title']
28
29
  contact_points: Array<ContactPoint>
29
30
  }
@@ -65,6 +66,7 @@ export type Dataservice = Owned & WithAccessType & {
65
66
  permissions: { edit: boolean, delete: boolean }
66
67
  private: boolean
67
68
  rate_limiting: string
69
+ rate_limiting_url: string | null
68
70
  self_api_url: DataserviceReference['self_api_url']
69
71
  self_web_url: DataserviceReference['self_web_url']
70
72
  slug: string
@@ -1,5 +1,6 @@
1
1
  import type { User } from './users'
2
2
  import type { Badges } from './badges'
3
+ import type { PageBloc } from './pages'
3
4
 
4
5
  export type MemberRole = 'admin' | 'editor' | 'partial_editor'
5
6
 
@@ -68,4 +69,13 @@ export type Organization = {
68
69
  reuses_by_months: Record<string, number>
69
70
  views: number
70
71
  }
72
+ // Editorial blocs powering the organization "Présentation" tab. Excluded from
73
+ // the default API read mask, so only present when requested with X-Fields.
74
+ // Read through the API's `public_presentation_blocs`: hidden from the public until
75
+ // published, but always returned to organization administrators.
76
+ presentation_blocs?: Array<PageBloc>
77
+ // Publication date of the blocs. `null` means draft (never public); a set date
78
+ // means published. Like `presentation_blocs`, only present when requested with
79
+ // X-Fields.
80
+ presentation_blocs_published_at?: string | null
71
81
  }
@@ -2,11 +2,6 @@ import type { DatasetV2 } from './datasets'
2
2
  import type { Dataservice } from './dataservices'
3
3
  import type { Reuse } from './reuses'
4
4
 
5
- export type Page = {
6
- id: string
7
- blocs: Array<PageBloc>
8
- }
9
-
10
5
  export type BlocWithTitle = {
11
6
  title: string
12
7
  subtitle: string | null
@@ -1,12 +1,12 @@
1
1
  import type { Dataset } from './datasets'
2
- import type { Page } from './pages'
2
+ import type { PageBloc } from './pages'
3
3
  import type { Reuse } from './reuses'
4
4
  import type { User } from './users'
5
5
 
6
6
  export type Post = {
7
7
  body_type: 'markdown' | 'html' | 'blocs'
8
+ blocs: Array<PageBloc>
8
9
  content: string
9
- content_as_page: Page | null
10
10
  created_at: string
11
11
  credit_to: string
12
12
  credit_url: string
@@ -1,7 +1,7 @@
1
1
  import type { User } from './users'
2
2
 
3
3
  export type ReportSubject = {
4
- class: 'Discussion' | 'Dataservice' | 'Dataset' | 'Organization' | 'Reuse'
4
+ class: 'Discussion' | 'Dataservice' | 'Dataset' | 'Organization' | 'Reuse' | 'User'
5
5
  id: string
6
6
  }
7
7
 
@@ -16,11 +16,15 @@ export type Report = {
16
16
  id: string
17
17
  by: User | null
18
18
  subject: ReportSubject | null
19
+ subject_embed_id: string | null
19
20
  reason: ReportReasonValue
20
21
  message: string
21
22
  reported_at: string
22
23
  self_api_url: string
23
24
  subject_deleted_at: string | null
25
+ subject_deleted_by: User | null
26
+ subject_label: string | null
24
27
  dismissed_at: string | null
25
28
  dismissed_by: User | null
29
+ callbacks_count: number
26
30
  }
@@ -46,7 +46,6 @@ export type OgcLayerInfo = { name: string, default_crs: string | null }
46
46
 
47
47
  export type WfsMetadata = {
48
48
  format: string
49
- layers: Array<OgcLayerInfo>
50
49
  version: string
51
50
  detected_layer: OgcLayerInfo | null
52
51
  output_formats: Array<string>
@@ -1,5 +1,5 @@
1
1
  import type { Owned, OwnedWithId } from './owned'
2
- import type { Dataset } from './datasets'
2
+ import type { Dataset, Rel } from './datasets'
3
3
  import type { Badges } from './badges'
4
4
  import type { Dataservice } from './dataservices'
5
5
 
@@ -51,6 +51,17 @@ export type Reuse = BaseReuse & {
51
51
  permissions: { edit: boolean, delete: boolean }
52
52
  }
53
53
 
54
+ /**
55
+ * Lightweight reuse returned by the listing endpoints (`/api/2/reuses/` and
56
+ * `/api/2/reuses/search/`): the `datasets` and `dataservices` reference lists
57
+ * are replaced by links to their respective listing endpoints filtered on this
58
+ * reuse, so that listing reuses does not dereference every linked dataset.
59
+ */
60
+ export type ReuseV2 = Owned & Omit<Reuse, 'datasets' | 'dataservices'> & {
61
+ datasets: Rel
62
+ dataservices: Rel
63
+ }
64
+
54
65
  export type ReuseType = {
55
66
  id: string
56
67
  label: string
@@ -1,5 +1,11 @@
1
+ import type { Component } from 'vue'
1
2
  import type { PaginatedArray } from './api'
2
3
  import type { AccessType } from './access_types'
4
+ import type { Dataset } from './datasets'
5
+ import type { Dataservice } from './dataservices'
6
+ import type { Organization } from './organizations'
7
+ import type { ReuseV2 } from './reuses'
8
+ import type { TopicV2 } from './topics'
3
9
  import type {
4
10
  CERTIFIED,
5
11
  PUBLIC_SERVICE,
@@ -291,46 +297,86 @@ export type SortOption<Sort extends string> = {
291
297
 
292
298
  export type DatasetSearchConfig = {
293
299
  class: 'datasets'
300
+ key?: string
294
301
  name?: string
302
+ icon?: Component | string
303
+ placeholder?: string | null
295
304
  hiddenFilters?: HiddenFilter<DatasetSearchFilters>[]
296
305
  basicFilters?: (keyof DatasetSearchFilters)[]
297
306
  advancedFilters?: (keyof DatasetSearchFilters)[]
298
307
  sortOptions?: SortOption<DatasetSearchSort>[]
308
+ defaultSort?: DatasetSearchSort
299
309
  }
300
310
 
301
311
  export type DataserviceSearchConfig = {
302
312
  class: 'dataservices'
313
+ key?: string
303
314
  name?: string
315
+ icon?: Component | string
316
+ placeholder?: string | null
304
317
  hiddenFilters?: HiddenFilter<DataserviceSearchFilters>[]
305
318
  basicFilters?: (keyof DataserviceSearchFilters)[]
306
319
  advancedFilters?: (keyof DataserviceSearchFilters)[]
307
320
  sortOptions?: SortOption<DataserviceSearchSort>[]
321
+ defaultSort?: DataserviceSearchSort
308
322
  }
309
323
 
310
324
  export type ReuseSearchConfig = {
311
325
  class: 'reuses'
326
+ key?: string
312
327
  name?: string
328
+ icon?: Component | string
329
+ placeholder?: string | null
313
330
  hiddenFilters?: HiddenFilter<ReuseSearchFilters>[]
314
331
  basicFilters?: (keyof ReuseSearchFilters)[]
315
332
  advancedFilters?: (keyof ReuseSearchFilters)[]
316
333
  sortOptions?: SortOption<ReuseSearchSort>[]
334
+ defaultSort?: ReuseSearchSort
317
335
  }
318
336
 
319
337
  export type OrganizationSearchConfig = {
320
338
  class: 'organizations'
339
+ key?: string
321
340
  name?: string
341
+ icon?: Component | string
342
+ placeholder?: string | null
322
343
  hiddenFilters?: HiddenFilter<OrganizationSearchFilters>[]
323
344
  basicFilters?: (keyof OrganizationSearchFilters)[]
324
345
  advancedFilters?: (keyof OrganizationSearchFilters)[]
325
346
  sortOptions?: SortOption<OrganizationSearchSort>[]
347
+ defaultSort?: OrganizationSearchSort
326
348
  }
327
349
 
328
- export type SearchTypeConfig = DatasetSearchConfig | DataserviceSearchConfig | ReuseSearchConfig | OrganizationSearchConfig
350
+ export type TopicSearchConfig = {
351
+ class: 'topics'
352
+ key?: string
353
+ name?: string
354
+ icon?: Component | string
355
+ placeholder?: string | null
356
+ hiddenFilters?: HiddenFilter<TopicSearchFilters>[]
357
+ basicFilters?: (keyof TopicSearchFilters)[]
358
+ advancedFilters?: (keyof TopicSearchFilters)[]
359
+ sortOptions?: SortOption<TopicSearchSort>[]
360
+ defaultSort?: TopicSearchSort
361
+ }
362
+
363
+ export type SearchTypeConfig = DatasetSearchConfig | DataserviceSearchConfig | ReuseSearchConfig | OrganizationSearchConfig | TopicSearchConfig
364
+
365
+ export type BuiltInFilterKey = keyof DatasetSearchFilters | keyof DataserviceSearchFilters | keyof ReuseSearchFilters | keyof OrganizationSearchFilters | keyof TopicSearchFilters
329
366
 
330
367
  export type SearchType = SearchTypeConfig['class']
331
368
 
332
369
  export type GlobalSearchConfig = SearchTypeConfig[]
333
370
 
371
+ // Maps each search class to its concrete response shape.
372
+ export type SearchResponseByClass = {
373
+ datasets: DatasetSearchResponse<Dataset>
374
+ dataservices: DataserviceSearchResponse<Dataservice>
375
+ reuses: ReuseSearchResponse<ReuseV2>
376
+ organizations: OrganizationSearchResponse<Organization>
377
+ topics: TopicSearchResponse<TopicV2>
378
+ }
379
+
334
380
  // Helper functions for default configs
335
381
 
336
382
  export const defaultDatasetSortOptions: SortOption<DatasetSearchSort>[] = [
@@ -397,11 +443,27 @@ export function getDefaultOrganizationConfig(overrides?: Partial<Omit<Organizati
397
443
  }
398
444
  }
399
445
 
446
+ export const defaultTopicSortOptions: SortOption<TopicSearchSort>[] = [
447
+ { value: '-created', label: 'Date de création' },
448
+ { value: '-last_modified', label: 'Dernière mise à jour' },
449
+ ]
450
+
451
+ export function getDefaultTopicConfig(overrides?: Partial<Omit<TopicSearchConfig, 'class'>>): TopicSearchConfig {
452
+ return {
453
+ class: 'topics',
454
+ basicFilters: ['last_update_range', 'producer_type'],
455
+ advancedFilters: ['organization', 'tag'],
456
+ sortOptions: defaultTopicSortOptions,
457
+ ...overrides,
458
+ }
459
+ }
460
+
400
461
  export function getDefaultGlobalSearchConfig(): GlobalSearchConfig {
401
462
  return [
402
463
  getDefaultDatasetConfig(),
403
464
  getDefaultDataserviceConfig(),
404
465
  getDefaultReuseConfig(),
405
466
  getDefaultOrganizationConfig(),
467
+ getDefaultTopicConfig(),
406
468
  ]
407
469
  }
package/src/types/site.ts CHANGED
@@ -1,9 +1,11 @@
1
+ import type { PageBloc } from './pages'
2
+
1
3
  export type Site = {
2
4
  id: string
3
5
  title: string
4
- datasets_page: string | null
5
- reuses_page: string | null
6
- dataservices_page: string | null
6
+ datasets_blocs: Array<PageBloc>
7
+ reuses_blocs: Array<PageBloc>
8
+ dataservices_blocs: Array<PageBloc>
7
9
  version: string
8
10
  metrics: {
9
11
  'dataservices': number
package/src/types/ui.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  export type WellType = 'primary' | 'secondary'
2
2
 
3
3
  export type Weight = 'light' | 'regular' | 'semi-bold' | 'bold' | 'heavy'
4
+
5
+ export type TitleTag = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p'
@@ -21,13 +21,14 @@ export type User = {
21
21
  page: UserReference['page']
22
22
  avatar: UserReference['avatar']
23
23
  avatar_thumbnail: UserReference['avatar_thumbnail']
24
- apikey?: string
25
24
  email?: string
26
25
  about: string
27
26
  website?: string
28
27
  roles?: Array<string>
29
28
  organizations: Array<OrganizationReference>
30
29
  last_login_at: string | null
30
+ password_rotation_demanded: string | null
31
+ password_rotation_performed: string | null
31
32
  since: string | null
32
33
  metrics: {
33
34
  datasets: number
@@ -0,0 +1,93 @@
1
+ import type { TabularAggregateType } from '../functions/tabularApi'
2
+ import type { Owned, OwnedWithId } from './owned'
3
+ import type { ColumnType } from '../components/TabularExplorer/types'
4
+
5
+ export type FilterCondition = 'exact' | 'differs' | 'is_null' | 'is_not_null' | 'greater' | 'less' | 'strictly_greater' | 'strictly_less'
6
+ export type Filter = {
7
+ _cls: 'Filter'
8
+ column: string
9
+ condition: FilterCondition
10
+ value: string | null
11
+ }
12
+
13
+ export type AndFilters = {
14
+ _cls: 'AndFilters'
15
+ filters: Array<Filter | AndFilters>
16
+ }
17
+
18
+ export type GenericFilter = Filter | AndFilters
19
+
20
+ export type XAxisType = 'discrete' | 'continuous'
21
+
22
+ export type XAxisSortBy = 'axis_x' | 'axis_y'
23
+
24
+ export type SortDirection = 'asc' | 'desc'
25
+
26
+ export type XAxis = {
27
+ column_x: string
28
+ sort_x_by: XAxisSortBy | null
29
+ sort_x_direction: SortDirection | null
30
+ type: XAxisType
31
+ }
32
+
33
+ export type CombinedSort = '' | 'axis_x-asc' | 'axis_x-desc' | 'axis_y-asc' | 'axis_y-desc'
34
+
35
+ export type XAxisForm = Omit<XAxis, 'sort_x_by' | 'sort_x_direction'> & { sort_combined: CombinedSort }
36
+
37
+ export type UnitPosition = 'prefix' | 'suffix'
38
+
39
+ export type YAxis = {
40
+ min: number | null
41
+ max: number | null
42
+ label: string | null
43
+ unit: string | null
44
+ unit_position: UnitPosition | null
45
+ }
46
+
47
+ export type DataSeriesType = 'line' | 'histogram'
48
+
49
+ export type DataSeries = {
50
+ type: DataSeriesType
51
+ column_y: string
52
+ aggregate_y: TabularAggregateType | null
53
+ resource_id: string
54
+ column_x_name_override: string | null
55
+ filters: GenericFilter | null
56
+ }
57
+
58
+ // Type for form where aggregate_y can be empty string for select binding
59
+ export type DataSeriesForm = Omit<DataSeries, 'aggregate_y'> & { aggregate_y: TabularAggregateType | '' | null }
60
+
61
+ export type Chart = Owned & {
62
+ id: string
63
+ title: string
64
+ slug: string
65
+ description: string
66
+ private: boolean
67
+ created_at: string
68
+ last_modified: string
69
+ deleted_at: string | null
70
+ uri: string
71
+ page: string
72
+ x_axis: XAxis
73
+ y_axis: YAxis
74
+ series: Array<DataSeries>
75
+ extras: Record<string, unknown>
76
+ permissions: { delete: boolean, edit: boolean, read: boolean }
77
+ metrics: {
78
+ views: number
79
+ }
80
+ }
81
+
82
+ export type ChartForApi = OwnedWithId & Pick<Chart, 'title' | 'description' | 'private' | 'x_axis' | 'y_axis' | 'series' | 'extras'>
83
+
84
+ export type ChartForm = Omit<ChartForApi, 'x_axis' | 'series' | 'owner' | 'organization'> & {
85
+ owned: OwnedWithId
86
+ x_axis: XAxisForm
87
+ series: Array<DataSeriesForm>
88
+ chart_type?: DataSeriesType | null
89
+ filter: GenericFilter | null
90
+ }
91
+
92
+ export type ColumnDefinition = { name: string, type: ColumnType }
93
+ export type ColumnsDefinition = Record<string, Array<ColumnDefinition>>