codevdesign 1.0.4 → 1.0.6

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,120 +1,120 @@
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="compact"
20
- inset
21
- v-bind="$attrs"
22
- hide-details
23
- @update:model-value="sauvegarder"
24
- />
25
- </v-col>
26
- </v-row>
27
- <v-row dense>
28
- <v-col
29
- cols="9"
30
- md="8"
31
- >
32
- <span v-html="texteDetaille"></span>
33
- </v-col>
34
- </v-row>
35
- </div>
36
- </template>
37
- <script setup lang="ts">
38
- import { ref, watch, onMounted, type PropType } from 'vue'
39
-
40
- // Définition des props
41
- const props = defineProps({
42
- valeurInverse: {
43
- type: Boolean,
44
- default: false,
45
- },
46
- desactiver: {
47
- type: Boolean,
48
- default: false,
49
- },
50
- modelValue: {
51
- type: Boolean,
52
- required: true,
53
- },
54
- texte: {
55
- type: String,
56
- required: true,
57
- },
58
- texteDetaille: {
59
- type: String,
60
- required: true,
61
- },
62
- })
63
-
64
- // Définition de l'événement
65
- const emit = defineEmits(['update:modelValue'])
66
-
67
- // Référence pour la valeur interne
68
- const maValeur = ref<boolean>(false)
69
-
70
- // Montée du composant
71
- onMounted(() => {
72
- if (props.valeurInverse) {
73
- maValeur.value = !props.modelValue
74
- } else {
75
- maValeur.value = props.modelValue
76
- }
77
- })
78
-
79
- // Watcher pour suivre les changements de la prop 'value'
80
- watch(
81
- () => props.modelValue,
82
- newValue => {
83
- if (props.valeurInverse) {
84
- maValeur.value = !newValue
85
- } else {
86
- maValeur.value = newValue
87
- }
88
- },
89
- )
90
-
91
- watch(
92
- () => props.valeurInverse,
93
- newValue => {
94
- if (props.valeurInverse) {
95
- maValeur.value = newValue
96
- } else {
97
- maValeur.value = !newValue
98
- }
99
- },
100
- )
101
-
102
- // Méthode pour sauvegarder la valeur
103
- const sauvegarder = () => {
104
- if (props.valeurInverse) {
105
- emit('update:modelValue', !maValeur.value)
106
- } else {
107
- emit('update:modelValue', maValeur.value)
108
- }
109
- }
110
- </script>
111
-
112
- <style lang="css" scoped>
113
- .labelSwitchSiSwitchApres {
114
- font-weight: bold;
115
- margin-top: 25px;
116
- }
117
- .v-switch {
118
- margin-bottom: -10px; /* aligner le switch avec son texte*/
119
- }
120
- </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="compact"
20
+ inset
21
+ v-bind="$attrs"
22
+ hide-details
23
+ @update:model-value="sauvegarder"
24
+ />
25
+ </v-col>
26
+ </v-row>
27
+ <v-row dense>
28
+ <v-col
29
+ cols="9"
30
+ md="8"
31
+ >
32
+ <span v-html="texteDetaille"></span>
33
+ </v-col>
34
+ </v-row>
35
+ </div>
36
+ </template>
37
+ <script setup lang="ts">
38
+ import { ref, watch, onMounted, type PropType } from 'vue'
39
+
40
+ // Définition des props
41
+ const props = defineProps({
42
+ valeurInverse: {
43
+ type: Boolean,
44
+ default: false,
45
+ },
46
+ desactiver: {
47
+ type: Boolean,
48
+ default: false,
49
+ },
50
+ modelValue: {
51
+ type: Boolean,
52
+ required: true,
53
+ },
54
+ texte: {
55
+ type: String,
56
+ required: true,
57
+ },
58
+ texteDetaille: {
59
+ type: String,
60
+ required: true,
61
+ },
62
+ })
63
+
64
+ // Définition de l'événement
65
+ const emit = defineEmits(['update:modelValue'])
66
+
67
+ // Référence pour la valeur interne
68
+ const maValeur = ref<boolean>(false)
69
+
70
+ // Montée du composant
71
+ onMounted(() => {
72
+ if (props.valeurInverse) {
73
+ maValeur.value = !props.modelValue
74
+ } else {
75
+ maValeur.value = props.modelValue
76
+ }
77
+ })
78
+
79
+ // Watcher pour suivre les changements de la prop 'value'
80
+ watch(
81
+ () => props.modelValue,
82
+ newValue => {
83
+ if (props.valeurInverse) {
84
+ maValeur.value = !newValue
85
+ } else {
86
+ maValeur.value = newValue
87
+ }
88
+ },
89
+ )
90
+
91
+ watch(
92
+ () => props.valeurInverse,
93
+ newValue => {
94
+ if (props.valeurInverse) {
95
+ maValeur.value = newValue
96
+ } else {
97
+ maValeur.value = !newValue
98
+ }
99
+ },
100
+ )
101
+
102
+ // Méthode pour sauvegarder la valeur
103
+ const sauvegarder = () => {
104
+ if (props.valeurInverse) {
105
+ emit('update:modelValue', !maValeur.value)
106
+ } else {
107
+ emit('update:modelValue', maValeur.value)
108
+ }
109
+ }
110
+ </script>
111
+
112
+ <style lang="css" scoped>
113
+ .labelSwitchSiSwitchApres {
114
+ font-weight: bold;
115
+ margin-top: 25px;
116
+ }
117
+ .v-switch {
118
+ margin-bottom: -10px; /* aligner le switch avec son texte*/
119
+ }
120
+ </style>
@@ -1,212 +1,212 @@
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
- clearable
20
- :rounded="0"
21
- variant="outlined"
22
- max-width="640"
23
- min-width="500"
24
- class="BarreRecherche"
25
- :loading="chargement"
26
- :disabled="chargement || desactiver"
27
- >
28
- <template #append>
29
- <v-btn
30
- class="BarreRechercheBackIcone"
31
- :loading="chargement"
32
- :disabled="chargement || desactiver"
33
- >
34
- <v-icon
35
- class="BarreRechercheIcone"
36
- icon="mdi-magnify"
37
- />
38
- </v-btn>
39
- </template>
40
- </v-text-field>
41
- </v-col>
42
- <!-- Entre recherche et ajouté-->
43
- <v-col
44
- cols="12"
45
- sm="auto"
46
- class="pt-1 mt-0 pb-0 mb-0"
47
- >
48
- <slot name="milieu" />
49
- </v-col>
50
-
51
- <!-- Affichage des boutons et icônes-->
52
- <v-col
53
- cols="12"
54
- sm="auto"
55
- class="flex-grow-1 d-flex justify-end"
56
- >
57
- <slot name="droite" />
58
- </v-col>
59
- </v-row>
60
- <v-row
61
- dense
62
- class="pt-0 mt-0"
63
- >
64
- <v-col
65
- cols="12"
66
- :lg="rechercheAvanceeLargeur"
67
- >
68
- <v-expansion-panels
69
- v-if="rechercheAvancee"
70
- static
71
- :readonly="chargement || desactiver"
72
- expand-icon=""
73
- @update:model-value="onPanelChange"
74
- >
75
- <v-expansion-panel
76
- flat
77
- elevation="0"
78
- >
79
- <v-expansion-panel-title
80
- style="color: #095797"
81
- class="pl-0 ml-0"
82
- ><slot name="rechercheAvanceeTitre">
83
- <span
84
- style="text-decoration: underline"
85
- v-html="rechercheAvanceeTexte ? rechercheAvanceeTexte : $t('csqc.label.rechercheAvanceeDefaut')"
86
- ></span>
87
- <slot name="rechercheAvanceeApresTitre"></slot
88
- ></slot>
89
- </v-expansion-panel-title>
90
- <v-expansion-panel-text :style="rechercheAvanceeStyle">
91
- <slot name="rechercheAvancee"></slot>
92
- </v-expansion-panel-text>
93
- </v-expansion-panel>
94
- </v-expansion-panels>
95
- </v-col>
96
- </v-row>
97
- </div>
98
- </template>
99
-
100
- <script lang="ts" setup>
101
- import { ref, watch } from 'vue'
102
-
103
- // Props
104
- const props = defineProps({
105
- afficher: {
106
- type: Boolean,
107
- required: false,
108
- default: true,
109
- },
110
- rechercheTexte: {
111
- type: String,
112
- required: false,
113
- default: '',
114
- },
115
- rechercheAvanceeTexte: {
116
- type: String,
117
- required: false,
118
- default: '',
119
- },
120
- rechercheAvanceeLargeur: {
121
- type: Number,
122
- required: false,
123
- default: 12,
124
- },
125
- chargement: {
126
- type: Boolean,
127
- required: false,
128
- default: false,
129
- },
130
- desactiver: {
131
- type: Boolean,
132
- required: false,
133
- default: false,
134
- },
135
- recherche: {
136
- type: String,
137
- required: false,
138
- default: '',
139
- },
140
- rechercheAvancee: {
141
- type: Boolean,
142
- required: false,
143
- default: false,
144
- },
145
- rechercheAvanceeStyle: {
146
- type: String,
147
- required: false,
148
- default: '',
149
- },
150
- })
151
-
152
- const emit = defineEmits<{
153
- (e: 'update:recherche', recherche: string): void
154
- (e: 'panneau:etat', isOpen: boolean): void // événement pour l'ouverture/fermeture du panneau
155
- }>()
156
-
157
- // Création d'une variable locale pour gérer la recherche
158
- const rechercheLocale = ref(props.recherche)
159
-
160
- // Surveiller les changements de la prop `recherche` et mettre à jour `rechercheLocale`
161
- watch(
162
- () => props.recherche,
163
- nouvelleValeur => {
164
- rechercheLocale.value = nouvelleValeur
165
- },
166
- )
167
-
168
- // Émettre l'événement `update:recherche` chaque fois que l'utilisateur tape
169
- watch(rechercheLocale, nouvelleValeur => {
170
- emit('update:recherche', nouvelleValeur!)
171
- })
172
-
173
- // Fonction pour émettre l'événement d'ouverture/fermeture du panneau
174
- const onPanelChange = (val: unknown) => {
175
- if (typeof val === 'string' || typeof val === 'number' || val === null) {
176
- const isOpen = val !== null && val !== ''
177
- emit('panneau:etat', isOpen)
178
- } else {
179
- emit('panneau:etat', false)
180
- }
181
- }
182
- </script>
183
-
184
- <style lang="css">
185
- /* barre de recherche design QC*/
186
- .BarreRecherche {
187
- min-height: 40px;
188
- }
189
-
190
- .BarreRechercheBackIcone {
191
- border-right: 1px solid #808a9d;
192
- border-top: 1px solid #808a9d;
193
- border-bottom: 1px solid #808a9d;
194
- background-color: #095797 !important;
195
- height: 40px !important;
196
- width: 40px !important;
197
- max-width: 40px !important;
198
- min-width: 40px !important;
199
- padding-right: 0 !important;
200
- padding-left: 0 !important;
201
- border-radius: 0;
202
- margin-left: -16px;
203
- }
204
-
205
- /* icone loupe */
206
- .BarreRechercheIcone {
207
- font-size: 34px !important;
208
- margin-left: 1px !important;
209
- margin-top: 2px !important;
210
- color: white !important;
211
- }
212
- </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
+ clearable
20
+ :rounded="0"
21
+ variant="outlined"
22
+ max-width="640"
23
+ min-width="500"
24
+ class="BarreRecherche"
25
+ :loading="chargement"
26
+ :disabled="chargement || desactiver"
27
+ >
28
+ <template #append>
29
+ <v-btn
30
+ class="BarreRechercheBackIcone"
31
+ :loading="chargement"
32
+ :disabled="chargement || desactiver"
33
+ >
34
+ <v-icon
35
+ class="BarreRechercheIcone"
36
+ icon="mdi-magnify"
37
+ />
38
+ </v-btn>
39
+ </template>
40
+ </v-text-field>
41
+ </v-col>
42
+ <!-- Entre recherche et ajouté-->
43
+ <v-col
44
+ cols="12"
45
+ sm="auto"
46
+ class="pt-1 mt-0 pb-0 mb-0"
47
+ >
48
+ <slot name="milieu" />
49
+ </v-col>
50
+
51
+ <!-- Affichage des boutons et icônes-->
52
+ <v-col
53
+ cols="12"
54
+ sm="auto"
55
+ class="flex-grow-1 d-flex justify-end"
56
+ >
57
+ <slot name="droite" />
58
+ </v-col>
59
+ </v-row>
60
+ <v-row
61
+ dense
62
+ class="pt-0 mt-0"
63
+ >
64
+ <v-col
65
+ cols="12"
66
+ :lg="rechercheAvanceeLargeur"
67
+ >
68
+ <v-expansion-panels
69
+ v-if="rechercheAvancee"
70
+ static
71
+ :readonly="chargement || desactiver"
72
+ expand-icon=""
73
+ @update:model-value="onPanelChange"
74
+ >
75
+ <v-expansion-panel
76
+ flat
77
+ elevation="0"
78
+ >
79
+ <v-expansion-panel-title
80
+ style="color: #095797"
81
+ class="pl-0 ml-0"
82
+ ><slot name="rechercheAvanceeTitre">
83
+ <span
84
+ style="text-decoration: underline"
85
+ v-html="rechercheAvanceeTexte ? rechercheAvanceeTexte : $t('csqc.label.rechercheAvanceeDefaut')"
86
+ ></span>
87
+ <slot name="rechercheAvanceeApresTitre"></slot
88
+ ></slot>
89
+ </v-expansion-panel-title>
90
+ <v-expansion-panel-text :style="rechercheAvanceeStyle">
91
+ <slot name="rechercheAvancee"></slot>
92
+ </v-expansion-panel-text>
93
+ </v-expansion-panel>
94
+ </v-expansion-panels>
95
+ </v-col>
96
+ </v-row>
97
+ </div>
98
+ </template>
99
+
100
+ <script lang="ts" setup>
101
+ import { ref, watch } from 'vue'
102
+
103
+ // Props
104
+ const props = defineProps({
105
+ afficher: {
106
+ type: Boolean,
107
+ required: false,
108
+ default: true,
109
+ },
110
+ rechercheTexte: {
111
+ type: String,
112
+ required: false,
113
+ default: '',
114
+ },
115
+ rechercheAvanceeTexte: {
116
+ type: String,
117
+ required: false,
118
+ default: '',
119
+ },
120
+ rechercheAvanceeLargeur: {
121
+ type: Number,
122
+ required: false,
123
+ default: 12,
124
+ },
125
+ chargement: {
126
+ type: Boolean,
127
+ required: false,
128
+ default: false,
129
+ },
130
+ desactiver: {
131
+ type: Boolean,
132
+ required: false,
133
+ default: false,
134
+ },
135
+ recherche: {
136
+ type: String,
137
+ required: false,
138
+ default: '',
139
+ },
140
+ rechercheAvancee: {
141
+ type: Boolean,
142
+ required: false,
143
+ default: false,
144
+ },
145
+ rechercheAvanceeStyle: {
146
+ type: String,
147
+ required: false,
148
+ default: '',
149
+ },
150
+ })
151
+
152
+ const emit = defineEmits<{
153
+ (e: 'update:recherche', recherche: string): void
154
+ (e: 'panneau:etat', isOpen: boolean): void // événement pour l'ouverture/fermeture du panneau
155
+ }>()
156
+
157
+ // Création d'une variable locale pour gérer la recherche
158
+ const rechercheLocale = ref(props.recherche)
159
+
160
+ // Surveiller les changements de la prop `recherche` et mettre à jour `rechercheLocale`
161
+ watch(
162
+ () => props.recherche,
163
+ nouvelleValeur => {
164
+ rechercheLocale.value = nouvelleValeur
165
+ },
166
+ )
167
+
168
+ // Émettre l'événement `update:recherche` chaque fois que l'utilisateur tape
169
+ watch(rechercheLocale, nouvelleValeur => {
170
+ emit('update:recherche', nouvelleValeur!)
171
+ })
172
+
173
+ // Fonction pour émettre l'événement d'ouverture/fermeture du panneau
174
+ const onPanelChange = (val: unknown) => {
175
+ if (typeof val === 'string' || typeof val === 'number' || val === null) {
176
+ const isOpen = val !== null && val !== ''
177
+ emit('panneau:etat', isOpen)
178
+ } else {
179
+ emit('panneau:etat', false)
180
+ }
181
+ }
182
+ </script>
183
+
184
+ <style lang="css">
185
+ /* barre de recherche design QC*/
186
+ .BarreRecherche {
187
+ min-height: 40px;
188
+ }
189
+
190
+ .BarreRechercheBackIcone {
191
+ border-right: 1px solid #808a9d;
192
+ border-top: 1px solid #808a9d;
193
+ border-bottom: 1px solid #808a9d;
194
+ background-color: #095797 !important;
195
+ height: 40px !important;
196
+ width: 40px !important;
197
+ max-width: 40px !important;
198
+ min-width: 40px !important;
199
+ padding-right: 0 !important;
200
+ padding-left: 0 !important;
201
+ border-radius: 0;
202
+ margin-left: -16px;
203
+ }
204
+
205
+ /* icone loupe */
206
+ .BarreRechercheIcone {
207
+ font-size: 34px !important;
208
+ margin-left: 1px !important;
209
+ margin-top: 2px !important;
210
+ color: white !important;
211
+ }
212
+ </style>