codevdesign 0.0.92 → 0.0.94

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.
@@ -1,56 +1,57 @@
1
- <template>
2
- <v-date-input
3
- v-model="dateValeur"
4
- v-bind="$attrs"
5
- @update:model-value="formatDate"
6
- variant="outlined"
7
- prepend-icon=""
8
- prepend-inner-icon="$calendar"
9
- density="comfortable"
10
- ></v-date-input>
11
- </template>
12
-
13
- <script setup lang="ts">
14
- import { ref, watch, computed } from 'vue'
15
- import { VDateInput } from 'vuetify/labs/VDateInput'
16
-
17
- const props = withDefaults(
18
- defineProps<{
19
- modelValue: string | Date | null
20
- }>(),
21
- {},
22
- )
23
-
24
- const emit = defineEmits(['update:modelValue'])
25
- const dateValeur = ref<Date | string | null>(props.modelValue)
26
-
27
- const formatDate = (date: Date | string | null) => {
28
- if (date == null) {
29
- emit('update:modelValue', null)
30
- return
31
- }
32
-
33
- if (typeof date === 'string') {
34
- emit('update:modelValue', props.modelValue)
35
- return
36
- }
37
-
38
- //Transformer la date en string
39
- const d = new Date(date)
40
- const yyyy = d.getFullYear()
41
- const mm = String(d.getMonth() + 1).padStart(2, '0')
42
- const dd = String(d.getDate()).padStart(2, '0')
43
- const formatte = `${yyyy}-${mm}-${dd}`
44
- dateValeur.value = formatte
45
-
46
- emit('update:modelValue', dateValeur.value)
47
- }
48
-
49
- // Synchronise les props externes avec l'état interne
50
- watch(
51
- () => props.modelValue,
52
- nouvelle => {
53
- dateValeur.value = nouvelle
54
- },
55
- )
56
- </script>
1
+ <template>
2
+ <v-date-input
3
+ v-model="dateValeur"
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="formatDate"
11
+ ></v-date-input>
12
+ </template>
13
+
14
+ <script setup lang="ts">
15
+ import { ref, watch } from 'vue'
16
+ import { VDateInput } from 'vuetify/labs/VDateInput'
17
+
18
+ const props = withDefaults(
19
+ defineProps<{
20
+ modelValue: string | Date | null
21
+ }>(),
22
+ {},
23
+ )
24
+
25
+ const emit = defineEmits(['update:modelValue'])
26
+ const dateValeur = ref<Date | string | null>(props.modelValue)
27
+
28
+ const formatDate = (date: Date | string | null) => {
29
+ if (date == null) {
30
+ emit('update:modelValue', null)
31
+ return
32
+ }
33
+
34
+ if (typeof date === 'string') {
35
+ emit('update:modelValue', props.modelValue)
36
+ return
37
+ }
38
+
39
+ //Transformer la date en string
40
+ const d = new Date(date)
41
+ const yyyy = d.getFullYear()
42
+ const mm = String(d.getMonth() + 1).padStart(2, '0')
43
+ const dd = String(d.getDate()).padStart(2, '0')
44
+ const formatte = `${yyyy}-${mm}-${dd}`
45
+ dateValeur.value = formatte
46
+
47
+ emit('update:modelValue', dateValeur.value)
48
+ }
49
+
50
+ // Synchronise les props externes avec l'état interne
51
+ watch(
52
+ () => props.modelValue,
53
+ nouvelle => {
54
+ dateValeur.value = nouvelle
55
+ },
56
+ )
57
+ </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codevdesign",
3
- "version": "0.0.92",
3
+ "version": "0.0.94",
4
4
  "description": "Composants Vuetify 3 pour les projets Codev",
5
5
  "files": [
6
6
  "./**/*.vue",