codevdesign 1.0.55 → 1.0.57
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/composants/csqcDate.vue +86 -79
- package/editeur.ts +1 -0
- package/importCSV.ts +1 -0
- package/index.ts +80 -80
- package/package.json +1 -1
package/composants/csqcDate.vue
CHANGED
|
@@ -1,79 +1,86 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<v-date-input
|
|
3
|
-
:model-value="dateInterne"
|
|
4
|
-
v-bind="$attrs"
|
|
5
|
-
input-format="yyyy-MM-dd"
|
|
6
|
-
variant="outlined"
|
|
7
|
-
prepend-icon=""
|
|
8
|
-
prepend-inner-icon="$calendar"
|
|
9
|
-
density="comfortable"
|
|
10
|
-
@update:model-value="choixUtilisateur"
|
|
11
|
-
/>
|
|
12
|
-
</template>
|
|
13
|
-
|
|
14
|
-
<script setup lang="ts">
|
|
15
|
-
import { computed, ref } from 'vue'
|
|
16
|
-
import { VDateInput } from 'vuetify/labs/VDateInput'
|
|
17
|
-
|
|
18
|
-
type Model = string | Date | null
|
|
19
|
-
|
|
20
|
-
const props = defineProps<{ modelValue: Model }>()
|
|
21
|
-
|
|
22
|
-
const emit = defineEmits<{
|
|
23
|
-
(e: 'update:modelValue', v: string | null): void
|
|
24
|
-
(e: 'change', v: string | null): void
|
|
25
|
-
}>()
|
|
26
|
-
|
|
27
|
-
// Normalisation, TOUJOURS "YYYY-MM-DD" ou null
|
|
28
|
-
const normalizeToYmd = (v: Date | string | null | undefined): string | null => {
|
|
29
|
-
if (v == null || v === '') return null
|
|
30
|
-
|
|
31
|
-
// Date -> YYYY-MM-DD (local)
|
|
32
|
-
if (v instanceof Date) {
|
|
33
|
-
if (isNaN(v.getTime())) return null
|
|
34
|
-
const yyyy = v.getFullYear()
|
|
35
|
-
const mm = String(v.getMonth() + 1).padStart(2, '0')
|
|
36
|
-
const dd = String(v.getDate()).padStart(2, '0')
|
|
37
|
-
return `${yyyy}-${mm}-${dd}`
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// String -> accepte seulement YYYY-MM-DD
|
|
41
|
-
const s = String(v).trim()
|
|
42
|
-
const m = s.match(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<v-date-input
|
|
3
|
+
:model-value="dateInterne"
|
|
4
|
+
v-bind="$attrs"
|
|
5
|
+
input-format="yyyy-MM-dd"
|
|
6
|
+
variant="outlined"
|
|
7
|
+
prepend-icon=""
|
|
8
|
+
prepend-inner-icon="$calendar"
|
|
9
|
+
density="comfortable"
|
|
10
|
+
@update:model-value="choixUtilisateur"
|
|
11
|
+
/>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script setup lang="ts">
|
|
15
|
+
import { computed, ref } from 'vue'
|
|
16
|
+
import { VDateInput } from 'vuetify/labs/VDateInput'
|
|
17
|
+
|
|
18
|
+
type Model = string | Date | null
|
|
19
|
+
|
|
20
|
+
const props = defineProps<{ modelValue: Model }>()
|
|
21
|
+
|
|
22
|
+
const emit = defineEmits<{
|
|
23
|
+
(e: 'update:modelValue', v: string | null): void
|
|
24
|
+
(e: 'change', v: string | null): void
|
|
25
|
+
}>()
|
|
26
|
+
|
|
27
|
+
// Normalisation, TOUJOURS "YYYY-MM-DD" ou null
|
|
28
|
+
const normalizeToYmd = (v: Date | string | null | undefined): string | null => {
|
|
29
|
+
if (v == null || v === '') return null
|
|
30
|
+
|
|
31
|
+
// Date -> YYYY-MM-DD (local)
|
|
32
|
+
if (v instanceof Date) {
|
|
33
|
+
if (isNaN(v.getTime())) return null
|
|
34
|
+
const yyyy = v.getFullYear()
|
|
35
|
+
const mm = String(v.getMonth() + 1).padStart(2, '0')
|
|
36
|
+
const dd = String(v.getDate()).padStart(2, '0')
|
|
37
|
+
return `${yyyy}-${mm}-${dd}`
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// String -> accepte seulement YYYY-MM-DD ISO8601 (optionnellement suivi de l'heure, qui est ignorée)
|
|
41
|
+
const s = String(v).trim()
|
|
42
|
+
const m = s.match(
|
|
43
|
+
/^(?<date>(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}))(?:T\d{2}:\d{2}:\d{2}(?:\.\d{3})?(?:Z|(?:[-+]\d{2}:\d{2}?))?)?$/,
|
|
44
|
+
)
|
|
45
|
+
if (!m) return null
|
|
46
|
+
|
|
47
|
+
// Optionnel: validation simple (évite 2026-99-99)
|
|
48
|
+
const y = Number(m.groups!.year),
|
|
49
|
+
mo = Number(m.groups!.month),
|
|
50
|
+
d = Number(m.groups!.day)
|
|
51
|
+
if (mo < 1 || mo > 12 || d < 1 || d > 31) return null
|
|
52
|
+
if (mo === 2) {
|
|
53
|
+
const isLeap = (y % 4 === 0 && y % 100 !== 0) || y % 400 === 0
|
|
54
|
+
if (d > (isLeap ? 29 : 28)) return null
|
|
55
|
+
}
|
|
56
|
+
if ([4, 6, 9, 11].includes(mo) && d > 30) return null
|
|
57
|
+
|
|
58
|
+
return `${m.groups!.date}`
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// UI: VDateInput stable avec Date|null
|
|
62
|
+
const dateInterne = computed<Date | null>(() => {
|
|
63
|
+
const ymd = normalizeToYmd(props.modelValue as any)
|
|
64
|
+
if (!ymd) return null
|
|
65
|
+
const [y, m, d] = ymd.split('-').map(Number)
|
|
66
|
+
return new Date(y, m - 1, d) // local, stable
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
const prevBeforeEmit = ref<string | null>(null)
|
|
70
|
+
|
|
71
|
+
const choixUtilisateur = (v: Date | string | null) => {
|
|
72
|
+
const next = normalizeToYmd(v)
|
|
73
|
+
const current = normalizeToYmd(props.modelValue as any)
|
|
74
|
+
|
|
75
|
+
// rollback: on reçoit l'ancienne valeur (celle qu'on avait avant)
|
|
76
|
+
if (prevBeforeEmit.value && next === prevBeforeEmit.value && current !== prevBeforeEmit.value) {
|
|
77
|
+
return
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (next === current) return
|
|
81
|
+
|
|
82
|
+
prevBeforeEmit.value = current
|
|
83
|
+
emit('update:modelValue', next)
|
|
84
|
+
emit('change', next)
|
|
85
|
+
}
|
|
86
|
+
</script>
|
package/editeur.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as csqcEditeurTexteRiche } from './composants/csqcEditeurTexteRiche.vue'
|
package/importCSV.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as csqcImportCSV } from './composants/csqcImportCSV.vue'
|
package/index.ts
CHANGED
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
import csqcAlerteErreur from './composants/csqcAlerteErreur.vue'
|
|
2
|
-
import csqcDialogue from './composants/csqcDialogue.vue'
|
|
3
|
-
|
|
4
|
-
// à enlever éventuellement. Remplacé par csqcSwitch
|
|
5
|
-
import csqcOptionSwitch from './composants/csqcSwitch.vue'
|
|
6
|
-
import csqcRecherche from './composants/csqcRecherche.vue'
|
|
7
|
-
import csqcSnackbar from './composants/csqcSnackbar.vue'
|
|
8
|
-
import csqcTiroir from './composants/csqcTiroir.vue'
|
|
9
|
-
import pivEntete from './composants/gabarit/pivEntete.vue'
|
|
10
|
-
import pivFooter from './composants/gabarit/pivPiedPage.vue'
|
|
11
|
-
import csqcMenu from './composants/gabarit/csqcMenu.vue'
|
|
12
|
-
import csqcConfirmation from './composants/csqcConfirmation.vue'
|
|
13
|
-
import csqcSaisie from './composants/csqcModaleSaisie.vue'
|
|
14
|
-
import csqcDate from './composants/csqcDate.vue'
|
|
15
|
-
import csqcTable from './composants/csqcTable/csqcTable.vue'
|
|
16
|
-
import csqcCodeBudgetaire from './composants/csqcCodeBudgetaireGenerique.vue'
|
|
17
|
-
import csqcChaise from './composants/csqcChaise/chaiseConteneur.vue'
|
|
18
|
-
import csqcAide from './composants/csqcAide.vue'
|
|
19
|
-
import csqcEntete from './composants/csqcEntete.vue'
|
|
20
|
-
import csqcTexteBilingue from './composants/csqcTexteBilingue.vue'
|
|
21
|
-
import csqcSwitch from './composants/csqcSwitch.vue'
|
|
22
|
-
|
|
23
|
-
import csqcEditeurTexteRiche from './composants/csqcEditeurTexteRiche.vue'
|
|
24
|
-
import csqcImportCSV from './composants/csqcImportCSV.vue'
|
|
25
|
-
import csqcRechercheUtilisateur from './composants/csqcRechercheUtilisateur.vue'
|
|
26
|
-
import validateurs from './composants/validateurs'
|
|
27
|
-
|
|
28
|
-
// modèles
|
|
29
|
-
import NotificationGabaritDefaut from './modeles/notificationGabaritDefaut'
|
|
30
|
-
import modeleSnackbar from './modeles/composants/snackbar'
|
|
31
|
-
import modeleDatatableColonne from './modeles/composants/datatableColonne'
|
|
32
|
-
import apiReponse from './modeles/apiReponse'
|
|
33
|
-
import data from './modeles/data'
|
|
34
|
-
import response from './modeles/response'
|
|
35
|
-
|
|
36
|
-
// outils
|
|
37
|
-
import csqcRafraichisseurToken from './outils/rafraichisseurToken'
|
|
38
|
-
import csqcRafraichisseurTokenParent from './outils/csqcRafraichisseurTokenParent'
|
|
39
|
-
import csqcOutils from './outils/csqcOutils'
|
|
40
|
-
|
|
41
|
-
// i18n
|
|
42
|
-
import csqcEn from './locales/en.json'
|
|
43
|
-
import csqcFr from './locales/fr.json'
|
|
44
|
-
|
|
45
|
-
export {
|
|
46
|
-
csqcFr,
|
|
47
|
-
csqcEn,
|
|
48
|
-
csqcAlerteErreur,
|
|
49
|
-
csqcDialogue,
|
|
50
|
-
csqcConfirmation,
|
|
51
|
-
csqcSaisie,
|
|
52
|
-
csqcDate,
|
|
53
|
-
csqcOptionSwitch, // a enlever eventuellement
|
|
54
|
-
csqcSwitch,
|
|
55
|
-
csqcRecherche,
|
|
56
|
-
csqcSnackbar,
|
|
57
|
-
csqcTable,
|
|
58
|
-
csqcTiroir,
|
|
59
|
-
csqcMenu,
|
|
60
|
-
csqcCodeBudgetaire,
|
|
61
|
-
csqcChaise,
|
|
62
|
-
pivFooter,
|
|
63
|
-
pivEntete,
|
|
64
|
-
csqcAide,
|
|
65
|
-
csqcEntete,
|
|
66
|
-
csqcTexteBilingue,
|
|
67
|
-
csqcEditeurTexteRiche,
|
|
68
|
-
validateurs,
|
|
69
|
-
csqcImportCSV,
|
|
70
|
-
csqcRechercheUtilisateur,
|
|
71
|
-
csqcRafraichisseurToken,
|
|
72
|
-
csqcRafraichisseurTokenParent,
|
|
73
|
-
csqcOutils,
|
|
74
|
-
modeleSnackbar,
|
|
75
|
-
modeleDatatableColonne as colonne,
|
|
76
|
-
apiReponse,
|
|
77
|
-
data,
|
|
78
|
-
response,
|
|
79
|
-
NotificationGabaritDefaut,
|
|
80
|
-
}
|
|
1
|
+
import csqcAlerteErreur from './composants/csqcAlerteErreur.vue'
|
|
2
|
+
import csqcDialogue from './composants/csqcDialogue.vue'
|
|
3
|
+
|
|
4
|
+
// à enlever éventuellement. Remplacé par csqcSwitch
|
|
5
|
+
import csqcOptionSwitch from './composants/csqcSwitch.vue'
|
|
6
|
+
import csqcRecherche from './composants/csqcRecherche.vue'
|
|
7
|
+
import csqcSnackbar from './composants/csqcSnackbar.vue'
|
|
8
|
+
import csqcTiroir from './composants/csqcTiroir.vue'
|
|
9
|
+
import pivEntete from './composants/gabarit/pivEntete.vue'
|
|
10
|
+
import pivFooter from './composants/gabarit/pivPiedPage.vue'
|
|
11
|
+
import csqcMenu from './composants/gabarit/csqcMenu.vue'
|
|
12
|
+
import csqcConfirmation from './composants/csqcConfirmation.vue'
|
|
13
|
+
import csqcSaisie from './composants/csqcModaleSaisie.vue'
|
|
14
|
+
import csqcDate from './composants/csqcDate.vue'
|
|
15
|
+
import csqcTable from './composants/csqcTable/csqcTable.vue'
|
|
16
|
+
import csqcCodeBudgetaire from './composants/csqcCodeBudgetaireGenerique.vue'
|
|
17
|
+
import csqcChaise from './composants/csqcChaise/chaiseConteneur.vue'
|
|
18
|
+
import csqcAide from './composants/csqcAide.vue'
|
|
19
|
+
import csqcEntete from './composants/csqcEntete.vue'
|
|
20
|
+
import csqcTexteBilingue from './composants/csqcTexteBilingue.vue'
|
|
21
|
+
import csqcSwitch from './composants/csqcSwitch.vue'
|
|
22
|
+
|
|
23
|
+
//import csqcEditeurTexteRiche from './composants/csqcEditeurTexteRiche.vue'
|
|
24
|
+
//import csqcImportCSV from './composants/csqcImportCSV.vue'
|
|
25
|
+
import csqcRechercheUtilisateur from './composants/csqcRechercheUtilisateur.vue'
|
|
26
|
+
import validateurs from './composants/validateurs'
|
|
27
|
+
|
|
28
|
+
// modèles
|
|
29
|
+
import NotificationGabaritDefaut from './modeles/notificationGabaritDefaut'
|
|
30
|
+
import modeleSnackbar from './modeles/composants/snackbar'
|
|
31
|
+
import modeleDatatableColonne from './modeles/composants/datatableColonne'
|
|
32
|
+
import apiReponse from './modeles/apiReponse'
|
|
33
|
+
import data from './modeles/data'
|
|
34
|
+
import response from './modeles/response'
|
|
35
|
+
|
|
36
|
+
// outils
|
|
37
|
+
import csqcRafraichisseurToken from './outils/rafraichisseurToken'
|
|
38
|
+
import csqcRafraichisseurTokenParent from './outils/csqcRafraichisseurTokenParent'
|
|
39
|
+
import csqcOutils from './outils/csqcOutils'
|
|
40
|
+
|
|
41
|
+
// i18n
|
|
42
|
+
import csqcEn from './locales/en.json'
|
|
43
|
+
import csqcFr from './locales/fr.json'
|
|
44
|
+
|
|
45
|
+
export {
|
|
46
|
+
csqcFr,
|
|
47
|
+
csqcEn,
|
|
48
|
+
csqcAlerteErreur,
|
|
49
|
+
csqcDialogue,
|
|
50
|
+
csqcConfirmation,
|
|
51
|
+
csqcSaisie,
|
|
52
|
+
csqcDate,
|
|
53
|
+
csqcOptionSwitch, // a enlever eventuellement
|
|
54
|
+
csqcSwitch,
|
|
55
|
+
csqcRecherche,
|
|
56
|
+
csqcSnackbar,
|
|
57
|
+
csqcTable,
|
|
58
|
+
csqcTiroir,
|
|
59
|
+
csqcMenu,
|
|
60
|
+
csqcCodeBudgetaire,
|
|
61
|
+
csqcChaise,
|
|
62
|
+
pivFooter,
|
|
63
|
+
pivEntete,
|
|
64
|
+
csqcAide,
|
|
65
|
+
csqcEntete,
|
|
66
|
+
csqcTexteBilingue,
|
|
67
|
+
// csqcEditeurTexteRiche,
|
|
68
|
+
validateurs,
|
|
69
|
+
// csqcImportCSV,
|
|
70
|
+
csqcRechercheUtilisateur,
|
|
71
|
+
csqcRafraichisseurToken,
|
|
72
|
+
csqcRafraichisseurTokenParent,
|
|
73
|
+
csqcOutils,
|
|
74
|
+
modeleSnackbar,
|
|
75
|
+
modeleDatatableColonne as colonne,
|
|
76
|
+
apiReponse,
|
|
77
|
+
data,
|
|
78
|
+
response,
|
|
79
|
+
NotificationGabaritDefaut,
|
|
80
|
+
}
|