@datagouv/components-next 0.0.7 → 0.0.9
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/README.md +34 -14
- package/assets/json/vector.json +2377 -0
- package/assets/main.css +3 -0
- package/assets/swagger-themes/newspaper.css +1669 -0
- package/assets/tailwind.config.js +1 -1
- package/dist/JsonPreview.client-BIz1_EiB.js +92 -0
- package/dist/MapContainer.client-ZDwr4Q_I.js +78276 -0
- package/dist/PdfPreview.client-BTTMM27i.js +112 -0
- package/dist/Pmtiles.client-4kOoUQcR.js +22377 -0
- package/dist/Swagger.client-Q7a5wb51.js +4 -0
- package/dist/XmlPreview.client-BYIIkDqf.js +84 -0
- package/dist/components-next.css +52 -1
- package/dist/components-next.js +42 -41
- package/dist/components.css +1 -1
- package/dist/main-CLUk9Jj7.js +105843 -0
- package/dist/pdf-vue3-BZh6kzke.js +273 -0
- package/dist/pdf.min-f72cfa08-DAetWL3M.js +9501 -0
- package/dist/{text-clamp.esm-DurZFOvT.js → text-clamp.esm-DP59tec5.js} +1 -1
- package/dist/vue3-json-viewer-DIQzFF6K.js +1089 -0
- package/dist/vue3-xml-viewer.common-BmKw6vER.js +5437 -0
- package/package.json +7 -5
- package/src/components/AvatarWithName.vue +6 -2
- package/src/components/BannerAction.vue +1 -1
- package/src/components/BrandedButton.vue +13 -8
- package/src/components/CopyButton.vue +7 -7
- package/src/components/DataserviceCard.vue +54 -23
- package/src/components/DatasetCard.vue +36 -24
- package/src/components/DatasetInformationPanel.vue +19 -18
- package/src/components/DatasetQuality.vue +21 -18
- package/src/components/DatasetQualityInline.vue +1 -1
- package/src/components/DatasetQualityItem.vue +3 -3
- package/src/components/DatasetQualityItemWarning.vue +2 -2
- package/src/components/DatasetQualityScore.vue +2 -2
- package/src/components/DatasetQualityTooltipContent.vue +29 -29
- package/src/components/DescriptionDetails.vue +2 -2
- package/src/components/ExtraAccordion.vue +10 -7
- package/src/components/OrganizationCard.vue +9 -4
- package/src/components/OrganizationNameWithCertificate.vue +25 -11
- package/src/components/Pagination.vue +26 -15
- package/src/components/ReadMore.vue +2 -2
- package/src/components/ResourceAccordion/DataStructure.vue +2 -2
- package/src/components/ResourceAccordion/EditButton.vue +10 -6
- package/src/components/ResourceAccordion/JsonPreview.client.vue +153 -0
- package/src/components/ResourceAccordion/MapContainer.client.vue +137 -0
- package/src/components/ResourceAccordion/Metadata.vue +33 -54
- package/src/components/ResourceAccordion/PdfPreview.client.vue +189 -0
- package/src/components/ResourceAccordion/Pmtiles.client.vue +166 -0
- package/src/components/ResourceAccordion/Preview.vue +39 -37
- package/src/components/ResourceAccordion/ResourceAccordion.vue +141 -63
- package/src/components/ResourceAccordion/ResourceIcon.vue +7 -1
- package/src/components/ResourceAccordion/SchemaBadge.vue +26 -26
- package/src/components/ResourceAccordion/{Swagger.vue → Swagger.client.vue} +1 -1
- package/src/components/ResourceAccordion/XmlPreview.client.vue +143 -0
- package/src/components/ReuseCard.vue +10 -7
- package/src/components/ReuseDetails.vue +3 -3
- package/src/components/SimpleBanner.vue +7 -4
- package/src/components/SmallChart.vue +23 -9
- package/src/components/StatBox.vue +92 -10
- package/src/config.ts +6 -2
- package/src/functions/api.ts +18 -18
- package/src/functions/dates.ts +81 -74
- package/src/functions/helpers.ts +5 -4
- package/src/functions/organizations.ts +5 -5
- package/src/functions/resources.ts +34 -5
- package/src/functions/schemas.ts +4 -3
- package/src/functions/tabularApi.ts +1 -1
- package/src/main.ts +10 -11
- package/src/types/badges.ts +3 -3
- package/src/types/contact_point.ts +5 -5
- package/src/types/dataservices.ts +16 -2
- package/src/types/datasets.ts +20 -2
- package/src/types/frequency.ts +5 -5
- package/src/types/granularity.ts +12 -4
- package/src/types/harvest.ts +2 -2
- package/src/types/licenses.ts +8 -8
- package/src/types/organizations.ts +6 -0
- package/src/types/resources.ts +3 -3
- package/src/types/reuses.ts +3 -1
- package/src/types/site.ts +8 -0
- package/src/types/ui.ts +2 -2
- package/src/types/users.ts +24 -8
- package/src/types/vue3-xml-viewer.d.ts +10 -0
- package/dist/Swagger-DjysB-OI.js +0 -67851
- package/dist/en-DCRve7vN.js +0 -613
- package/dist/fr-DCOnbL-p.js +0 -613
- package/dist/locales/de.js +0 -155
- package/dist/locales/en.js +0 -155
- package/dist/locales/es.js +0 -155
- package/dist/locales/fr.js +0 -155
- package/dist/locales/it.js +0 -155
- package/dist/locales/pt.js +0 -155
- package/dist/locales/sr.js +0 -155
- package/dist/main-CPW2vNLE.js +0 -32008
- package/src/components/DescriptionList/DescriptionDetails.stories.ts +0 -43
- package/src/components/DescriptionList/DescriptionList.stories.ts +0 -47
- package/src/components/DescriptionList/DescriptionTerm.stories.ts +0 -28
- package/src/locales/de.json +0 -154
- package/src/locales/en.json +0 -154
- package/src/locales/es.json +0 -154
- package/src/locales/fr.json +0 -154
- package/src/locales/it.json +0 -154
- package/src/locales/pt.json +0 -154
- package/src/locales/sr.json +0 -154
package/src/functions/dates.ts
CHANGED
|
@@ -2,84 +2,91 @@ import { useI18n } from 'vue-i18n'
|
|
|
2
2
|
|
|
3
3
|
const SECONDS_IN_A_DAY = 3600 * 24
|
|
4
4
|
|
|
5
|
-
export function
|
|
6
|
-
|
|
7
|
-
return ''
|
|
8
|
-
}
|
|
9
|
-
date = new Date(date)
|
|
10
|
-
if (!('dateStyle' in options)) {
|
|
11
|
-
options.dateStyle = 'long'
|
|
12
|
-
}
|
|
13
|
-
const { locale } = useI18n()
|
|
14
|
-
return new Intl.DateTimeFormat(locale.value, options).format(date)
|
|
15
|
-
}
|
|
5
|
+
export function useFormatDate() {
|
|
6
|
+
const { t, locale } = useI18n()
|
|
16
7
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
8
|
+
const formatDate = (date: Date | string | null, options: Intl.DateTimeFormatOptions = {}) => {
|
|
9
|
+
if (!date) {
|
|
10
|
+
return ''
|
|
11
|
+
}
|
|
12
|
+
date = new Date(date)
|
|
13
|
+
if (!('dateStyle' in options)) {
|
|
14
|
+
options.dateStyle = 'long'
|
|
15
|
+
}
|
|
16
|
+
return new Intl.DateTimeFormat(locale.value, options).format(date)
|
|
24
17
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Format date as relative from now.
|
|
21
|
+
* It displays "today" or Intl.RelativeTimeFormat content, based on date.
|
|
22
|
+
*/
|
|
23
|
+
const formatFromNow = (date: Date | string | null) => {
|
|
24
|
+
if (!date) {
|
|
25
|
+
return ''
|
|
26
|
+
}
|
|
27
|
+
if (!('RelativeTimeFormat' in Intl)) {
|
|
28
|
+
return t('le {date}', { date: formatDate(date) })
|
|
29
|
+
}
|
|
30
|
+
const today = new Date()
|
|
31
|
+
today.setHours(0)
|
|
32
|
+
today.setMinutes(0)
|
|
33
|
+
today.setSeconds(0)
|
|
34
|
+
const dateWithoutTime = new Date(date)
|
|
35
|
+
dateWithoutTime.setHours(0)
|
|
36
|
+
dateWithoutTime.setMinutes(0)
|
|
37
|
+
dateWithoutTime.setSeconds(0)
|
|
38
|
+
// Get the diff in second between today and the provided date
|
|
39
|
+
const diff = Math.round((dateWithoutTime.getTime() - today.getTime()) / 1000)
|
|
40
|
+
const units: Array<{ unit: Intl.RelativeTimeFormatUnit, seconds: number, changeAfter: number }> = [
|
|
41
|
+
{
|
|
42
|
+
unit: 'day',
|
|
43
|
+
seconds: SECONDS_IN_A_DAY,
|
|
44
|
+
changeAfter: 30,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
unit: 'month',
|
|
48
|
+
seconds: SECONDS_IN_A_DAY * 30,
|
|
49
|
+
changeAfter: 12,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
unit: 'year',
|
|
53
|
+
seconds: SECONDS_IN_A_DAY * 365,
|
|
54
|
+
changeAfter: Infinity,
|
|
55
|
+
},
|
|
56
|
+
]
|
|
57
|
+
const correctUnit = units.find((unit) => {
|
|
58
|
+
const diffInUnit = Math.abs(diff / unit.seconds)
|
|
59
|
+
return diffInUnit < unit.changeAfter
|
|
60
|
+
})!
|
|
61
|
+
return new Intl.RelativeTimeFormat(locale.value, { numeric: 'auto' }).format(Math.round(diff / correctUnit?.seconds), correctUnit?.unit)
|
|
28
62
|
}
|
|
29
|
-
const today = new Date()
|
|
30
|
-
today.setHours(0)
|
|
31
|
-
today.setMinutes(0)
|
|
32
|
-
today.setSeconds(0)
|
|
33
|
-
const dateWithoutTime = new Date(date)
|
|
34
|
-
dateWithoutTime.setHours(0)
|
|
35
|
-
dateWithoutTime.setMinutes(0)
|
|
36
|
-
dateWithoutTime.setSeconds(0)
|
|
37
|
-
// Get the diff in second between today and the provided date
|
|
38
|
-
const diff = Math.round((dateWithoutTime.getTime() - today.getTime()) / 1000)
|
|
39
|
-
const units: Array<{ unit: Intl.RelativeTimeFormatUnit, seconds: number, changeAfter: number }> = [
|
|
40
|
-
{
|
|
41
|
-
unit: 'day',
|
|
42
|
-
seconds: SECONDS_IN_A_DAY,
|
|
43
|
-
changeAfter: 30,
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
unit: 'month',
|
|
47
|
-
seconds: SECONDS_IN_A_DAY * 30,
|
|
48
|
-
changeAfter: 12,
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
unit: 'year',
|
|
52
|
-
seconds: SECONDS_IN_A_DAY * 365,
|
|
53
|
-
changeAfter: Infinity,
|
|
54
|
-
},
|
|
55
|
-
]
|
|
56
|
-
const correctUnit = units.find((unit) => {
|
|
57
|
-
const diffInUnit = Math.abs(diff / unit.seconds)
|
|
58
|
-
return diffInUnit < unit.changeAfter
|
|
59
|
-
})!
|
|
60
|
-
return new Intl.RelativeTimeFormat(locale.value, { numeric: 'auto' }).format(Math.round(diff / correctUnit?.seconds), correctUnit?.unit)
|
|
61
|
-
}
|
|
62
63
|
|
|
63
|
-
/**
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Format date relative form now if date is less than a month ago.
|
|
66
|
+
* Otherwise, show a formatted date.
|
|
67
|
+
*/
|
|
68
|
+
const formatRelativeIfRecentDate = (date: Date | string | null, options: Intl.DateTimeFormatOptions = {}) => {
|
|
69
|
+
if (!date) {
|
|
70
|
+
return ''
|
|
71
|
+
}
|
|
72
|
+
const today = new Date()
|
|
73
|
+
today.setHours(0)
|
|
74
|
+
today.setMinutes(0)
|
|
75
|
+
today.setSeconds(0)
|
|
76
|
+
const dateWithoutTime = new Date(date)
|
|
77
|
+
dateWithoutTime.setHours(0)
|
|
78
|
+
dateWithoutTime.setMinutes(0)
|
|
79
|
+
dateWithoutTime.setSeconds(0)
|
|
80
|
+
const diff = Math.abs(dateWithoutTime.getTime() - today.getTime())
|
|
81
|
+
if (Math.round(diff / (SECONDS_IN_A_DAY * 30)) >= 1) {
|
|
82
|
+
return t('le {date}', { date: formatDate(date, options) })
|
|
83
|
+
}
|
|
84
|
+
return formatFromNow(date)
|
|
70
85
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const dateWithoutTime = new Date(date)
|
|
77
|
-
dateWithoutTime.setHours(0)
|
|
78
|
-
dateWithoutTime.setMinutes(0)
|
|
79
|
-
dateWithoutTime.setSeconds(0)
|
|
80
|
-
const diff = Math.abs(dateWithoutTime.getTime() - today.getTime())
|
|
81
|
-
if (Math.round(diff / (SECONDS_IN_A_DAY * 30)) >= 1) {
|
|
82
|
-
return t('on {date}', { date: formatDate(date, options) })
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
formatDate,
|
|
89
|
+
formatFromNow,
|
|
90
|
+
formatRelativeIfRecentDate,
|
|
83
91
|
}
|
|
84
|
-
return formatFromNow(date)
|
|
85
92
|
}
|
package/src/functions/helpers.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { useI18n } from 'vue-i18n'
|
|
2
2
|
|
|
3
3
|
export const filesize = (val: number) => {
|
|
4
|
-
const { t } = useI18n()
|
|
5
|
-
const suffix = t('
|
|
4
|
+
const { t, locale } = useI18n()
|
|
5
|
+
const suffix = t('o')
|
|
6
|
+
const formatter = new Intl.NumberFormat(locale.value, { minimumFractionDigits: 1, maximumFractionDigits: 1 })
|
|
6
7
|
const units = ['', 'K', 'M', 'G', 'T', 'P', 'E', 'Z']
|
|
7
8
|
for (const unit of units) {
|
|
8
9
|
if (Math.abs(val) < 1024.0) {
|
|
9
|
-
return `${
|
|
10
|
+
return `${formatter.format(val)} ${unit}${suffix}`.trim()
|
|
10
11
|
}
|
|
11
12
|
val /= 1024.0
|
|
12
13
|
}
|
|
13
|
-
return `${
|
|
14
|
+
return `${formatter.format(val)} Y${suffix}`.trim()
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
export const summarize = (val: number, fractionDigits = 0) => {
|
|
@@ -27,12 +27,12 @@ export function getOrganizationTypes(): Array<{ type: OrganizationTypes | UserTy
|
|
|
27
27
|
const { t } = useI18n()
|
|
28
28
|
return [{
|
|
29
29
|
type: PUBLIC_SERVICE,
|
|
30
|
-
label: t('
|
|
30
|
+
label: t('Service public'),
|
|
31
31
|
icon: RiBankLine,
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
type: LOCAL_AUTHORITY,
|
|
35
|
-
label: t('
|
|
35
|
+
label: t('Collectivité territoriale'),
|
|
36
36
|
icon: RiGovernmentLine,
|
|
37
37
|
},
|
|
38
38
|
{
|
|
@@ -42,17 +42,17 @@ export function getOrganizationTypes(): Array<{ type: OrganizationTypes | UserTy
|
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
type: COMPANY,
|
|
45
|
-
label: t('
|
|
45
|
+
label: t('Entreprise'),
|
|
46
46
|
icon: RiBuilding2Line,
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
49
|
type: OTHER,
|
|
50
|
-
label: t('
|
|
50
|
+
label: t('Autre'),
|
|
51
51
|
icon: null,
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
type: USER,
|
|
55
|
-
label: t('
|
|
55
|
+
label: t('Utilisateur'),
|
|
56
56
|
icon: RiUserLine,
|
|
57
57
|
}]
|
|
58
58
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readonly, type Component } from 'vue'
|
|
2
2
|
|
|
3
3
|
import { useI18n } from 'vue-i18n'
|
|
4
|
+
import { RiEarthLine, RiMap2Line } from '@remixicon/vue'
|
|
4
5
|
import Archive from '../components/Icons/Archive.vue'
|
|
5
6
|
import Code from '../components/Icons/Code.vue'
|
|
6
7
|
import Documentation from '../components/Icons/Documentation.vue'
|
|
@@ -29,7 +30,6 @@ export function getResourceFormatIcon(format: string): Component | null {
|
|
|
29
30
|
case 'gpx':
|
|
30
31
|
case 'shx':
|
|
31
32
|
case 'ovr':
|
|
32
|
-
case 'geojson':
|
|
33
33
|
case 'gpkg':
|
|
34
34
|
case 'grib2':
|
|
35
35
|
case 'dbf':
|
|
@@ -63,10 +63,19 @@ export function getResourceFormatIcon(format: string): Component | null {
|
|
|
63
63
|
case 'xls':
|
|
64
64
|
case 'xlsx':
|
|
65
65
|
case 'parquet':
|
|
66
|
+
case 'csv.gz':
|
|
66
67
|
return Table
|
|
68
|
+
case 'geojson':
|
|
69
|
+
return RiMap2Line
|
|
70
|
+
case 'ogc:wfs':
|
|
71
|
+
case 'ogc:wms':
|
|
72
|
+
case 'wfs':
|
|
73
|
+
case 'wms':
|
|
74
|
+
return RiEarthLine
|
|
67
75
|
case 'png':
|
|
68
76
|
case 'jpg':
|
|
69
77
|
case 'jpeg':
|
|
78
|
+
case 'svg':
|
|
70
79
|
return Image
|
|
71
80
|
default:
|
|
72
81
|
return null
|
|
@@ -84,16 +93,36 @@ export const getResourceLabel = (type: ResourceType) => {
|
|
|
84
93
|
const { t } = useI18n()
|
|
85
94
|
switch (type) {
|
|
86
95
|
case 'main':
|
|
87
|
-
return t('
|
|
96
|
+
return t('Fichier principal') // TODO: manage the plural case
|
|
88
97
|
case 'documentation':
|
|
89
98
|
return t('Documentation')
|
|
90
99
|
case 'update':
|
|
91
|
-
return t('
|
|
100
|
+
return t('Mise à jour')
|
|
92
101
|
case 'api':
|
|
93
102
|
return t('API')
|
|
94
103
|
case 'code':
|
|
95
|
-
return t('
|
|
104
|
+
return t('Code source')
|
|
96
105
|
case 'other':
|
|
97
|
-
return t('
|
|
106
|
+
return t('Autre')
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export const OGC_SERVICES_FORMATS = ['wfs', 'wms']
|
|
111
|
+
|
|
112
|
+
export const detectOgcService = (resource: Resource) => {
|
|
113
|
+
// Detect OGC Services either based on format or a URL with GetCapabilities and known REQUEST type
|
|
114
|
+
// Return the format if found else false
|
|
115
|
+
if (resource.format) {
|
|
116
|
+
const format = resource.format.replace(/^ogc:/, '')
|
|
117
|
+
if (OGC_SERVICES_FORMATS.includes(format))
|
|
118
|
+
return format
|
|
119
|
+
}
|
|
120
|
+
const url = resource.url.toLowerCase()
|
|
121
|
+
if (url.includes('request=getcapabilities')) {
|
|
122
|
+
for (const format of OGC_SERVICES_FORMATS)
|
|
123
|
+
if (url.includes(`service=${format}`)) {
|
|
124
|
+
return format
|
|
125
|
+
}
|
|
98
126
|
}
|
|
127
|
+
return false
|
|
99
128
|
}
|
package/src/functions/schemas.ts
CHANGED
|
@@ -27,7 +27,7 @@ export type Schema = {
|
|
|
27
27
|
name?: string | null
|
|
28
28
|
url?: string | null
|
|
29
29
|
version?: string | null
|
|
30
|
-
}
|
|
30
|
+
}
|
|
31
31
|
|
|
32
32
|
export interface ValidataError {
|
|
33
33
|
code: string
|
|
@@ -63,8 +63,9 @@ export async function getCatalog(): Promise<SchemaResponseData> {
|
|
|
63
63
|
})
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
export function findSchemaInCatalog(catalog: Array<RegisteredSchema>, schema: Schema): RegisteredSchema | null {
|
|
67
|
-
|
|
66
|
+
export function findSchemaInCatalog(catalog: Array<RegisteredSchema>, schema: Schema | null): RegisteredSchema | null {
|
|
67
|
+
if (!schema) return null
|
|
68
|
+
return catalog.find(registeredSchema => schema.name === registeredSchema.name) || null
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
export function getSchemaDocumentation(name: string): string {
|
|
@@ -10,7 +10,7 @@ export type SortConfig = {
|
|
|
10
10
|
* Call Tabular-api to get table content
|
|
11
11
|
*/
|
|
12
12
|
export function getData(config: PluginConfig, id: string, page: number, sortConfig?: SortConfig) {
|
|
13
|
-
let url = `${config.tabularApiUrl}/api/resources/${id}/data/?page=${page}&page_size=${config.tabularApiPageSize ||
|
|
13
|
+
let url = `${config.tabularApiUrl}/api/resources/${id}/data/?page=${page}&page_size=${config.tabularApiPageSize || 15}`
|
|
14
14
|
if (sortConfig) {
|
|
15
15
|
url = url + `&${sortConfig.column}__sort=${sortConfig.type}`
|
|
16
16
|
}
|
package/src/main.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { App, Plugin } from 'vue'
|
|
2
2
|
import type { Badge, Badges } from './types/badges'
|
|
3
|
-
import type { Dataset, DatasetV2, NewDataset, Quality, Rel } from './types/datasets'
|
|
4
|
-
import type { NewDataservice, Dataservice } from './types/dataservices'
|
|
3
|
+
import type { Dataset, DatasetV2, DatasetV2WithFullObject, NewDataset, Quality, Rel } from './types/datasets'
|
|
4
|
+
import type { NewDataservice, Dataservice, DataserviceAccessAudience, DataserviceAccessAudienceCondition, DataserviceAccessAudienceType } from './types/dataservices'
|
|
5
5
|
import type { Frequency, Frequencies } from './types/frequency'
|
|
6
|
-
import type { Granularity, Granularities } from './types/granularity'
|
|
6
|
+
import type { Granularity, Granularities, SpatialZone } from './types/granularity'
|
|
7
7
|
import type { Harvest } from './types/harvest'
|
|
8
8
|
import type { License } from './types/licenses'
|
|
9
9
|
import type { Member, MemberRole, NewOrganization, Organization } from './types/organizations'
|
|
@@ -37,6 +37,7 @@ import Placeholder from './components/Placeholder.vue'
|
|
|
37
37
|
import ReadMore from './components/ReadMore.vue'
|
|
38
38
|
import ResourceAccordion from './components/ResourceAccordion/ResourceAccordion.vue'
|
|
39
39
|
import ResourceIcon from './components/ResourceAccordion/ResourceIcon.vue'
|
|
40
|
+
import Swagger from './components/ResourceAccordion/Swagger.client.vue'
|
|
40
41
|
import ReuseCard from './components/ReuseCard.vue'
|
|
41
42
|
import SimpleBanner from './components/SimpleBanner.vue'
|
|
42
43
|
import StatBox from './components/StatBox.vue'
|
|
@@ -63,7 +64,11 @@ export type {
|
|
|
63
64
|
CommunityResource,
|
|
64
65
|
Dataset,
|
|
65
66
|
DatasetV2,
|
|
67
|
+
DatasetV2WithFullObject,
|
|
66
68
|
Dataservice,
|
|
69
|
+
DataserviceAccessAudience,
|
|
70
|
+
DataserviceAccessAudienceCondition,
|
|
71
|
+
DataserviceAccessAudienceType,
|
|
67
72
|
NewDataservice,
|
|
68
73
|
FileResourceFileType,
|
|
69
74
|
Frequency,
|
|
@@ -90,6 +95,7 @@ export type {
|
|
|
90
95
|
ReuseTopic,
|
|
91
96
|
ReuseType,
|
|
92
97
|
Site,
|
|
98
|
+
SpatialZone,
|
|
93
99
|
TopicV2,
|
|
94
100
|
User,
|
|
95
101
|
Weight,
|
|
@@ -104,14 +110,6 @@ const datagouv: Plugin<PluginConfig> = {
|
|
|
104
110
|
options.textClamp = textClamp.default
|
|
105
111
|
}
|
|
106
112
|
|
|
107
|
-
if (options.i18n) {
|
|
108
|
-
const frMessages = await import('../dist/locales/fr.js')
|
|
109
|
-
const enMessages = await import('../dist/locales/en.js')
|
|
110
|
-
|
|
111
|
-
options.i18n.global.mergeLocaleMessage('en', enMessages.default)
|
|
112
|
-
options.i18n.global.mergeLocaleMessage('fr', frMessages.default)
|
|
113
|
-
}
|
|
114
|
-
|
|
115
113
|
app.provide(configKey, options)
|
|
116
114
|
},
|
|
117
115
|
}
|
|
@@ -144,4 +142,5 @@ export {
|
|
|
144
142
|
ReuseCard,
|
|
145
143
|
SimpleBanner,
|
|
146
144
|
StatBox,
|
|
145
|
+
Swagger,
|
|
147
146
|
}
|
package/src/types/badges.ts
CHANGED
|
@@ -29,6 +29,12 @@ export type BaseDataservice = Owned & {
|
|
|
29
29
|
|
|
30
30
|
export type NewDataservice = Omit<BaseDataservice, keyof OwnedWithId> & OwnedWithId
|
|
31
31
|
|
|
32
|
+
export type DataserviceAccessAudienceCondition = 'yes' | 'no' | 'under_condition'
|
|
33
|
+
|
|
34
|
+
export type DataserviceAccessAudienceType = 'local_authority_and_administration' | 'company_and_association' | 'private'
|
|
35
|
+
|
|
36
|
+
export type DataserviceAccessAudience = { role: DataserviceAccessAudienceType, condition: DataserviceAccessAudienceCondition }
|
|
37
|
+
|
|
32
38
|
export type Dataservice = Owned & {
|
|
33
39
|
acronym: string
|
|
34
40
|
archived_at: string | null
|
|
@@ -50,14 +56,22 @@ export type Dataservice = Owned & {
|
|
|
50
56
|
machine_documentation_url: string | null
|
|
51
57
|
technical_documentation_url: string | null
|
|
52
58
|
business_documentation_url: string | null
|
|
53
|
-
extras: Record<string,
|
|
59
|
+
extras: Record<string, unknown>
|
|
54
60
|
format: string
|
|
55
61
|
harvest: Harvest
|
|
56
62
|
id: string
|
|
57
63
|
access_type: 'open' | 'restricted' | 'open_with_account'
|
|
64
|
+
access_audiences: Array<DataserviceAccessAudience>
|
|
58
65
|
license: string | null
|
|
59
66
|
metadata_modified_at: string
|
|
60
|
-
metrics: {
|
|
67
|
+
metrics: {
|
|
68
|
+
discussions: number
|
|
69
|
+
discussions_open: number
|
|
70
|
+
followers: number
|
|
71
|
+
reuses: number
|
|
72
|
+
views: number
|
|
73
|
+
}
|
|
74
|
+
permissions: { edit: boolean, delete: boolean }
|
|
61
75
|
private: boolean
|
|
62
76
|
rate_limiting: string
|
|
63
77
|
self_api_url: string
|
package/src/types/datasets.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import type { GeoJsonObject } from 'geojson'
|
|
1
2
|
import type { Badges } from './badges'
|
|
2
3
|
import type { Harvest } from './harvest'
|
|
3
4
|
import type { Owned, OwnedWithId } from './owned'
|
|
4
5
|
import type { Resource } from './resources'
|
|
5
6
|
import type { ContactPoint } from './contact_point'
|
|
7
|
+
import type { License } from './licenses'
|
|
8
|
+
import type { Frequency } from './frequency'
|
|
9
|
+
import type { Granularity, SpatialZone } from './granularity'
|
|
6
10
|
|
|
7
11
|
export type Quality = {
|
|
8
12
|
all_resources_available: boolean
|
|
@@ -39,9 +43,10 @@ export type BaseDataset = Owned & {
|
|
|
39
43
|
granularity?: string
|
|
40
44
|
} | null
|
|
41
45
|
contact_points: Array<ContactPoint>
|
|
46
|
+
featured: boolean
|
|
42
47
|
}
|
|
43
48
|
|
|
44
|
-
export type NewDataset = Omit<BaseDataset, keyof OwnedWithId> & OwnedWithId
|
|
49
|
+
export type NewDataset = Omit<BaseDataset, keyof OwnedWithId | 'featured'> & OwnedWithId
|
|
45
50
|
|
|
46
51
|
export type Rel = {
|
|
47
52
|
rel: string
|
|
@@ -65,16 +70,29 @@ export type Dataset = BaseDataset & {
|
|
|
65
70
|
quality: Quality
|
|
66
71
|
metrics: {
|
|
67
72
|
discussions: number
|
|
73
|
+
discussions_open: number
|
|
68
74
|
followers: number
|
|
69
75
|
resources_downloads: number
|
|
70
76
|
reuses: number
|
|
71
77
|
views: number
|
|
72
78
|
}
|
|
73
79
|
harvest: Harvest
|
|
74
|
-
extras: Record<string,
|
|
80
|
+
extras: Record<string, unknown>
|
|
81
|
+
permissions: { edit: boolean, edit_resources: boolean, delete: boolean }
|
|
82
|
+
|
|
75
83
|
}
|
|
76
84
|
|
|
77
85
|
export type DatasetV2 = Owned & Omit<Dataset, 'resources' | 'community_resources'> & {
|
|
78
86
|
resources: Rel
|
|
79
87
|
community_resources: Rel
|
|
80
88
|
}
|
|
89
|
+
|
|
90
|
+
export type DatasetV2WithFullObject = Omit<DatasetV2, 'license' | 'frequency' | 'spatial'> & {
|
|
91
|
+
license: License
|
|
92
|
+
frequency: Frequency
|
|
93
|
+
spatial: {
|
|
94
|
+
zones?: Array<SpatialZone>
|
|
95
|
+
granularity?: Granularity
|
|
96
|
+
geom?: GeoJsonObject
|
|
97
|
+
} | null
|
|
98
|
+
}
|
package/src/types/frequency.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type Frequency = {
|
|
2
|
-
id: string
|
|
3
|
-
label: string
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export type Frequencies = Array<Frequency
|
|
2
|
+
id: string
|
|
3
|
+
label: string
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export type Frequencies = Array<Frequency>
|
package/src/types/granularity.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
export type Granularity = {
|
|
2
|
-
id: string
|
|
3
|
-
name: string
|
|
4
|
-
}
|
|
2
|
+
id: string
|
|
3
|
+
name: string
|
|
4
|
+
}
|
|
5
5
|
|
|
6
|
-
export type Granularities = Array<Granularity
|
|
6
|
+
export type Granularities = Array<Granularity>
|
|
7
|
+
|
|
8
|
+
export type SpatialZone = {
|
|
9
|
+
code: string
|
|
10
|
+
id: string
|
|
11
|
+
level: string
|
|
12
|
+
name: string
|
|
13
|
+
uri: string
|
|
14
|
+
}
|
package/src/types/harvest.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export type Harvest = Record<string, any> & {
|
|
2
|
-
backend?: string
|
|
3
|
-
} | null
|
|
2
|
+
backend?: string
|
|
3
|
+
} | null
|
package/src/types/licenses.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export type License = {
|
|
2
|
-
alternate_titles: Array<string
|
|
3
|
-
alternate_urls: Array<string
|
|
4
|
-
flags: Array<string
|
|
5
|
-
id: string
|
|
6
|
-
maintainer: string | null
|
|
7
|
-
title: string
|
|
8
|
-
url: string
|
|
9
|
-
}
|
|
2
|
+
alternate_titles: Array<string>
|
|
3
|
+
alternate_urls: Array<string>
|
|
4
|
+
flags: Array<string>
|
|
5
|
+
id: string
|
|
6
|
+
maintainer: string | null
|
|
7
|
+
title: string
|
|
8
|
+
url: string
|
|
9
|
+
}
|
|
@@ -5,7 +5,9 @@ export type MemberRole = 'admin' | 'editor'
|
|
|
5
5
|
|
|
6
6
|
export type Member = {
|
|
7
7
|
role: MemberRole
|
|
8
|
+
label: string
|
|
8
9
|
user: User
|
|
10
|
+
since: string | null
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
export type NewOrganization = {
|
|
@@ -23,15 +25,19 @@ export type Organization = NewOrganization & {
|
|
|
23
25
|
last_modified: string
|
|
24
26
|
last_update: string
|
|
25
27
|
deleted: string | null
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
29
|
extras: Record<string, any>
|
|
27
30
|
logo_thumbnail: string
|
|
28
31
|
members: Array<Member>
|
|
29
32
|
metrics: {
|
|
30
33
|
dataservices: number
|
|
34
|
+
dataservices_by_months: Record<string, number>
|
|
31
35
|
datasets: number
|
|
36
|
+
datasets_by_months: Record<string, number>
|
|
32
37
|
followers: number
|
|
33
38
|
members: number
|
|
34
39
|
reuses: number
|
|
40
|
+
reuses_by_months: Record<string, number>
|
|
35
41
|
views: number
|
|
36
42
|
}
|
|
37
43
|
page: string
|
package/src/types/resources.ts
CHANGED
|
@@ -28,10 +28,10 @@ export type Resource = {
|
|
|
28
28
|
mime: string
|
|
29
29
|
internal: Record<string, unknown>
|
|
30
30
|
last_modified: string
|
|
31
|
-
latest: string
|
|
31
|
+
latest: string // permalien stable
|
|
32
32
|
preview_url: string
|
|
33
|
-
schema: Schema
|
|
33
|
+
schema: Schema | null
|
|
34
34
|
url: string
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
export type CommunityResource = Owned & Resource & { dataset: Omit<Dataset, 'resources' | 'community_resources'
|
|
37
|
+
export type CommunityResource = Owned & Resource & { dataset: Omit<Dataset, 'resources' | 'community_resources'>, permissions: { edit: boolean, delete: boolean } }
|
package/src/types/reuses.ts
CHANGED
|
@@ -21,7 +21,7 @@ export type Reuse = BaseReuse & {
|
|
|
21
21
|
datasets: Array<Dataset>
|
|
22
22
|
archived: string | null
|
|
23
23
|
deleted: string | null
|
|
24
|
-
extras: Record<string,
|
|
24
|
+
extras: Record<string, unknown>
|
|
25
25
|
featured: boolean
|
|
26
26
|
id: string
|
|
27
27
|
image: string | null
|
|
@@ -30,12 +30,14 @@ export type Reuse = BaseReuse & {
|
|
|
30
30
|
metrics: {
|
|
31
31
|
datasets: number
|
|
32
32
|
discussions: number
|
|
33
|
+
discussions_open: number
|
|
33
34
|
followers: number
|
|
34
35
|
views: number
|
|
35
36
|
}
|
|
36
37
|
slug: string
|
|
37
38
|
page: string
|
|
38
39
|
uri: string
|
|
40
|
+
permissions: { edit: boolean, delete: boolean }
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
export type ReuseType = {
|
package/src/types/site.ts
CHANGED
|
@@ -4,6 +4,7 @@ export type Site = {
|
|
|
4
4
|
metrics: {
|
|
5
5
|
'dataservices': number
|
|
6
6
|
'datasets': number
|
|
7
|
+
'datasets_visits_by_months': Record<string, number>
|
|
7
8
|
'discussions': number
|
|
8
9
|
'followers': number
|
|
9
10
|
'harvesters': number
|
|
@@ -17,7 +18,14 @@ export type Site = {
|
|
|
17
18
|
'organizations': number
|
|
18
19
|
'public-service': number
|
|
19
20
|
'resources': number
|
|
21
|
+
'resources_downloads_by_months': Record<string, number>
|
|
20
22
|
'reuses': number
|
|
21
23
|
'users': number
|
|
24
|
+
'users_by_months': Record<string, number>
|
|
25
|
+
'datasets_by_months': Record<string, number>
|
|
26
|
+
'harvesters_by_months': Record<string, number>
|
|
27
|
+
'reuses_by_months': Record<string, number>
|
|
28
|
+
'organizations_by_months': Record<string, number>
|
|
29
|
+
'discussions_by_months': Record<string, number>
|
|
22
30
|
}
|
|
23
31
|
}
|
package/src/types/ui.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type WellType =
|
|
1
|
+
export type WellType = 'primary' | 'secondary'
|
|
2
2
|
|
|
3
|
-
export type Weight =
|
|
3
|
+
export type Weight = 'light' | 'regular' | 'semi-bold' | 'bold' | 'heavy'
|