codevdesign 1.0.36 → 1.0.38
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/csqcAide.vue +55 -55
- package/composants/csqcAlerteErreur.vue +87 -87
- package/composants/csqcChaise/chaiseConteneur.vue +367 -367
- package/composants/csqcChaise/chaiseItem.vue +54 -54
- package/composants/csqcCodeBudgetaireGenerique.vue +336 -336
- package/composants/csqcConfirmation.vue +75 -75
- package/composants/csqcDate.vue +57 -57
- package/composants/csqcDialogue.vue +118 -118
- package/composants/csqcEditeurTexteRiche.vue +380 -380
- package/composants/csqcEntete.vue +163 -163
- package/composants/csqcImportCSV.vue +125 -125
- package/composants/csqcModaleSaisie.vue +97 -95
- package/composants/csqcOptionSwitch.vue +120 -120
- package/composants/csqcRecherche.vue +213 -213
- package/composants/csqcSnackbar.vue +88 -88
- package/composants/csqcTable/csqcTable.vue +383 -383
- package/composants/csqcTable/csqcTableModaleChoixColonnes.vue +586 -586
- package/composants/csqcTexteBilingue.vue +175 -175
- package/composants/csqcTiroir.vue +156 -156
- package/composants/gabarit/csqcMenu.vue +281 -281
- package/composants/gabarit/pivEntete.vue +205 -205
- package/index.ts +75 -75
- package/modeles/composants/csqcMenuModele.ts +18 -18
- package/modeles/composants/datatableColonne.ts +31 -31
- package/outils/appAxios.ts +116 -116
- package/outils/rafraichisseurToken.ts +187 -187
- package/package.json +1 -1
|
@@ -1,213 +1,213 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<v-row
|
|
4
|
-
dense
|
|
5
|
-
class="pt-0 mt-0"
|
|
6
|
-
>
|
|
7
|
-
<v-col
|
|
8
|
-
cols="12"
|
|
9
|
-
sm="auto"
|
|
10
|
-
>
|
|
11
|
-
<slot name="recherche"></slot>
|
|
12
|
-
<v-text-field
|
|
13
|
-
v-if="afficher"
|
|
14
|
-
v-model="rechercheLocale"
|
|
15
|
-
:label="rechercheTexte ? rechercheTexte : $t('csqc.label.recherche')"
|
|
16
|
-
single-line
|
|
17
|
-
density="compact"
|
|
18
|
-
hide-details
|
|
19
|
-
v-bind="$attrs"
|
|
20
|
-
clearable
|
|
21
|
-
:rounded="0"
|
|
22
|
-
variant="outlined"
|
|
23
|
-
max-width="640"
|
|
24
|
-
min-width="500"
|
|
25
|
-
class="BarreRecherche"
|
|
26
|
-
:loading="chargement"
|
|
27
|
-
:disabled="chargement || desactiver"
|
|
28
|
-
>
|
|
29
|
-
<template #append>
|
|
30
|
-
<v-btn
|
|
31
|
-
class="BarreRechercheBackIcone"
|
|
32
|
-
:loading="chargement"
|
|
33
|
-
:disabled="chargement || desactiver"
|
|
34
|
-
>
|
|
35
|
-
<v-icon
|
|
36
|
-
class="BarreRechercheIcone"
|
|
37
|
-
icon="mdi-magnify"
|
|
38
|
-
/>
|
|
39
|
-
</v-btn>
|
|
40
|
-
</template>
|
|
41
|
-
</v-text-field>
|
|
42
|
-
</v-col>
|
|
43
|
-
<!-- Entre recherche et ajouté-->
|
|
44
|
-
<v-col
|
|
45
|
-
cols="12"
|
|
46
|
-
sm="auto"
|
|
47
|
-
class="pt-1 mt-0 pb-0 mb-0"
|
|
48
|
-
>
|
|
49
|
-
<slot name="milieu" />
|
|
50
|
-
</v-col>
|
|
51
|
-
|
|
52
|
-
<!-- Affichage des boutons et icônes-->
|
|
53
|
-
<v-col
|
|
54
|
-
cols="12"
|
|
55
|
-
sm="auto"
|
|
56
|
-
class="flex-grow-1 d-flex justify-end"
|
|
57
|
-
>
|
|
58
|
-
<slot name="droite" />
|
|
59
|
-
</v-col>
|
|
60
|
-
</v-row>
|
|
61
|
-
<v-row
|
|
62
|
-
dense
|
|
63
|
-
class="pt-0 mt-0"
|
|
64
|
-
>
|
|
65
|
-
<v-col
|
|
66
|
-
cols="12"
|
|
67
|
-
:lg="rechercheAvanceeLargeur"
|
|
68
|
-
>
|
|
69
|
-
<v-expansion-panels
|
|
70
|
-
v-if="rechercheAvancee"
|
|
71
|
-
static
|
|
72
|
-
:readonly="chargement || desactiver"
|
|
73
|
-
expand-icon=""
|
|
74
|
-
@update:model-value="onPanelChange"
|
|
75
|
-
>
|
|
76
|
-
<v-expansion-panel
|
|
77
|
-
flat
|
|
78
|
-
elevation="0"
|
|
79
|
-
>
|
|
80
|
-
<v-expansion-panel-title
|
|
81
|
-
style="color: #095797"
|
|
82
|
-
class="pl-0 ml-0"
|
|
83
|
-
><slot name="rechercheAvanceeTitre">
|
|
84
|
-
<span
|
|
85
|
-
style="text-decoration: underline"
|
|
86
|
-
v-html="rechercheAvanceeTexte ? rechercheAvanceeTexte : $t('csqc.label.rechercheAvanceeDefaut')"
|
|
87
|
-
></span>
|
|
88
|
-
<slot name="rechercheAvanceeApresTitre"></slot
|
|
89
|
-
></slot>
|
|
90
|
-
</v-expansion-panel-title>
|
|
91
|
-
<v-expansion-panel-text :style="rechercheAvanceeStyle">
|
|
92
|
-
<slot name="rechercheAvancee"></slot>
|
|
93
|
-
</v-expansion-panel-text>
|
|
94
|
-
</v-expansion-panel>
|
|
95
|
-
</v-expansion-panels>
|
|
96
|
-
</v-col>
|
|
97
|
-
</v-row>
|
|
98
|
-
</div>
|
|
99
|
-
</template>
|
|
100
|
-
|
|
101
|
-
<script lang="ts" setup>
|
|
102
|
-
import { ref, watch } from 'vue'
|
|
103
|
-
|
|
104
|
-
// Props
|
|
105
|
-
const props = defineProps({
|
|
106
|
-
afficher: {
|
|
107
|
-
type: Boolean,
|
|
108
|
-
required: false,
|
|
109
|
-
default: true,
|
|
110
|
-
},
|
|
111
|
-
rechercheTexte: {
|
|
112
|
-
type: String,
|
|
113
|
-
required: false,
|
|
114
|
-
default: '',
|
|
115
|
-
},
|
|
116
|
-
rechercheAvanceeTexte: {
|
|
117
|
-
type: String,
|
|
118
|
-
required: false,
|
|
119
|
-
default: '',
|
|
120
|
-
},
|
|
121
|
-
rechercheAvanceeLargeur: {
|
|
122
|
-
type: Number,
|
|
123
|
-
required: false,
|
|
124
|
-
default: 12,
|
|
125
|
-
},
|
|
126
|
-
chargement: {
|
|
127
|
-
type: Boolean,
|
|
128
|
-
required: false,
|
|
129
|
-
default: false,
|
|
130
|
-
},
|
|
131
|
-
desactiver: {
|
|
132
|
-
type: Boolean,
|
|
133
|
-
required: false,
|
|
134
|
-
default: false,
|
|
135
|
-
},
|
|
136
|
-
recherche: {
|
|
137
|
-
type: String,
|
|
138
|
-
required: false,
|
|
139
|
-
default: '',
|
|
140
|
-
},
|
|
141
|
-
rechercheAvancee: {
|
|
142
|
-
type: Boolean,
|
|
143
|
-
required: false,
|
|
144
|
-
default: false,
|
|
145
|
-
},
|
|
146
|
-
rechercheAvanceeStyle: {
|
|
147
|
-
type: String,
|
|
148
|
-
required: false,
|
|
149
|
-
default: '',
|
|
150
|
-
},
|
|
151
|
-
})
|
|
152
|
-
|
|
153
|
-
const emit = defineEmits<{
|
|
154
|
-
(e: 'update:recherche', recherche: string): void
|
|
155
|
-
(e: 'panneau:etat', isOpen: boolean): void // événement pour l'ouverture/fermeture du panneau
|
|
156
|
-
}>()
|
|
157
|
-
|
|
158
|
-
// Création d'une variable locale pour gérer la recherche
|
|
159
|
-
const rechercheLocale = ref(props.recherche)
|
|
160
|
-
|
|
161
|
-
// Surveiller les changements de la prop `recherche` et mettre à jour `rechercheLocale`
|
|
162
|
-
watch(
|
|
163
|
-
() => props.recherche,
|
|
164
|
-
nouvelleValeur => {
|
|
165
|
-
rechercheLocale.value = nouvelleValeur
|
|
166
|
-
},
|
|
167
|
-
)
|
|
168
|
-
|
|
169
|
-
// Émettre l'événement `update:recherche` chaque fois que l'utilisateur tape
|
|
170
|
-
watch(rechercheLocale, nouvelleValeur => {
|
|
171
|
-
emit('update:recherche', nouvelleValeur!)
|
|
172
|
-
})
|
|
173
|
-
|
|
174
|
-
// Fonction pour émettre l'événement d'ouverture/fermeture du panneau
|
|
175
|
-
const onPanelChange = (val: unknown) => {
|
|
176
|
-
if (typeof val === 'string' || typeof val === 'number' || val === null) {
|
|
177
|
-
const isOpen = val !== null && val !== ''
|
|
178
|
-
emit('panneau:etat', isOpen)
|
|
179
|
-
} else {
|
|
180
|
-
emit('panneau:etat', false)
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
</script>
|
|
184
|
-
|
|
185
|
-
<style lang="css">
|
|
186
|
-
/* barre de recherche design QC*/
|
|
187
|
-
.BarreRecherche {
|
|
188
|
-
min-height: 40px;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
.BarreRechercheBackIcone {
|
|
192
|
-
border-right: 1px solid #808a9d;
|
|
193
|
-
border-top: 1px solid #808a9d;
|
|
194
|
-
border-bottom: 1px solid #808a9d;
|
|
195
|
-
background-color: #095797 !important;
|
|
196
|
-
height: 40px !important;
|
|
197
|
-
width: 40px !important;
|
|
198
|
-
max-width: 40px !important;
|
|
199
|
-
min-width: 40px !important;
|
|
200
|
-
padding-right: 0 !important;
|
|
201
|
-
padding-left: 0 !important;
|
|
202
|
-
border-radius: 0;
|
|
203
|
-
margin-left: -16px;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/* icone loupe */
|
|
207
|
-
.BarreRechercheIcone {
|
|
208
|
-
font-size: 34px !important;
|
|
209
|
-
margin-left: 1px !important;
|
|
210
|
-
margin-top: 2px !important;
|
|
211
|
-
color: white !important;
|
|
212
|
-
}
|
|
213
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<v-row
|
|
4
|
+
dense
|
|
5
|
+
class="pt-0 mt-0"
|
|
6
|
+
>
|
|
7
|
+
<v-col
|
|
8
|
+
cols="12"
|
|
9
|
+
sm="auto"
|
|
10
|
+
>
|
|
11
|
+
<slot name="recherche"></slot>
|
|
12
|
+
<v-text-field
|
|
13
|
+
v-if="afficher"
|
|
14
|
+
v-model="rechercheLocale"
|
|
15
|
+
:label="rechercheTexte ? rechercheTexte : $t('csqc.label.recherche')"
|
|
16
|
+
single-line
|
|
17
|
+
density="compact"
|
|
18
|
+
hide-details
|
|
19
|
+
v-bind="$attrs"
|
|
20
|
+
clearable
|
|
21
|
+
:rounded="0"
|
|
22
|
+
variant="outlined"
|
|
23
|
+
max-width="640"
|
|
24
|
+
min-width="500"
|
|
25
|
+
class="BarreRecherche"
|
|
26
|
+
:loading="chargement"
|
|
27
|
+
:disabled="chargement || desactiver"
|
|
28
|
+
>
|
|
29
|
+
<template #append>
|
|
30
|
+
<v-btn
|
|
31
|
+
class="BarreRechercheBackIcone"
|
|
32
|
+
:loading="chargement"
|
|
33
|
+
:disabled="chargement || desactiver"
|
|
34
|
+
>
|
|
35
|
+
<v-icon
|
|
36
|
+
class="BarreRechercheIcone"
|
|
37
|
+
icon="mdi-magnify"
|
|
38
|
+
/>
|
|
39
|
+
</v-btn>
|
|
40
|
+
</template>
|
|
41
|
+
</v-text-field>
|
|
42
|
+
</v-col>
|
|
43
|
+
<!-- Entre recherche et ajouté-->
|
|
44
|
+
<v-col
|
|
45
|
+
cols="12"
|
|
46
|
+
sm="auto"
|
|
47
|
+
class="pt-1 mt-0 pb-0 mb-0"
|
|
48
|
+
>
|
|
49
|
+
<slot name="milieu" />
|
|
50
|
+
</v-col>
|
|
51
|
+
|
|
52
|
+
<!-- Affichage des boutons et icônes-->
|
|
53
|
+
<v-col
|
|
54
|
+
cols="12"
|
|
55
|
+
sm="auto"
|
|
56
|
+
class="flex-grow-1 d-flex justify-end"
|
|
57
|
+
>
|
|
58
|
+
<slot name="droite" />
|
|
59
|
+
</v-col>
|
|
60
|
+
</v-row>
|
|
61
|
+
<v-row
|
|
62
|
+
dense
|
|
63
|
+
class="pt-0 mt-0"
|
|
64
|
+
>
|
|
65
|
+
<v-col
|
|
66
|
+
cols="12"
|
|
67
|
+
:lg="rechercheAvanceeLargeur"
|
|
68
|
+
>
|
|
69
|
+
<v-expansion-panels
|
|
70
|
+
v-if="rechercheAvancee"
|
|
71
|
+
static
|
|
72
|
+
:readonly="chargement || desactiver"
|
|
73
|
+
expand-icon=""
|
|
74
|
+
@update:model-value="onPanelChange"
|
|
75
|
+
>
|
|
76
|
+
<v-expansion-panel
|
|
77
|
+
flat
|
|
78
|
+
elevation="0"
|
|
79
|
+
>
|
|
80
|
+
<v-expansion-panel-title
|
|
81
|
+
style="color: #095797"
|
|
82
|
+
class="pl-0 ml-0"
|
|
83
|
+
><slot name="rechercheAvanceeTitre">
|
|
84
|
+
<span
|
|
85
|
+
style="text-decoration: underline"
|
|
86
|
+
v-html="rechercheAvanceeTexte ? rechercheAvanceeTexte : $t('csqc.label.rechercheAvanceeDefaut')"
|
|
87
|
+
></span>
|
|
88
|
+
<slot name="rechercheAvanceeApresTitre"></slot
|
|
89
|
+
></slot>
|
|
90
|
+
</v-expansion-panel-title>
|
|
91
|
+
<v-expansion-panel-text :style="rechercheAvanceeStyle">
|
|
92
|
+
<slot name="rechercheAvancee"></slot>
|
|
93
|
+
</v-expansion-panel-text>
|
|
94
|
+
</v-expansion-panel>
|
|
95
|
+
</v-expansion-panels>
|
|
96
|
+
</v-col>
|
|
97
|
+
</v-row>
|
|
98
|
+
</div>
|
|
99
|
+
</template>
|
|
100
|
+
|
|
101
|
+
<script lang="ts" setup>
|
|
102
|
+
import { ref, watch } from 'vue'
|
|
103
|
+
|
|
104
|
+
// Props
|
|
105
|
+
const props = defineProps({
|
|
106
|
+
afficher: {
|
|
107
|
+
type: Boolean,
|
|
108
|
+
required: false,
|
|
109
|
+
default: true,
|
|
110
|
+
},
|
|
111
|
+
rechercheTexte: {
|
|
112
|
+
type: String,
|
|
113
|
+
required: false,
|
|
114
|
+
default: '',
|
|
115
|
+
},
|
|
116
|
+
rechercheAvanceeTexte: {
|
|
117
|
+
type: String,
|
|
118
|
+
required: false,
|
|
119
|
+
default: '',
|
|
120
|
+
},
|
|
121
|
+
rechercheAvanceeLargeur: {
|
|
122
|
+
type: Number,
|
|
123
|
+
required: false,
|
|
124
|
+
default: 12,
|
|
125
|
+
},
|
|
126
|
+
chargement: {
|
|
127
|
+
type: Boolean,
|
|
128
|
+
required: false,
|
|
129
|
+
default: false,
|
|
130
|
+
},
|
|
131
|
+
desactiver: {
|
|
132
|
+
type: Boolean,
|
|
133
|
+
required: false,
|
|
134
|
+
default: false,
|
|
135
|
+
},
|
|
136
|
+
recherche: {
|
|
137
|
+
type: String,
|
|
138
|
+
required: false,
|
|
139
|
+
default: '',
|
|
140
|
+
},
|
|
141
|
+
rechercheAvancee: {
|
|
142
|
+
type: Boolean,
|
|
143
|
+
required: false,
|
|
144
|
+
default: false,
|
|
145
|
+
},
|
|
146
|
+
rechercheAvanceeStyle: {
|
|
147
|
+
type: String,
|
|
148
|
+
required: false,
|
|
149
|
+
default: '',
|
|
150
|
+
},
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
const emit = defineEmits<{
|
|
154
|
+
(e: 'update:recherche', recherche: string): void
|
|
155
|
+
(e: 'panneau:etat', isOpen: boolean): void // événement pour l'ouverture/fermeture du panneau
|
|
156
|
+
}>()
|
|
157
|
+
|
|
158
|
+
// Création d'une variable locale pour gérer la recherche
|
|
159
|
+
const rechercheLocale = ref(props.recherche)
|
|
160
|
+
|
|
161
|
+
// Surveiller les changements de la prop `recherche` et mettre à jour `rechercheLocale`
|
|
162
|
+
watch(
|
|
163
|
+
() => props.recherche,
|
|
164
|
+
nouvelleValeur => {
|
|
165
|
+
rechercheLocale.value = nouvelleValeur
|
|
166
|
+
},
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
// Émettre l'événement `update:recherche` chaque fois que l'utilisateur tape
|
|
170
|
+
watch(rechercheLocale, nouvelleValeur => {
|
|
171
|
+
emit('update:recherche', nouvelleValeur!)
|
|
172
|
+
})
|
|
173
|
+
|
|
174
|
+
// Fonction pour émettre l'événement d'ouverture/fermeture du panneau
|
|
175
|
+
const onPanelChange = (val: unknown) => {
|
|
176
|
+
if (typeof val === 'string' || typeof val === 'number' || val === null) {
|
|
177
|
+
const isOpen = val !== null && val !== ''
|
|
178
|
+
emit('panneau:etat', isOpen)
|
|
179
|
+
} else {
|
|
180
|
+
emit('panneau:etat', false)
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
</script>
|
|
184
|
+
|
|
185
|
+
<style lang="css">
|
|
186
|
+
/* barre de recherche design QC*/
|
|
187
|
+
.BarreRecherche {
|
|
188
|
+
min-height: 40px;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.BarreRechercheBackIcone {
|
|
192
|
+
border-right: 1px solid #808a9d;
|
|
193
|
+
border-top: 1px solid #808a9d;
|
|
194
|
+
border-bottom: 1px solid #808a9d;
|
|
195
|
+
background-color: #095797 !important;
|
|
196
|
+
height: 40px !important;
|
|
197
|
+
width: 40px !important;
|
|
198
|
+
max-width: 40px !important;
|
|
199
|
+
min-width: 40px !important;
|
|
200
|
+
padding-right: 0 !important;
|
|
201
|
+
padding-left: 0 !important;
|
|
202
|
+
border-radius: 0;
|
|
203
|
+
margin-left: -16px;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/* icone loupe */
|
|
207
|
+
.BarreRechercheIcone {
|
|
208
|
+
font-size: 34px !important;
|
|
209
|
+
margin-left: 1px !important;
|
|
210
|
+
margin-top: 2px !important;
|
|
211
|
+
color: white !important;
|
|
212
|
+
}
|
|
213
|
+
</style>
|
|
@@ -1,88 +1,88 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<v-snackbar
|
|
3
|
-
v-model="snackbar"
|
|
4
|
-
v-bind="$attrs"
|
|
5
|
-
:timeout="tempsFinal"
|
|
6
|
-
:style="styleCss"
|
|
7
|
-
color="success"
|
|
8
|
-
multi-line
|
|
9
|
-
@update:model-value="fermer"
|
|
10
|
-
>
|
|
11
|
-
<template v-if="props.titre || props.message">
|
|
12
|
-
<b style="font-size: 12pt">{{ props.titre }}</b>
|
|
13
|
-
<br v-if="props.titre" />
|
|
14
|
-
<b>{{ props.message }}</b>
|
|
15
|
-
</template>
|
|
16
|
-
|
|
17
|
-
<template #actions>
|
|
18
|
-
<!-- on affiche tjrs si c'est -1 car on ne pourra pas fermer le snack -->
|
|
19
|
-
<v-icon
|
|
20
|
-
v-if="props.btnFermer || props.temps === -1"
|
|
21
|
-
color="white"
|
|
22
|
-
style="cursor: pointer"
|
|
23
|
-
@click.stop="fermer"
|
|
24
|
-
>
|
|
25
|
-
mdi-close
|
|
26
|
-
</v-icon>
|
|
27
|
-
</template>
|
|
28
|
-
</v-snackbar>
|
|
29
|
-
</template>
|
|
30
|
-
<script lang="ts" setup>
|
|
31
|
-
import { computed, ref, watch, type PropType } from 'vue'
|
|
32
|
-
|
|
33
|
-
// Définir les props avec les types
|
|
34
|
-
const props = defineProps({
|
|
35
|
-
styleCss: {
|
|
36
|
-
type: String,
|
|
37
|
-
required: false,
|
|
38
|
-
},
|
|
39
|
-
temps: {
|
|
40
|
-
type: Number,
|
|
41
|
-
required: false,
|
|
42
|
-
default: 4000,
|
|
43
|
-
validator(value: number) {
|
|
44
|
-
// Si la valeur est inférieure à -1, on la remplace par -1
|
|
45
|
-
if (value < -1) {
|
|
46
|
-
return false // Laisser échouer la validation pour gérer ça dans une logique personnalisée
|
|
47
|
-
}
|
|
48
|
-
// Validation que la valeur soit comprise entre -1 et Number.MAX_VALUE
|
|
49
|
-
return value <= Number.MAX_VALUE
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
message: {
|
|
53
|
-
type: String,
|
|
54
|
-
required: true,
|
|
55
|
-
},
|
|
56
|
-
titre: {
|
|
57
|
-
type: String,
|
|
58
|
-
required: false,
|
|
59
|
-
},
|
|
60
|
-
btnFermer: {
|
|
61
|
-
type: Boolean,
|
|
62
|
-
required: false,
|
|
63
|
-
default: true,
|
|
64
|
-
},
|
|
65
|
-
})
|
|
66
|
-
const emit = defineEmits(['fermer:snackbar'])
|
|
67
|
-
const fermer = (): void => {
|
|
68
|
-
snackbar.value = false
|
|
69
|
-
emit('fermer:snackbar')
|
|
70
|
-
}
|
|
71
|
-
// Déclarer l'état réactif pour snackbar
|
|
72
|
-
const snackbar = ref(false)
|
|
73
|
-
const message = computed(() => props.message)
|
|
74
|
-
const tempsFinal = computed(() => {
|
|
75
|
-
if (props.temps < -1) {
|
|
76
|
-
return -1 // Si la valeur est inférieure à -1, on la met à -1
|
|
77
|
-
}
|
|
78
|
-
if (props.temps >= 0 && props.temps < 1000) return 1000 // on met 1 seconde minimum sinon one ne la voit pas
|
|
79
|
-
|
|
80
|
-
return props.temps // Sinon, on retourne la valeur de la prop
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
watch(message, nouveau => {
|
|
84
|
-
if (nouveau != null && nouveau !== '') {
|
|
85
|
-
snackbar.value = true
|
|
86
|
-
}
|
|
87
|
-
})
|
|
88
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<v-snackbar
|
|
3
|
+
v-model="snackbar"
|
|
4
|
+
v-bind="$attrs"
|
|
5
|
+
:timeout="tempsFinal"
|
|
6
|
+
:style="styleCss"
|
|
7
|
+
color="success"
|
|
8
|
+
multi-line
|
|
9
|
+
@update:model-value="fermer"
|
|
10
|
+
>
|
|
11
|
+
<template v-if="props.titre || props.message">
|
|
12
|
+
<b style="font-size: 12pt">{{ props.titre }}</b>
|
|
13
|
+
<br v-if="props.titre" />
|
|
14
|
+
<b>{{ props.message }}</b>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<template #actions>
|
|
18
|
+
<!-- on affiche tjrs si c'est -1 car on ne pourra pas fermer le snack -->
|
|
19
|
+
<v-icon
|
|
20
|
+
v-if="props.btnFermer || props.temps === -1"
|
|
21
|
+
color="white"
|
|
22
|
+
style="cursor: pointer"
|
|
23
|
+
@click.stop="fermer"
|
|
24
|
+
>
|
|
25
|
+
mdi-close
|
|
26
|
+
</v-icon>
|
|
27
|
+
</template>
|
|
28
|
+
</v-snackbar>
|
|
29
|
+
</template>
|
|
30
|
+
<script lang="ts" setup>
|
|
31
|
+
import { computed, ref, watch, type PropType } from 'vue'
|
|
32
|
+
|
|
33
|
+
// Définir les props avec les types
|
|
34
|
+
const props = defineProps({
|
|
35
|
+
styleCss: {
|
|
36
|
+
type: String,
|
|
37
|
+
required: false,
|
|
38
|
+
},
|
|
39
|
+
temps: {
|
|
40
|
+
type: Number,
|
|
41
|
+
required: false,
|
|
42
|
+
default: 4000,
|
|
43
|
+
validator(value: number) {
|
|
44
|
+
// Si la valeur est inférieure à -1, on la remplace par -1
|
|
45
|
+
if (value < -1) {
|
|
46
|
+
return false // Laisser échouer la validation pour gérer ça dans une logique personnalisée
|
|
47
|
+
}
|
|
48
|
+
// Validation que la valeur soit comprise entre -1 et Number.MAX_VALUE
|
|
49
|
+
return value <= Number.MAX_VALUE
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
message: {
|
|
53
|
+
type: String,
|
|
54
|
+
required: true,
|
|
55
|
+
},
|
|
56
|
+
titre: {
|
|
57
|
+
type: String,
|
|
58
|
+
required: false,
|
|
59
|
+
},
|
|
60
|
+
btnFermer: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
required: false,
|
|
63
|
+
default: true,
|
|
64
|
+
},
|
|
65
|
+
})
|
|
66
|
+
const emit = defineEmits(['fermer:snackbar'])
|
|
67
|
+
const fermer = (): void => {
|
|
68
|
+
snackbar.value = false
|
|
69
|
+
emit('fermer:snackbar')
|
|
70
|
+
}
|
|
71
|
+
// Déclarer l'état réactif pour snackbar
|
|
72
|
+
const snackbar = ref(false)
|
|
73
|
+
const message = computed(() => props.message)
|
|
74
|
+
const tempsFinal = computed(() => {
|
|
75
|
+
if (props.temps < -1) {
|
|
76
|
+
return -1 // Si la valeur est inférieure à -1, on la met à -1
|
|
77
|
+
}
|
|
78
|
+
if (props.temps >= 0 && props.temps < 1000) return 1000 // on met 1 seconde minimum sinon one ne la voit pas
|
|
79
|
+
|
|
80
|
+
return props.temps // Sinon, on retourne la valeur de la prop
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
watch(message, nouveau => {
|
|
84
|
+
if (nouveau != null && nouveau !== '') {
|
|
85
|
+
snackbar.value = true
|
|
86
|
+
}
|
|
87
|
+
})
|
|
88
|
+
</script>
|