codevdesign 0.0.1 → 0.0.2
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/csqcAlerteErreur.vue +86 -0
- package/composants/csqcConfirmation.vue +74 -0
- package/composants/csqcDialogue.vue +118 -0
- package/composants/csqcOptionSwitch.vue +113 -0
- package/composants/csqcRecherche.vue +158 -0
- package/composants/csqcSnackbar.vue +99 -0
- package/composants/csqcTable/csqcTable.vue +314 -0
- package/composants/csqcTable/csqcTableExportExcel.vue +67 -0
- package/composants/csqcTable/csqcTableModaleChoixColonnes.vue +567 -0
- package/composants/csqcTiroir.vue +150 -0
- package/composants/gabarit/csqcMenu.vue +249 -0
- package/composants/gabarit/pivEntete.vue +109 -0
- package/composants/gabarit/pivPiedPage.vue +59 -0
- package/composants/gabarit/vueDefault.vue +6 -0
- package/index.ts +38 -0
- package/locales/en.json +9 -0
- package/locales/fr.json +126 -0
- package/modeles/composants/csqcMenuModele.ts +18 -0
- package/modeles/composants/snackbar.ts +18 -0
- package/modeles/intervention.ts +38 -0
- package/modeles/unite.ts +42 -0
- package/modeles/utilisateur.ts +33 -0
- package/package.json +21 -12
- package/codevdesign.css +0 -1
- package/codevdesign.js +0 -16104
- package/codevdesign.umd.cjs +0 -25
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
v-if="afficher && erreur"
|
|
4
|
+
:style="retournerStyle"
|
|
5
|
+
>
|
|
6
|
+
<v-alert
|
|
7
|
+
v-model="afficher"
|
|
8
|
+
class="mb-0 text-center hyphen_auto"
|
|
9
|
+
color="#CB381F"
|
|
10
|
+
closable
|
|
11
|
+
@click:close="fermer"
|
|
12
|
+
>
|
|
13
|
+
<span v-html="erreur" /><br />
|
|
14
|
+
<span
|
|
15
|
+
id="messageSoutien"
|
|
16
|
+
style="color: darkgray"
|
|
17
|
+
>{{ messageSoutien }}</span
|
|
18
|
+
>
|
|
19
|
+
</v-alert>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script lang="ts" setup>
|
|
24
|
+
import { computed, ref, watch } from 'vue'
|
|
25
|
+
import { useDisplay } from 'vuetify'
|
|
26
|
+
import { useI18n } from 'vue-i18n'
|
|
27
|
+
|
|
28
|
+
// Définir les props avec les types
|
|
29
|
+
const props = defineProps({
|
|
30
|
+
message: {
|
|
31
|
+
type: String,
|
|
32
|
+
required: true,
|
|
33
|
+
},
|
|
34
|
+
messageSoutien: {
|
|
35
|
+
type: String,
|
|
36
|
+
required: true,
|
|
37
|
+
},
|
|
38
|
+
})
|
|
39
|
+
const { name: displayName } = useDisplay()
|
|
40
|
+
const emit = defineEmits(['fermer:alerte'])
|
|
41
|
+
const { t } = useI18n({ useScope: 'global' })
|
|
42
|
+
|
|
43
|
+
const fermer = (): void => {
|
|
44
|
+
afficher.value = false
|
|
45
|
+
emit('fermer:alerte')
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const afficher = ref(false)
|
|
49
|
+
|
|
50
|
+
// Watcher pour réagir aux changements du message
|
|
51
|
+
watch(
|
|
52
|
+
() => props.message,
|
|
53
|
+
nouveauMessage => {
|
|
54
|
+
if (nouveauMessage && nouveauMessage !== '') {
|
|
55
|
+
afficher.value = true
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
// Computed pour l'erreur, venant du store
|
|
61
|
+
const erreur = computed(() => {
|
|
62
|
+
if (props.message == null || props.message == '') return null
|
|
63
|
+
|
|
64
|
+
if (props.message.indexOf('erreurs.') === 0) return t(props.message)
|
|
65
|
+
|
|
66
|
+
return props.message
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
// Méthode computed pour le style en fonction du breakpoint
|
|
70
|
+
const retournerStyle = computed(() => {
|
|
71
|
+
if (displayName.value === 'xs') {
|
|
72
|
+
return 'top: 0px; right:1%;width: 98%;position: fixed; z-index: 2000;'
|
|
73
|
+
}
|
|
74
|
+
return 'top: 20px; right: 10%; width: 80%; position: fixed; z-index: 2000; margin: 0 auto;'
|
|
75
|
+
})
|
|
76
|
+
</script>
|
|
77
|
+
|
|
78
|
+
<style lang="css" scoped>
|
|
79
|
+
.error {
|
|
80
|
+
padding-top: 0.7rem;
|
|
81
|
+
padding-bottom: 0.7rem;
|
|
82
|
+
}
|
|
83
|
+
:deep(.blanc) {
|
|
84
|
+
color: white;
|
|
85
|
+
}
|
|
86
|
+
</style>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<csqcDialogue
|
|
3
|
+
:titre="props.titre"
|
|
4
|
+
ref="modale"
|
|
5
|
+
:operationEnCours="operationEnCours"
|
|
6
|
+
activator="supprimer"
|
|
7
|
+
:largeur="props.largeur"
|
|
8
|
+
@ok="confirmer"
|
|
9
|
+
@annuler="annuler"
|
|
10
|
+
>
|
|
11
|
+
<v-form
|
|
12
|
+
ref="form"
|
|
13
|
+
@submit.prevent
|
|
14
|
+
>
|
|
15
|
+
<v-row>
|
|
16
|
+
<v-col
|
|
17
|
+
cols="12"
|
|
18
|
+
class="pa-0 ma-0"
|
|
19
|
+
>
|
|
20
|
+
{{ texte }}
|
|
21
|
+
</v-col>
|
|
22
|
+
</v-row>
|
|
23
|
+
</v-form>
|
|
24
|
+
</csqcDialogue>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script lang="ts" setup>
|
|
28
|
+
import { ref } from 'vue'
|
|
29
|
+
import csqcDialogue from './csqcDialogue.vue'
|
|
30
|
+
|
|
31
|
+
const modale = ref<InstanceType<typeof csqcDialogue> | null>(null)
|
|
32
|
+
const utilisateurATermine = ref(false)
|
|
33
|
+
const reponse = ref(false)
|
|
34
|
+
const texte = ref('')
|
|
35
|
+
const modeAlerte = ref(false)
|
|
36
|
+
|
|
37
|
+
const props = defineProps({
|
|
38
|
+
operationEnCours: { type: Boolean, default: false },
|
|
39
|
+
titre: { type: String, default: '' },
|
|
40
|
+
largeur: { type: String, default: '525px' },
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
const ouvrir = async (message: string, modeAlerteParam: boolean = false) => {
|
|
44
|
+
texte.value = message
|
|
45
|
+
modeAlerte.value = modeAlerteParam
|
|
46
|
+
utilisateurATermine.value = false
|
|
47
|
+
modale.value?.ouvrir()
|
|
48
|
+
|
|
49
|
+
while (!utilisateurATermine.value) {
|
|
50
|
+
await new Promise(resolve => setTimeout(resolve, 100)) // Attendre 100ms
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return reponse.value
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const confirmer = (): void => {
|
|
57
|
+
reponse.value = true
|
|
58
|
+
utilisateurATermine.value = true
|
|
59
|
+
|
|
60
|
+
if (modeAlerte.value) fermer()
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const annuler = (): void => {
|
|
64
|
+
reponse.value = false
|
|
65
|
+
utilisateurATermine.value = true
|
|
66
|
+
fermer()
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const fermer = (): void => {
|
|
70
|
+
modale.value?.fermer()
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
defineExpose({ ouvrir, fermer })
|
|
74
|
+
</script>
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-dialog
|
|
3
|
+
class="pa-0 ma-0"
|
|
4
|
+
v-model="dialog"
|
|
5
|
+
:width="largeur"
|
|
6
|
+
:fullscreen="display.xs.value"
|
|
7
|
+
max-width="650"
|
|
8
|
+
:persistent="props.persistant"
|
|
9
|
+
@keydown.esc="!persistant ? annuler : ''"
|
|
10
|
+
@click:outside="!persistant ? annuler : ''"
|
|
11
|
+
>
|
|
12
|
+
<v-card class="pa-0 ma-0 pl-8 pt-8">
|
|
13
|
+
<!-- Bouton en haut à droite -->
|
|
14
|
+
<v-btn
|
|
15
|
+
icon="mdi-close"
|
|
16
|
+
variant="text"
|
|
17
|
+
class="position-absolute couleurHover"
|
|
18
|
+
style="top: 5px; right: 5px"
|
|
19
|
+
@click="annuler"
|
|
20
|
+
></v-btn>
|
|
21
|
+
|
|
22
|
+
<v-card-title
|
|
23
|
+
class="pa-0 ma-0 pb-6"
|
|
24
|
+
style="font-size: 24px"
|
|
25
|
+
>
|
|
26
|
+
<slot name="titre"></slot>
|
|
27
|
+
<div class="headline">{{ titre }}</div>
|
|
28
|
+
</v-card-title>
|
|
29
|
+
|
|
30
|
+
<v-card-text class="pa-0 ma-0 pb-6 pr-6">
|
|
31
|
+
<v-container>
|
|
32
|
+
<slot></slot>
|
|
33
|
+
<slot name="content"></slot>
|
|
34
|
+
</v-container>
|
|
35
|
+
</v-card-text>
|
|
36
|
+
<v-card-actions class="my-2 d-flex justify-end pr-6 pb-5">
|
|
37
|
+
<slot name="actions"></slot>
|
|
38
|
+
<v-btn
|
|
39
|
+
v-if="btnAnnuler"
|
|
40
|
+
color="primary"
|
|
41
|
+
:loading="operationEnCours"
|
|
42
|
+
variant="text"
|
|
43
|
+
@click="annuler"
|
|
44
|
+
>
|
|
45
|
+
{{ btnAnnulerTexte ? btnAnnulerTexte : $t('csqc-composants-ui.boutton.annuler') }}
|
|
46
|
+
</v-btn>
|
|
47
|
+
|
|
48
|
+
<v-btn
|
|
49
|
+
v-if="btnOk"
|
|
50
|
+
class="Gouttiere"
|
|
51
|
+
color="primary"
|
|
52
|
+
variant="flat"
|
|
53
|
+
:loading="operationEnCours"
|
|
54
|
+
:disabled="btnOkDesactiver"
|
|
55
|
+
@click="okBouton"
|
|
56
|
+
outlined
|
|
57
|
+
>
|
|
58
|
+
{{ btnOkTexte ? btnOkTexte : $t('csqc-composants-ui.boutton.ok') }}
|
|
59
|
+
</v-btn>
|
|
60
|
+
</v-card-actions>
|
|
61
|
+
</v-card>
|
|
62
|
+
</v-dialog>
|
|
63
|
+
</template>
|
|
64
|
+
|
|
65
|
+
<script setup lang="ts">
|
|
66
|
+
import { ref } from 'vue'
|
|
67
|
+
import { useDisplay } from 'vuetify'
|
|
68
|
+
|
|
69
|
+
const display = useDisplay()
|
|
70
|
+
|
|
71
|
+
// Déclaration des props
|
|
72
|
+
const props = defineProps({
|
|
73
|
+
largeur: { type: String, default: '50vw' },
|
|
74
|
+
persistant: { type: Boolean, default: true },
|
|
75
|
+
operationEnCours: { type: Boolean, default: false },
|
|
76
|
+
btnAnnuler: { type: Boolean, default: true },
|
|
77
|
+
btnOk: { type: Boolean, default: true },
|
|
78
|
+
btnAnnulerTexte: { type: String, default: '' },
|
|
79
|
+
btnOkTexte: { type: String, default: '' },
|
|
80
|
+
titre: { type: String, default: '' },
|
|
81
|
+
btnOkDesactiver: { type: Boolean, default: false },
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
// Déclaration des événements émis
|
|
85
|
+
const emit = defineEmits(['annuler', 'ok'])
|
|
86
|
+
|
|
87
|
+
// Gestion de l'état du dialogue
|
|
88
|
+
const dialog = ref(false)
|
|
89
|
+
|
|
90
|
+
// Méthodes pour gérer l'ouverture et la fermeture
|
|
91
|
+
const ouvrir = () => {
|
|
92
|
+
dialog.value = true
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const fermer = () => {
|
|
96
|
+
dialog.value = false
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Gestion des actions des boutons
|
|
100
|
+
const annuler = () => {
|
|
101
|
+
emit('annuler')
|
|
102
|
+
fermer()
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const okBouton = () => {
|
|
106
|
+
emit('ok')
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// permet d'exporter les 2 actions
|
|
110
|
+
defineExpose({ ouvrir, fermer })
|
|
111
|
+
</script>
|
|
112
|
+
|
|
113
|
+
<style lang="css" scoped>
|
|
114
|
+
.v-card__text,
|
|
115
|
+
.v-card__title {
|
|
116
|
+
word-break: normal; /* empeche le wrap de couper un mot en XS */
|
|
117
|
+
}
|
|
118
|
+
</style>
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="pt-4 pb-4 pl-4">
|
|
3
|
+
<v-row dense>
|
|
4
|
+
<v-col
|
|
5
|
+
cols="9"
|
|
6
|
+
md="8"
|
|
7
|
+
lg="6"
|
|
8
|
+
>
|
|
9
|
+
<div class="labelSwitchSiSwitchApres">{{ texte }}</div>
|
|
10
|
+
</v-col>
|
|
11
|
+
<v-col
|
|
12
|
+
cols="2"
|
|
13
|
+
class="flex-grow-1 d-flex justify-end pt-0 mt-0 pb-0 mb-0"
|
|
14
|
+
>
|
|
15
|
+
<v-switch
|
|
16
|
+
v-model="maValeur"
|
|
17
|
+
:disabled="desactiver"
|
|
18
|
+
@change="sauvegarder"
|
|
19
|
+
hide-details
|
|
20
|
+
/>
|
|
21
|
+
</v-col>
|
|
22
|
+
</v-row>
|
|
23
|
+
<v-row dense>
|
|
24
|
+
<v-col
|
|
25
|
+
cols="9"
|
|
26
|
+
md="8"
|
|
27
|
+
>
|
|
28
|
+
<span v-html="texteDetaille"></span>
|
|
29
|
+
</v-col>
|
|
30
|
+
</v-row>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
<script setup lang="ts">
|
|
34
|
+
import { ref, watch, defineProps, defineEmits, onMounted } from 'vue'
|
|
35
|
+
|
|
36
|
+
// Définition des props
|
|
37
|
+
const props = defineProps({
|
|
38
|
+
valeurInverse: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: false,
|
|
41
|
+
},
|
|
42
|
+
desactiver: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: false,
|
|
45
|
+
},
|
|
46
|
+
modelValue: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
required: true,
|
|
49
|
+
},
|
|
50
|
+
texte: {
|
|
51
|
+
type: String,
|
|
52
|
+
required: true,
|
|
53
|
+
},
|
|
54
|
+
texteDetaille: {
|
|
55
|
+
type: String,
|
|
56
|
+
required: true,
|
|
57
|
+
},
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
// Définition de l'événement
|
|
61
|
+
const emit = defineEmits(['update:modelValue'])
|
|
62
|
+
|
|
63
|
+
// Référence pour la valeur interne
|
|
64
|
+
const maValeur = ref<boolean>(false)
|
|
65
|
+
|
|
66
|
+
// Montée du composant
|
|
67
|
+
onMounted(() => {
|
|
68
|
+
if (props.valeurInverse) {
|
|
69
|
+
maValeur.value = !props.modelValue
|
|
70
|
+
} else {
|
|
71
|
+
maValeur.value = props.modelValue
|
|
72
|
+
}
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
// Watcher pour suivre les changements de la prop 'value'
|
|
76
|
+
watch(
|
|
77
|
+
() => props.modelValue,
|
|
78
|
+
newValue => {
|
|
79
|
+
if (props.valeurInverse) {
|
|
80
|
+
maValeur.value = !newValue
|
|
81
|
+
} else {
|
|
82
|
+
maValeur.value = newValue
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
watch(
|
|
88
|
+
() => props.valeurInverse,
|
|
89
|
+
newValue => {
|
|
90
|
+
if (props.valeurInverse) {
|
|
91
|
+
maValeur.value = newValue
|
|
92
|
+
} else {
|
|
93
|
+
maValeur.value = !newValue
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
// Méthode pour sauvegarder la valeur
|
|
99
|
+
const sauvegarder = () => {
|
|
100
|
+
if (props.valeurInverse) {
|
|
101
|
+
emit('update:modelValue', !maValeur.value)
|
|
102
|
+
} else {
|
|
103
|
+
emit('update:modelValue', maValeur.value)
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
</script>
|
|
107
|
+
|
|
108
|
+
<style lang="css" scoped>
|
|
109
|
+
.labelSwitchSiSwitchApres {
|
|
110
|
+
font-weight: bold;
|
|
111
|
+
margin-top: 25px;
|
|
112
|
+
}
|
|
113
|
+
</style>
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<v-row
|
|
4
|
+
dense
|
|
5
|
+
class="pt-0 mt-0"
|
|
6
|
+
>
|
|
7
|
+
<v-col>
|
|
8
|
+
<v-text-field
|
|
9
|
+
v-model="rechercheLocale"
|
|
10
|
+
:label="rechercheTexte ? rechercheTexte : $t('csqcRecherche.rechercher')"
|
|
11
|
+
single-line
|
|
12
|
+
density="compact"
|
|
13
|
+
hide-details
|
|
14
|
+
clearable
|
|
15
|
+
rounded="0"
|
|
16
|
+
max-width="640"
|
|
17
|
+
class="BarreRecherche"
|
|
18
|
+
:loading="chargement"
|
|
19
|
+
:disabled="chargement || desactiver"
|
|
20
|
+
>
|
|
21
|
+
<template v-slot:append>
|
|
22
|
+
<v-btn
|
|
23
|
+
variant="flat"
|
|
24
|
+
class="BarreRechercheBackIcone"
|
|
25
|
+
:loading="chargement"
|
|
26
|
+
:disabled="chargement || desactiver"
|
|
27
|
+
>
|
|
28
|
+
<v-icon
|
|
29
|
+
class="BarreRechercheIcone"
|
|
30
|
+
icon="mdi-magnify"
|
|
31
|
+
/>
|
|
32
|
+
</v-btn>
|
|
33
|
+
</template>
|
|
34
|
+
</v-text-field>
|
|
35
|
+
</v-col>
|
|
36
|
+
</v-row>
|
|
37
|
+
<v-row
|
|
38
|
+
dense
|
|
39
|
+
class="pt-0 mt-0"
|
|
40
|
+
>
|
|
41
|
+
<v-col
|
|
42
|
+
cols="12"
|
|
43
|
+
md="10"
|
|
44
|
+
lg="8"
|
|
45
|
+
>
|
|
46
|
+
<v-expansion-panels
|
|
47
|
+
static
|
|
48
|
+
v-if="rechercheAvancee"
|
|
49
|
+
:readonly="chargement || desactiver"
|
|
50
|
+
expand-icon=""
|
|
51
|
+
>
|
|
52
|
+
<v-expansion-panel
|
|
53
|
+
flat
|
|
54
|
+
elevation="0"
|
|
55
|
+
>
|
|
56
|
+
<v-expansion-panel-title
|
|
57
|
+
style="color: #095797"
|
|
58
|
+
class="pl-0 ml-0"
|
|
59
|
+
>
|
|
60
|
+
<span
|
|
61
|
+
style="text-decoration: underline"
|
|
62
|
+
v-html="rechercheAvanceeTexte ? rechercheAvanceeTexte : $t('csqcRecherche.rechercheAvanceeDefaut')"
|
|
63
|
+
></span>
|
|
64
|
+
</v-expansion-panel-title>
|
|
65
|
+
<v-expansion-panel-text>
|
|
66
|
+
<slot name="rechercheAvancee"></slot>
|
|
67
|
+
</v-expansion-panel-text>
|
|
68
|
+
</v-expansion-panel>
|
|
69
|
+
</v-expansion-panels>
|
|
70
|
+
</v-col>
|
|
71
|
+
</v-row>
|
|
72
|
+
</div>
|
|
73
|
+
</template>
|
|
74
|
+
|
|
75
|
+
<script lang="ts" setup>
|
|
76
|
+
import { ref, watch } from 'vue'
|
|
77
|
+
|
|
78
|
+
// Props
|
|
79
|
+
const props = defineProps({
|
|
80
|
+
rechercheTexte: {
|
|
81
|
+
type: String,
|
|
82
|
+
required: false,
|
|
83
|
+
},
|
|
84
|
+
rechercheAvanceeTexte: {
|
|
85
|
+
type: String,
|
|
86
|
+
required: false,
|
|
87
|
+
},
|
|
88
|
+
chargement: {
|
|
89
|
+
type: Boolean,
|
|
90
|
+
required: false,
|
|
91
|
+
default: false,
|
|
92
|
+
},
|
|
93
|
+
desactiver: {
|
|
94
|
+
type: Boolean,
|
|
95
|
+
required: false,
|
|
96
|
+
default: false,
|
|
97
|
+
},
|
|
98
|
+
recherche: {
|
|
99
|
+
type: String,
|
|
100
|
+
required: false,
|
|
101
|
+
},
|
|
102
|
+
rechercheAvancee: {
|
|
103
|
+
type: Boolean,
|
|
104
|
+
required: false,
|
|
105
|
+
default: false,
|
|
106
|
+
},
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
const emit = defineEmits<{
|
|
110
|
+
(e: 'update:recherche', recherche: string): void
|
|
111
|
+
}>()
|
|
112
|
+
|
|
113
|
+
// Création d'une variable locale pour gérer la recherche
|
|
114
|
+
const rechercheLocale = ref(props.recherche)
|
|
115
|
+
|
|
116
|
+
// Surveiller les changements de la prop `recherche` et mettre à jour `rechercheLocale`
|
|
117
|
+
watch(
|
|
118
|
+
() => props.recherche,
|
|
119
|
+
nouvelleValeur => {
|
|
120
|
+
rechercheLocale.value = nouvelleValeur
|
|
121
|
+
},
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
// Émettre l'événement `update:recherche` chaque fois que l'utilisateur tape
|
|
125
|
+
watch(rechercheLocale, nouvelleValeur => {
|
|
126
|
+
emit('update:recherche', nouvelleValeur!)
|
|
127
|
+
})
|
|
128
|
+
</script>
|
|
129
|
+
|
|
130
|
+
<style lang="css">
|
|
131
|
+
/* barre de recherche design QC*/
|
|
132
|
+
.BarreRecherche {
|
|
133
|
+
min-height: 40px;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.BarreRechercheBackIcone {
|
|
137
|
+
border-right: 1px solid #808a9d;
|
|
138
|
+
border-top: 1px solid #808a9d;
|
|
139
|
+
border-bottom: 1px solid #808a9d;
|
|
140
|
+
background-color: #095797 !important;
|
|
141
|
+
height: 40px !important;
|
|
142
|
+
width: 40px !important;
|
|
143
|
+
max-width: 40px !important;
|
|
144
|
+
min-width: 40px !important;
|
|
145
|
+
padding-right: 0 !important;
|
|
146
|
+
padding-left: 0 !important;
|
|
147
|
+
border-radius: 0;
|
|
148
|
+
margin-left: -16px;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* icone loupe */
|
|
152
|
+
.BarreRechercheIcone {
|
|
153
|
+
font-size: 34px !important;
|
|
154
|
+
margin-left: 1px !important;
|
|
155
|
+
margin-top: 2px !important;
|
|
156
|
+
color: white !important;
|
|
157
|
+
}
|
|
158
|
+
</style>
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-snackbar
|
|
3
|
+
v-model="snackbar"
|
|
4
|
+
:timeout="tempsFinal"
|
|
5
|
+
:style="styleCss"
|
|
6
|
+
multi-line
|
|
7
|
+
:location="position"
|
|
8
|
+
:color="props.couleur"
|
|
9
|
+
@update:modelValue="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 v-slot: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
|
+
dark
|
|
23
|
+
style="cursor: pointer"
|
|
24
|
+
@click.stop="fermer"
|
|
25
|
+
>
|
|
26
|
+
mdi-close
|
|
27
|
+
</v-icon>
|
|
28
|
+
</template>
|
|
29
|
+
</v-snackbar>
|
|
30
|
+
</template>
|
|
31
|
+
<script lang="ts" setup>
|
|
32
|
+
import { computed, ref, watch, type PropType } from 'vue'
|
|
33
|
+
|
|
34
|
+
// Définir les props avec les types
|
|
35
|
+
const props = defineProps({
|
|
36
|
+
styleCss: {
|
|
37
|
+
type: String,
|
|
38
|
+
required: false,
|
|
39
|
+
},
|
|
40
|
+
temps: {
|
|
41
|
+
type: Number,
|
|
42
|
+
required: false,
|
|
43
|
+
default: 4000,
|
|
44
|
+
validator(value: number) {
|
|
45
|
+
// Si la valeur est inférieure à -1, on la remplace par -1
|
|
46
|
+
if (value < -1) {
|
|
47
|
+
return false // Laisser échouer la validation pour gérer ça dans une logique personnalisée
|
|
48
|
+
}
|
|
49
|
+
// Validation que la valeur soit comprise entre -1 et Number.MAX_VALUE
|
|
50
|
+
return value <= Number.MAX_VALUE
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
message: {
|
|
54
|
+
type: String,
|
|
55
|
+
required: true,
|
|
56
|
+
},
|
|
57
|
+
titre: {
|
|
58
|
+
type: String,
|
|
59
|
+
required: false,
|
|
60
|
+
},
|
|
61
|
+
couleur: {
|
|
62
|
+
type: String,
|
|
63
|
+
required: false,
|
|
64
|
+
default: 'success',
|
|
65
|
+
},
|
|
66
|
+
position: {
|
|
67
|
+
type: String as PropType<'top' | 'bottom' | 'left' | 'right' | 'center'>,
|
|
68
|
+
required: false,
|
|
69
|
+
default: 'left',
|
|
70
|
+
},
|
|
71
|
+
btnFermer: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
required: false,
|
|
74
|
+
default: true,
|
|
75
|
+
},
|
|
76
|
+
})
|
|
77
|
+
const emit = defineEmits(['fermer:snackbar'])
|
|
78
|
+
const fermer = (): void => {
|
|
79
|
+
snackbar.value = false
|
|
80
|
+
emit('fermer:snackbar')
|
|
81
|
+
}
|
|
82
|
+
// Déclarer l'état réactif pour snackbar
|
|
83
|
+
const snackbar = ref(false)
|
|
84
|
+
const message = computed(() => props.message)
|
|
85
|
+
const tempsFinal = computed(() => {
|
|
86
|
+
if (props.temps < -1) {
|
|
87
|
+
return -1 // Si la valeur est inférieure à -1, on la met à -1
|
|
88
|
+
}
|
|
89
|
+
if (props.temps >= 0 && props.temps < 1000) return 1000 // on met 1 seconde minimum sinon one ne la voit pas
|
|
90
|
+
|
|
91
|
+
return props.temps // Sinon, on retourne la valeur de la prop
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
watch(message, nouveau => {
|
|
95
|
+
if (nouveau != null && nouveau !== '') {
|
|
96
|
+
snackbar.value = true
|
|
97
|
+
}
|
|
98
|
+
})
|
|
99
|
+
</script>
|