@datagouv/components-next 0.0.16 → 0.0.17
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-DhW6_H9n.js} +2 -2
- package/dist/{MapContainer.client-BgOA_uU1.js → MapContainer.client-Bvbt6dnn.js} +1 -1
- package/dist/{PdfPreview.client-FZ63b7Wx.js → PdfPreview.client-D6LTtYh7.js} +2 -2
- package/dist/{Pmtiles.client-BLpsH8tj.js → Pmtiles.client-CcrZRQLW.js} +1 -1
- package/dist/Swagger.client-DTm9HS9i.js +4 -0
- package/dist/{XmlPreview.client-D-RBWNOX.js → XmlPreview.client-Be0RWwzt.js} +2 -2
- package/dist/components-next.js +46 -45
- package/dist/{main-CY3wUqg3.js → main-DCjiKaCW.js} +4268 -4248
- package/dist/{pdf-vue3-BP0F0iqr.js → pdf-vue3-BH4rWOjw.js} +1 -1
- package/dist/{text-clamp.esm-BUicfyXy.js → text-clamp.esm-B39D0K4b.js} +1 -1
- package/dist/{vue3-json-viewer-BkS5C6Qy.js → vue3-json-viewer-BAs2SD9h.js} +1 -1
- package/dist/{vue3-xml-viewer.common-BHYUcZYj.js → vue3-xml-viewer.common-DL5vgWDy.js} +1 -1
- package/package.json +1 -1
- package/src/components/DateRangeDetails.vue +85 -0
- package/src/main.ts +2 -0
- 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-DCjiKaCW.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-DCjiKaCW.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-DCjiKaCW.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-DCjiKaCW.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
|
@@ -22,6 +22,7 @@ import BrandedButton from './components/BrandedButton.vue'
|
|
|
22
22
|
import CopyButton from './components/CopyButton.vue'
|
|
23
23
|
import DataserviceCard from './components/DataserviceCard.vue'
|
|
24
24
|
import DatasetCard from './components/DatasetCard.vue'
|
|
25
|
+
import DateRangeDetails from './components/DateRangeDetails.vue'
|
|
25
26
|
import DatasetInformationPanel from './components/DatasetInformationPanel.vue'
|
|
26
27
|
import DatasetQuality from './components/DatasetQuality.vue'
|
|
27
28
|
import DatasetQualityInline from './components/DatasetQualityInline.vue'
|
|
@@ -130,6 +131,7 @@ export {
|
|
|
130
131
|
DatasetQualityItem,
|
|
131
132
|
DatasetQualityScore,
|
|
132
133
|
DatasetQualityTooltipContent,
|
|
134
|
+
DateRangeDetails,
|
|
133
135
|
OrganizationCard,
|
|
134
136
|
OrganizationNameWithCertificate,
|
|
135
137
|
OwnerType,
|