codevdesign 0.0.48 → 0.0.50
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/README.md +117 -117
- package/composants/csqcAide.vue +2 -2
- package/composants/csqcAlerteErreur.vue +86 -86
- package/composants/csqcChaise/chaiseItem.vue +53 -53
- package/composants/csqcConfirmation.vue +74 -74
- package/composants/csqcDialogue.vue +3 -4
- package/composants/csqcEntete.vue +127 -127
- package/composants/csqcOptionSwitch.vue +124 -124
- package/composants/csqcRecherche.vue +5 -2
- package/composants/csqcSnackbar.vue +1 -2
- package/composants/csqcTable/csqcTable.vue +389 -389
- package/composants/csqcTable/csqcTableExportExcel.vue +58 -58
- package/composants/csqcTexteBilingue.vue +13 -13
- package/composants/csqcTiroir.vue +1 -2
- package/composants/gabarit/csqcMenu.vue +7 -5
- package/composants/gabarit/pivEntete.vue +10 -6
- package/composants/gabarit/pivPiedPage.vue +70 -70
- package/composants/validateurs.ts +183 -181
- package/index.ts +68 -68
- package/modeles/apiReponse.ts +12 -12
- package/modeles/composants/datatableColonne.ts +14 -14
- package/modeles/composants/snackbar.ts +18 -18
- package/modeles/data.ts +24 -24
- package/modeles/droitIntervention.ts +14 -14
- package/modeles/groupeCE.ts +23 -23
- package/modeles/groupeCEIntervalle.ts +24 -24
- package/modeles/intervention.ts +35 -35
- package/modeles/notificationGabaritDefaut.ts +10 -10
- package/modeles/response.ts +12 -12
- package/modeles/role.ts +31 -31
- package/modeles/roleMin.ts +12 -12
- package/modeles/unite.ts +41 -41
- package/modeles/utilisateur.ts +32 -32
- package/package.json +1 -1
|
@@ -1,74 +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
|
-
<span v-html="texte"></span>
|
|
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>
|
|
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
|
+
<span v-html="texte"></span>
|
|
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>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<v-dialog
|
|
3
|
-
class="pa-0 ma-0"
|
|
4
3
|
v-model="dialog"
|
|
4
|
+
class="pa-0 ma-0"
|
|
5
5
|
:width="largeur"
|
|
6
6
|
:fullscreen="display.xs.value"
|
|
7
7
|
max-width="650"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
style="font-size: 24px; white-space: normal; word-break: break-word"
|
|
25
25
|
>
|
|
26
26
|
<slot name="titre"></slot>
|
|
27
|
-
<div
|
|
27
|
+
<div text-h5><span v-html="titre"></span></div>
|
|
28
28
|
</v-card-title>
|
|
29
29
|
|
|
30
30
|
<v-card-text class="pa-0 ma-0 pb-6 pr-6">
|
|
@@ -49,11 +49,10 @@
|
|
|
49
49
|
v-if="btnOk"
|
|
50
50
|
class="Gouttiere"
|
|
51
51
|
color="primary"
|
|
52
|
-
variant="flat"
|
|
53
52
|
:loading="operationEnCours"
|
|
54
53
|
:disabled="btnOkDesactiver"
|
|
54
|
+
variant="flat"
|
|
55
55
|
@click="okBouton"
|
|
56
|
-
outlined
|
|
57
56
|
>
|
|
58
57
|
{{ btnOkTexte ? btnOkTexte : $t('csqc.bouton.ok') }}
|
|
59
58
|
</v-btn>
|
|
@@ -1,127 +1,127 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<v-app-bar
|
|
3
|
-
color="white"
|
|
4
|
-
class="px-0 mx-0"
|
|
5
|
-
:style="{ position: 'sticky' }"
|
|
6
|
-
height="82px"
|
|
7
|
-
>
|
|
8
|
-
<v-row
|
|
9
|
-
class="pt-2"
|
|
10
|
-
@resize="controlAffichage"
|
|
11
|
-
>
|
|
12
|
-
<v-col
|
|
13
|
-
:cols="titreCol"
|
|
14
|
-
class="pr-0 mr-0 pl-5"
|
|
15
|
-
>
|
|
16
|
-
<v-toolbar-title class="titre">
|
|
17
|
-
<!-- Barre de retour -->
|
|
18
|
-
<slot name="retour">
|
|
19
|
-
<v-icon
|
|
20
|
-
v-if="retour"
|
|
21
|
-
size="large"
|
|
22
|
-
start
|
|
23
|
-
color="grisMoyen"
|
|
24
|
-
icon="mdi-arrow-left-thin"
|
|
25
|
-
@click="retournerMenu"
|
|
26
|
-
/></slot>
|
|
27
|
-
|
|
28
|
-
<div class="titre-bloc">
|
|
29
|
-
<!-- Titre -->
|
|
30
|
-
<slot name="titre"
|
|
31
|
-
><span class="pl-3"> {{ props.titre }}</span></slot
|
|
32
|
-
>
|
|
33
|
-
|
|
34
|
-
<!-- État -->
|
|
35
|
-
<slot name="etat">
|
|
36
|
-
<span
|
|
37
|
-
v-if="monEtat?.afficher"
|
|
38
|
-
class="pl-10"
|
|
39
|
-
>
|
|
40
|
-
<v-btn
|
|
41
|
-
size="small"
|
|
42
|
-
:color="monEtat.couleur"
|
|
43
|
-
variant="tonal"
|
|
44
|
-
>
|
|
45
|
-
{{ monEtat.texte }}
|
|
46
|
-
</v-btn>
|
|
47
|
-
</span></slot
|
|
48
|
-
>
|
|
49
|
-
|
|
50
|
-
<!-- Sous-titre -->
|
|
51
|
-
<slot name="soustitre"
|
|
52
|
-
><span class="pl-3 soustitre"> {{ props.soustitre }}</span></slot
|
|
53
|
-
>
|
|
54
|
-
</div>
|
|
55
|
-
</v-toolbar-title>
|
|
56
|
-
</v-col>
|
|
57
|
-
</v-row>
|
|
58
|
-
<!-- Barre en bas -->
|
|
59
|
-
<div style="position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background-color: #808a9d" />
|
|
60
|
-
</v-app-bar>
|
|
61
|
-
</template>
|
|
62
|
-
|
|
63
|
-
<script setup lang="ts">
|
|
64
|
-
import { useRouter } from 'vue-router'
|
|
65
|
-
import { ref, computed } from 'vue'
|
|
66
|
-
|
|
67
|
-
// Déclaration de l'interface
|
|
68
|
-
interface EnteteEtat {
|
|
69
|
-
afficher: boolean
|
|
70
|
-
couleur: string
|
|
71
|
-
texte: string
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const router = useRouter()
|
|
75
|
-
|
|
76
|
-
const props = defineProps<{
|
|
77
|
-
titre: string
|
|
78
|
-
soustitre?: string
|
|
79
|
-
retour?: string
|
|
80
|
-
etat?: EnteteEtat
|
|
81
|
-
}>()
|
|
82
|
-
|
|
83
|
-
const titreCol = ref(12)
|
|
84
|
-
|
|
85
|
-
// État calculé basé sur la prop, avec fallback
|
|
86
|
-
const monEtat = computed<EnteteEtat>(() => {
|
|
87
|
-
return (
|
|
88
|
-
props.etat ?? {
|
|
89
|
-
afficher: false,
|
|
90
|
-
couleur: 'primary',
|
|
91
|
-
texte: 'test',
|
|
92
|
-
}
|
|
93
|
-
)
|
|
94
|
-
})
|
|
95
|
-
|
|
96
|
-
function retournerMenu() {
|
|
97
|
-
if (props.retour) {
|
|
98
|
-
router.push({ name: props.retour })
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function controlAffichage() {
|
|
103
|
-
// logique à l’événement de redimensionnement
|
|
104
|
-
}
|
|
105
|
-
</script>
|
|
106
|
-
<style lang="css" scoped>
|
|
107
|
-
.titre {
|
|
108
|
-
font-size: 1.85rem;
|
|
109
|
-
color: #223654;
|
|
110
|
-
font-weight: bold;
|
|
111
|
-
margin-bottom: 15px;
|
|
112
|
-
}
|
|
113
|
-
.soustitre {
|
|
114
|
-
display: block;
|
|
115
|
-
font-size: 1rem;
|
|
116
|
-
color: #223654;
|
|
117
|
-
font-weight: normal;
|
|
118
|
-
}
|
|
119
|
-
.titre-bloc {
|
|
120
|
-
display: inline-block;
|
|
121
|
-
vertical-align: middle;
|
|
122
|
-
padding-left: 12px;
|
|
123
|
-
}
|
|
124
|
-
.v-icon:hover {
|
|
125
|
-
color: #095797 !important;
|
|
126
|
-
}
|
|
127
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<v-app-bar
|
|
3
|
+
color="white"
|
|
4
|
+
class="px-0 mx-0"
|
|
5
|
+
:style="{ position: 'sticky' }"
|
|
6
|
+
height="82px"
|
|
7
|
+
>
|
|
8
|
+
<v-row
|
|
9
|
+
class="pt-2"
|
|
10
|
+
@resize="controlAffichage"
|
|
11
|
+
>
|
|
12
|
+
<v-col
|
|
13
|
+
:cols="titreCol"
|
|
14
|
+
class="pr-0 mr-0 pl-5"
|
|
15
|
+
>
|
|
16
|
+
<v-toolbar-title class="titre">
|
|
17
|
+
<!-- Barre de retour -->
|
|
18
|
+
<slot name="retour">
|
|
19
|
+
<v-icon
|
|
20
|
+
v-if="retour"
|
|
21
|
+
size="large"
|
|
22
|
+
start
|
|
23
|
+
color="grisMoyen"
|
|
24
|
+
icon="mdi-arrow-left-thin"
|
|
25
|
+
@click="retournerMenu"
|
|
26
|
+
/></slot>
|
|
27
|
+
|
|
28
|
+
<div class="titre-bloc">
|
|
29
|
+
<!-- Titre -->
|
|
30
|
+
<slot name="titre"
|
|
31
|
+
><span class="pl-3"> {{ props.titre }}</span></slot
|
|
32
|
+
>
|
|
33
|
+
|
|
34
|
+
<!-- État -->
|
|
35
|
+
<slot name="etat">
|
|
36
|
+
<span
|
|
37
|
+
v-if="monEtat?.afficher"
|
|
38
|
+
class="pl-10"
|
|
39
|
+
>
|
|
40
|
+
<v-btn
|
|
41
|
+
size="small"
|
|
42
|
+
:color="monEtat.couleur"
|
|
43
|
+
variant="tonal"
|
|
44
|
+
>
|
|
45
|
+
{{ monEtat.texte }}
|
|
46
|
+
</v-btn>
|
|
47
|
+
</span></slot
|
|
48
|
+
>
|
|
49
|
+
|
|
50
|
+
<!-- Sous-titre -->
|
|
51
|
+
<slot name="soustitre"
|
|
52
|
+
><span class="pl-3 soustitre"> {{ props.soustitre }}</span></slot
|
|
53
|
+
>
|
|
54
|
+
</div>
|
|
55
|
+
</v-toolbar-title>
|
|
56
|
+
</v-col>
|
|
57
|
+
</v-row>
|
|
58
|
+
<!-- Barre en bas -->
|
|
59
|
+
<div style="position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background-color: #808a9d" />
|
|
60
|
+
</v-app-bar>
|
|
61
|
+
</template>
|
|
62
|
+
|
|
63
|
+
<script setup lang="ts">
|
|
64
|
+
import { useRouter } from 'vue-router'
|
|
65
|
+
import { ref, computed } from 'vue'
|
|
66
|
+
|
|
67
|
+
// Déclaration de l'interface
|
|
68
|
+
interface EnteteEtat {
|
|
69
|
+
afficher: boolean
|
|
70
|
+
couleur: string
|
|
71
|
+
texte: string
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const router = useRouter()
|
|
75
|
+
|
|
76
|
+
const props = defineProps<{
|
|
77
|
+
titre: string
|
|
78
|
+
soustitre?: string
|
|
79
|
+
retour?: string
|
|
80
|
+
etat?: EnteteEtat
|
|
81
|
+
}>()
|
|
82
|
+
|
|
83
|
+
const titreCol = ref(12)
|
|
84
|
+
|
|
85
|
+
// État calculé basé sur la prop, avec fallback
|
|
86
|
+
const monEtat = computed<EnteteEtat>(() => {
|
|
87
|
+
return (
|
|
88
|
+
props.etat ?? {
|
|
89
|
+
afficher: false,
|
|
90
|
+
couleur: 'primary',
|
|
91
|
+
texte: 'test',
|
|
92
|
+
}
|
|
93
|
+
)
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
function retournerMenu() {
|
|
97
|
+
if (props.retour) {
|
|
98
|
+
router.push({ name: props.retour })
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function controlAffichage() {
|
|
103
|
+
// logique à l’événement de redimensionnement
|
|
104
|
+
}
|
|
105
|
+
</script>
|
|
106
|
+
<style lang="css" scoped>
|
|
107
|
+
.titre {
|
|
108
|
+
font-size: 1.85rem;
|
|
109
|
+
color: #223654;
|
|
110
|
+
font-weight: bold;
|
|
111
|
+
margin-bottom: 15px;
|
|
112
|
+
}
|
|
113
|
+
.soustitre {
|
|
114
|
+
display: block;
|
|
115
|
+
font-size: 1rem;
|
|
116
|
+
color: #223654;
|
|
117
|
+
font-weight: normal;
|
|
118
|
+
}
|
|
119
|
+
.titre-bloc {
|
|
120
|
+
display: inline-block;
|
|
121
|
+
vertical-align: middle;
|
|
122
|
+
padding-left: 12px;
|
|
123
|
+
}
|
|
124
|
+
.v-icon:hover {
|
|
125
|
+
color: #095797 !important;
|
|
126
|
+
}
|
|
127
|
+
</style>
|
|
@@ -1,124 +1,124 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<v-row dense>
|
|
4
|
-
<v-col
|
|
5
|
-
cols="9"
|
|
6
|
-
md="8"
|
|
7
|
-
lg="6"
|
|
8
|
-
class="d-flex align-end"
|
|
9
|
-
>
|
|
10
|
-
<div class="labelSwitchSiSwitchApres">{{ texte }}</div>
|
|
11
|
-
</v-col>
|
|
12
|
-
<v-col
|
|
13
|
-
cols="2"
|
|
14
|
-
class="d-flex align-end justify-end"
|
|
15
|
-
>
|
|
16
|
-
<v-switch
|
|
17
|
-
v-model="maValeur"
|
|
18
|
-
:disabled="desactiver"
|
|
19
|
-
:density="densite"
|
|
20
|
-
:inset="inset"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
/>
|
|
24
|
-
</v-col>
|
|
25
|
-
</v-row>
|
|
26
|
-
<v-row dense>
|
|
27
|
-
<v-col
|
|
28
|
-
cols="9"
|
|
29
|
-
md="8"
|
|
30
|
-
>
|
|
31
|
-
<span v-html="texteDetaille"></span>
|
|
32
|
-
</v-col>
|
|
33
|
-
</v-row>
|
|
34
|
-
</div>
|
|
35
|
-
</template>
|
|
36
|
-
<script setup lang="ts">
|
|
37
|
-
import { ref, watch, onMounted, type PropType } from 'vue'
|
|
38
|
-
|
|
39
|
-
// Définition des props
|
|
40
|
-
const props = defineProps({
|
|
41
|
-
valeurInverse: {
|
|
42
|
-
type: Boolean,
|
|
43
|
-
default: false,
|
|
44
|
-
},
|
|
45
|
-
desactiver: {
|
|
46
|
-
type: Boolean,
|
|
47
|
-
default: false,
|
|
48
|
-
},
|
|
49
|
-
inset: {
|
|
50
|
-
type: Boolean,
|
|
51
|
-
default: true,
|
|
52
|
-
},
|
|
53
|
-
modelValue: {
|
|
54
|
-
type: Boolean,
|
|
55
|
-
required: true,
|
|
56
|
-
},
|
|
57
|
-
texte: {
|
|
58
|
-
type: String,
|
|
59
|
-
required: true,
|
|
60
|
-
},
|
|
61
|
-
texteDetaille: {
|
|
62
|
-
type: String,
|
|
63
|
-
required: true,
|
|
64
|
-
},
|
|
65
|
-
densite: { type: String as PropType<'default' | 'comfortable' | 'compact'>, default: 'compact' },
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
// Définition de l'événement
|
|
69
|
-
const emit = defineEmits(['update:modelValue'])
|
|
70
|
-
|
|
71
|
-
// Référence pour la valeur interne
|
|
72
|
-
const maValeur = ref<boolean>(false)
|
|
73
|
-
|
|
74
|
-
// Montée du composant
|
|
75
|
-
onMounted(() => {
|
|
76
|
-
if (props.valeurInverse) {
|
|
77
|
-
maValeur.value = !props.modelValue
|
|
78
|
-
} else {
|
|
79
|
-
maValeur.value = props.modelValue
|
|
80
|
-
}
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
// Watcher pour suivre les changements de la prop 'value'
|
|
84
|
-
watch(
|
|
85
|
-
() => props.modelValue,
|
|
86
|
-
newValue => {
|
|
87
|
-
if (props.valeurInverse) {
|
|
88
|
-
maValeur.value = !newValue
|
|
89
|
-
} else {
|
|
90
|
-
maValeur.value = newValue
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
)
|
|
94
|
-
|
|
95
|
-
watch(
|
|
96
|
-
() => props.valeurInverse,
|
|
97
|
-
newValue => {
|
|
98
|
-
if (props.valeurInverse) {
|
|
99
|
-
maValeur.value = newValue
|
|
100
|
-
} else {
|
|
101
|
-
maValeur.value = !newValue
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
)
|
|
105
|
-
|
|
106
|
-
// Méthode pour sauvegarder la valeur
|
|
107
|
-
const sauvegarder = () => {
|
|
108
|
-
if (props.valeurInverse) {
|
|
109
|
-
emit('update:modelValue', !maValeur.value)
|
|
110
|
-
} else {
|
|
111
|
-
emit('update:modelValue', maValeur.value)
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
</script>
|
|
115
|
-
|
|
116
|
-
<style lang="css" scoped>
|
|
117
|
-
.labelSwitchSiSwitchApres {
|
|
118
|
-
font-weight: bold;
|
|
119
|
-
margin-top: 25px;
|
|
120
|
-
}
|
|
121
|
-
.v-switch {
|
|
122
|
-
margin-bottom: -10px; /* aligner le switch avec son texte*/
|
|
123
|
-
}
|
|
124
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<v-row dense>
|
|
4
|
+
<v-col
|
|
5
|
+
cols="9"
|
|
6
|
+
md="8"
|
|
7
|
+
lg="6"
|
|
8
|
+
class="d-flex align-end"
|
|
9
|
+
>
|
|
10
|
+
<div class="labelSwitchSiSwitchApres">{{ texte }}</div>
|
|
11
|
+
</v-col>
|
|
12
|
+
<v-col
|
|
13
|
+
cols="2"
|
|
14
|
+
class="d-flex align-end justify-end"
|
|
15
|
+
>
|
|
16
|
+
<v-switch
|
|
17
|
+
v-model="maValeur"
|
|
18
|
+
:disabled="desactiver"
|
|
19
|
+
:density="densite"
|
|
20
|
+
:inset="inset"
|
|
21
|
+
hide-details
|
|
22
|
+
@update:modelValue="sauvegarder"
|
|
23
|
+
/>
|
|
24
|
+
</v-col>
|
|
25
|
+
</v-row>
|
|
26
|
+
<v-row dense>
|
|
27
|
+
<v-col
|
|
28
|
+
cols="9"
|
|
29
|
+
md="8"
|
|
30
|
+
>
|
|
31
|
+
<span v-html="texteDetaille"></span>
|
|
32
|
+
</v-col>
|
|
33
|
+
</v-row>
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
36
|
+
<script setup lang="ts">
|
|
37
|
+
import { ref, watch, onMounted, type PropType } from 'vue'
|
|
38
|
+
|
|
39
|
+
// Définition des props
|
|
40
|
+
const props = defineProps({
|
|
41
|
+
valeurInverse: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: false,
|
|
44
|
+
},
|
|
45
|
+
desactiver: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: false,
|
|
48
|
+
},
|
|
49
|
+
inset: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: true,
|
|
52
|
+
},
|
|
53
|
+
modelValue: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
required: true,
|
|
56
|
+
},
|
|
57
|
+
texte: {
|
|
58
|
+
type: String,
|
|
59
|
+
required: true,
|
|
60
|
+
},
|
|
61
|
+
texteDetaille: {
|
|
62
|
+
type: String,
|
|
63
|
+
required: true,
|
|
64
|
+
},
|
|
65
|
+
densite: { type: String as PropType<'default' | 'comfortable' | 'compact'>, default: 'compact' },
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
// Définition de l'événement
|
|
69
|
+
const emit = defineEmits(['update:modelValue'])
|
|
70
|
+
|
|
71
|
+
// Référence pour la valeur interne
|
|
72
|
+
const maValeur = ref<boolean>(false)
|
|
73
|
+
|
|
74
|
+
// Montée du composant
|
|
75
|
+
onMounted(() => {
|
|
76
|
+
if (props.valeurInverse) {
|
|
77
|
+
maValeur.value = !props.modelValue
|
|
78
|
+
} else {
|
|
79
|
+
maValeur.value = props.modelValue
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
// Watcher pour suivre les changements de la prop 'value'
|
|
84
|
+
watch(
|
|
85
|
+
() => props.modelValue,
|
|
86
|
+
newValue => {
|
|
87
|
+
if (props.valeurInverse) {
|
|
88
|
+
maValeur.value = !newValue
|
|
89
|
+
} else {
|
|
90
|
+
maValeur.value = newValue
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
watch(
|
|
96
|
+
() => props.valeurInverse,
|
|
97
|
+
newValue => {
|
|
98
|
+
if (props.valeurInverse) {
|
|
99
|
+
maValeur.value = newValue
|
|
100
|
+
} else {
|
|
101
|
+
maValeur.value = !newValue
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
// Méthode pour sauvegarder la valeur
|
|
107
|
+
const sauvegarder = () => {
|
|
108
|
+
if (props.valeurInverse) {
|
|
109
|
+
emit('update:modelValue', !maValeur.value)
|
|
110
|
+
} else {
|
|
111
|
+
emit('update:modelValue', maValeur.value)
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
</script>
|
|
115
|
+
|
|
116
|
+
<style lang="css" scoped>
|
|
117
|
+
.labelSwitchSiSwitchApres {
|
|
118
|
+
font-weight: bold;
|
|
119
|
+
margin-top: 25px;
|
|
120
|
+
}
|
|
121
|
+
.v-switch {
|
|
122
|
+
margin-bottom: -10px; /* aligner le switch avec son texte*/
|
|
123
|
+
}
|
|
124
|
+
</style>
|