@datagouv/components-next 0.0.16 → 0.0.18
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/{JsonPreview.client-B7HlR5lF.js → JsonPreview.client-DvhnzVAV.js} +2 -2
- package/dist/{MapContainer.client-BgOA_uU1.js → MapContainer.client-BTa4cY2w.js} +1 -1
- package/dist/{PdfPreview.client-FZ63b7Wx.js → PdfPreview.client-CFMYzFUs.js} +2 -2
- package/dist/{Pmtiles.client-BLpsH8tj.js → Pmtiles.client-CCMKYGsj.js} +1 -1
- package/dist/Swagger.client-Ci_pwa2Z.js +4 -0
- package/dist/{XmlPreview.client-D-RBWNOX.js → XmlPreview.client-0NtLStzb.js} +2 -2
- package/dist/components-next.js +59 -57
- package/dist/{main-CY3wUqg3.js → main-BGN65wY4.js} +4539 -4519
- package/dist/{pdf-vue3-BP0F0iqr.js → pdf-vue3-D5SzycIl.js} +1 -1
- package/dist/{text-clamp.esm-BUicfyXy.js → text-clamp.esm-D43nX9La.js} +1 -1
- package/dist/{vue3-json-viewer-BkS5C6Qy.js → vue3-json-viewer-BiPkSVJb.js} +1 -1
- package/dist/{vue3-xml-viewer.common-BHYUcZYj.js → vue3-xml-viewer.common-ARb4d9zr.js} +1 -1
- package/package.json +1 -1
- package/src/components/DateRangeDetails.vue +85 -0
- package/src/main.ts +5 -2
- package/dist/Swagger.client-DB62n7Xb.js +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as Zl, r as c, c as bl, J as dl, L as Wl, w as J, o as cl, b as X, f as M, g as s, y as Q, i as u, M as Gl, N as ml, h as H, u as g, t as f } from "./main-
|
|
1
|
+
import { d as Zl, r as c, c as bl, J as dl, L as Wl, w as J, o as cl, b as X, f as M, g as s, y as Q, i as u, M as Gl, N as ml, h as H, u as g, t as f } from "./main-BGN65wY4.js";
|
|
2
2
|
const Nl = {
|
|
3
3
|
class: "pdf-vue3-main",
|
|
4
4
|
style: { height: "100%", position: "relative", "min-height": "10px" }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as K, r as C, a as P, c as z, w as g, b as Q, n as W, o as X, e as Y, f as Z, g as $, h as B, u as L, i as ee } from "./main-
|
|
1
|
+
import { d as K, r as C, a as P, c as z, w as g, b as Q, n as W, o as X, e as Y, f as Z, g as $, h as B, u as L, i as ee } from "./main-BGN65wY4.js";
|
|
2
2
|
var H = null;
|
|
3
3
|
function te(e) {
|
|
4
4
|
return H || (H = (window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(r) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as T, D as ce, b as _, f as N, y as Y, g as P, E as S, h as pe, A as fe, t as O, q as de, r as k, G as z, c as A, w as J, e as I, H, I as g, n as ve } from "./main-
|
|
1
|
+
import { d as T, D as ce, b as _, f as N, y as Y, g as P, E as S, h as pe, A as fe, t as O, q as de, r as k, G as z, c as A, w as J, e as I, H, I as g, n as ve } from "./main-BGN65wY4.js";
|
|
2
2
|
const ye = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+$/, G = T({
|
|
3
3
|
name: "JsonString",
|
|
4
4
|
props: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as et, P as ge, Q as j, R as dt, S as tn, T as _n, U as pi, V as ui, W as fs, X as Ce, Y as di, Z as hs, $ as fi, a0 as he, a1 as $n, a2 as tt, a3 as hi, a4 as mi, a5 as Ei, a6 as Ni, a7 as vi, a8 as Mt, a9 as gi, aa as pn, ab as Si, ac as Ti, k as yi } from "./main-
|
|
1
|
+
import { O as et, P as ge, Q as j, R as dt, S as tn, T as _n, U as pi, V as ui, W as fs, X as Ce, Y as di, Z as hs, $ as fi, a0 as he, a1 as $n, a2 as tt, a3 as hi, a4 as mi, a5 as Ei, a6 as Ni, a7 as vi, a8 as Mt, a9 as gi, aa as pn, ab as Si, ac as Ti, k as yi } from "./main-BGN65wY4.js";
|
|
2
2
|
function Oi(e, t) {
|
|
3
3
|
for (var n = 0; n < t.length; n++) {
|
|
4
4
|
const r = t[n];
|
package/package.json
CHANGED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span>{{ display }}</span>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import { computed } from 'vue'
|
|
7
|
+
import { useI18n } from 'vue-i18n'
|
|
8
|
+
|
|
9
|
+
const props = defineProps<{
|
|
10
|
+
range: { start: string, end: string | null }
|
|
11
|
+
}>()
|
|
12
|
+
|
|
13
|
+
const { t } = useI18n()
|
|
14
|
+
|
|
15
|
+
const start = computed(() => new Date(props.range.start))
|
|
16
|
+
const end = computed(() => props.range.end ? new Date(props.range.end) : null)
|
|
17
|
+
|
|
18
|
+
const display = computed(() => {
|
|
19
|
+
let startDisplay: string | number | null = null
|
|
20
|
+
let endDisplay: string | number | null = null
|
|
21
|
+
let isDiscrete = false
|
|
22
|
+
let hasPronoun = false
|
|
23
|
+
|
|
24
|
+
const showDayMonthYear = new Intl.DateTimeFormat('fr-FR', { year: 'numeric', month: 'long', day: 'numeric' }).format
|
|
25
|
+
const showDayMonth = new Intl.DateTimeFormat('fr-FR', { month: 'long', day: 'numeric' }).format
|
|
26
|
+
const showMonthYear = new Intl.DateTimeFormat('fr-FR', { year: 'numeric', month: 'long' }).format
|
|
27
|
+
const showMonth = new Intl.DateTimeFormat('fr-FR', { month: 'long' }).format
|
|
28
|
+
|
|
29
|
+
if (start.value.getDate() === 1 && start.value.getMonth() === 0 && (!end.value || (end.value.getDate() === 31 && end.value.getMonth() === 11))) {
|
|
30
|
+
startDisplay = start.value.getFullYear()
|
|
31
|
+
if (end.value && end.value.getFullYear() > start.value.getFullYear()) {
|
|
32
|
+
endDisplay = end.value.getFullYear()
|
|
33
|
+
isDiscrete = end.value.getFullYear() === start.value.getFullYear() + 1
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else if (start.value.getDate() === 1 && (!end.value || (end.value.getDate() === lastDayOfMonth(end.value)))) {
|
|
37
|
+
startDisplay = start.value.getFullYear() === end.value?.getFullYear() ? showMonth(start.value) : showMonthYear(start.value)
|
|
38
|
+
if (end.value && (end.value.getFullYear() > start.value.getFullYear() || end.value.getMonth() > start.value.getMonth())) {
|
|
39
|
+
endDisplay = showMonthYear(end.value)
|
|
40
|
+
isDiscrete = (end.value.getMonth() === start.value.getMonth() + 1) || (end.value.getMonth() === 0 && start.value.getMonth() === 11)
|
|
41
|
+
}
|
|
42
|
+
else if (end.value) {
|
|
43
|
+
// We are the same month, we will not show the endDisplay so we need to add back the year to the startDisplay
|
|
44
|
+
startDisplay = showMonthYear(start.value)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
hasPronoun = true
|
|
49
|
+
startDisplay = start.value.getFullYear() === end.value?.getFullYear() ? showDayMonth(start.value) : showDayMonthYear(start.value)
|
|
50
|
+
if (end.value && (end.value.getFullYear() > start.value.getFullYear() || end.value.getMonth() > start.value.getMonth() || end.value.getDate() > start.value.getDate())) {
|
|
51
|
+
endDisplay = showDayMonthYear(end.value)
|
|
52
|
+
}
|
|
53
|
+
else if (end.value) {
|
|
54
|
+
// We are the same day, we will not show the endDisplay so we need to add back the year to the startDisplay
|
|
55
|
+
startDisplay = showDayMonthYear(start.value)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const addPronoun = (value: string | number | null) => {
|
|
60
|
+
if (!value) return null
|
|
61
|
+
if (!hasPronoun) return value
|
|
62
|
+
return t('le ') + value
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (endDisplay) {
|
|
66
|
+
if (isDiscrete) {
|
|
67
|
+
return t('{start} et {end}', { start: addPronoun(startDisplay), end: addPronoun(endDisplay) })
|
|
68
|
+
}
|
|
69
|
+
else if (hasPronoun) {
|
|
70
|
+
return t('du {start} au {end}', { start: startDisplay, end: endDisplay })
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
return t('{start} à {end}', { start: startDisplay, end: endDisplay })
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (!end.value) {
|
|
77
|
+
return t('depuis {start}', { start: addPronoun(startDisplay) })
|
|
78
|
+
}
|
|
79
|
+
return addPronoun(startDisplay)
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
function lastDayOfMonth(date: Date) {
|
|
83
|
+
return new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate()
|
|
84
|
+
}
|
|
85
|
+
</script>
|
package/src/main.ts
CHANGED
|
@@ -15,6 +15,7 @@ import type { Site } from './types/site'
|
|
|
15
15
|
import type { Weight, WellType } from './types/ui'
|
|
16
16
|
import type { User } from './types/users'
|
|
17
17
|
|
|
18
|
+
import AppLink from './components/AppLink.vue'
|
|
18
19
|
import Avatar from './components/Avatar.vue'
|
|
19
20
|
import AvatarWithName from './components/AvatarWithName.vue'
|
|
20
21
|
import BannerAction from './components/BannerAction.vue'
|
|
@@ -22,6 +23,7 @@ import BrandedButton from './components/BrandedButton.vue'
|
|
|
22
23
|
import CopyButton from './components/CopyButton.vue'
|
|
23
24
|
import DataserviceCard from './components/DataserviceCard.vue'
|
|
24
25
|
import DatasetCard from './components/DatasetCard.vue'
|
|
26
|
+
import DateRangeDetails from './components/DateRangeDetails.vue'
|
|
25
27
|
import DatasetInformationPanel from './components/DatasetInformationPanel.vue'
|
|
26
28
|
import DatasetQuality from './components/DatasetQuality.vue'
|
|
27
29
|
import DatasetQualityInline from './components/DatasetQualityInline.vue'
|
|
@@ -105,18 +107,18 @@ export type {
|
|
|
105
107
|
// Vue Plugin
|
|
106
108
|
const datagouv: Plugin<PluginConfig> = {
|
|
107
109
|
async install(app: App, options) {
|
|
110
|
+
app.provide(configKey, options)
|
|
108
111
|
if (!options.textClamp) {
|
|
109
112
|
const textClamp = await import('vue3-text-clamp')
|
|
110
113
|
options.textClamp = textClamp.default
|
|
111
114
|
}
|
|
112
|
-
|
|
113
|
-
app.provide(configKey, options)
|
|
114
115
|
},
|
|
115
116
|
}
|
|
116
117
|
|
|
117
118
|
export {
|
|
118
119
|
datagouv,
|
|
119
120
|
useComponentsConfig,
|
|
121
|
+
AppLink,
|
|
120
122
|
Avatar,
|
|
121
123
|
AvatarWithName,
|
|
122
124
|
BannerAction,
|
|
@@ -130,6 +132,7 @@ export {
|
|
|
130
132
|
DatasetQualityItem,
|
|
131
133
|
DatasetQualityScore,
|
|
132
134
|
DatasetQualityTooltipContent,
|
|
135
|
+
DateRangeDetails,
|
|
133
136
|
OrganizationCard,
|
|
134
137
|
OrganizationNameWithCertificate,
|
|
135
138
|
OwnerType,
|