codevdesign 1.0.47 → 1.0.49
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/chaiseItem.vue +54 -54
- package/composants/csqcConfirmation.vue +75 -75
- package/composants/csqcDate.vue +57 -57
- package/composants/csqcEntete.vue +79 -55
- package/composants/csqcImportCSV.vue +125 -125
- package/composants/csqcOptionSwitch.vue +193 -102
- package/composants/csqcSnackbar.vue +207 -207
- package/composants/csqcTexteBilingue.vue +175 -175
- package/composants/gabarit/csqcMenu.vue +281 -281
- package/locales/fr.json +3 -0
- package/modeles/composants/csqcMenuModele.ts +18 -18
- package/modeles/composants/datatableColonne.ts +31 -31
- package/outils/appAxios.ts +116 -116
- package/package.json +1 -1
|
@@ -19,60 +19,66 @@
|
|
|
19
19
|
class="pr-0 mr-0 pl-5"
|
|
20
20
|
>
|
|
21
21
|
<v-toolbar-title class="titre">
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
22
|
+
<div class="entete-ligne">
|
|
23
|
+
<!-- GAUCHE -->
|
|
24
|
+
<div class="entete-gauche">
|
|
25
|
+
<!-- Barre de retour -->
|
|
26
|
+
<slot name="retour">
|
|
27
|
+
<v-icon
|
|
28
|
+
v-if="retour"
|
|
29
|
+
size="large"
|
|
30
|
+
start
|
|
31
|
+
:color="iconeCouleur"
|
|
32
|
+
icon="mdi-arrow-left-thin"
|
|
33
|
+
@click="retournerMenu"
|
|
34
|
+
/>
|
|
35
|
+
</slot>
|
|
36
|
+
|
|
37
|
+
<div class="titre-bloc">
|
|
38
|
+
<slot name="titre">
|
|
39
|
+
<span class="pl-3 titre-texte">{{ props.titre }}</span>
|
|
40
|
+
</slot>
|
|
41
|
+
|
|
42
|
+
<slot name="etat">
|
|
43
|
+
<span
|
|
44
|
+
v-if="monEtat?.afficher"
|
|
45
|
+
class="pl-10"
|
|
46
|
+
>
|
|
47
|
+
<v-btn
|
|
48
|
+
size="small"
|
|
49
|
+
:color="monEtat.couleur"
|
|
50
|
+
variant="tonal"
|
|
51
|
+
>
|
|
52
|
+
{{ monEtat.texte }}
|
|
53
|
+
</v-btn>
|
|
54
|
+
</span>
|
|
55
|
+
</slot>
|
|
56
|
+
|
|
57
|
+
<slot name="etatSecondaire">
|
|
58
|
+
<span
|
|
59
|
+
v-if="monEtatSecondaire?.afficher"
|
|
60
|
+
class="pl-3"
|
|
61
|
+
>
|
|
62
|
+
<v-btn
|
|
63
|
+
size="small"
|
|
64
|
+
:color="monEtatSecondaire.couleur"
|
|
65
|
+
variant="tonal"
|
|
66
|
+
>
|
|
67
|
+
{{ monEtatSecondaire.texte }}
|
|
68
|
+
</v-btn>
|
|
69
|
+
</span>
|
|
70
|
+
</slot>
|
|
71
|
+
|
|
72
|
+
<slot name="soustitre">
|
|
73
|
+
<span class="pl-3 soustitre-texte">{{ props.soustitre }}</span>
|
|
74
|
+
</slot>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
<!-- DROITE -->
|
|
79
|
+
<div class="entete-droite">
|
|
80
|
+
<slot name="droite" />
|
|
81
|
+
</div>
|
|
76
82
|
</div>
|
|
77
83
|
</v-toolbar-title>
|
|
78
84
|
</v-col>
|
|
@@ -157,7 +163,25 @@
|
|
|
157
163
|
color: var(--entete-icone, #6b7280); /* grisMoyen approx si hex */
|
|
158
164
|
}
|
|
159
165
|
.v-icon:hover {
|
|
160
|
-
/* tu peux garder une couleur fixe ou calculer une teinte plus foncée si besoin */
|
|
161
166
|
filter: brightness(0.85);
|
|
162
167
|
}
|
|
168
|
+
.entete-ligne {
|
|
169
|
+
display: flex;
|
|
170
|
+
align-items: center;
|
|
171
|
+
width: 100%;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.entete-gauche {
|
|
175
|
+
display: flex;
|
|
176
|
+
align-items: center;
|
|
177
|
+
min-width: 0; /* important pour éviter overflow */
|
|
178
|
+
flex: 1;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.entete-droite {
|
|
182
|
+
display: flex;
|
|
183
|
+
align-items: center;
|
|
184
|
+
gap: 12px;
|
|
185
|
+
padding-right: 16px;
|
|
186
|
+
}
|
|
163
187
|
</style>
|
|
@@ -1,125 +1,125 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<v-btn
|
|
4
|
-
color="success"
|
|
5
|
-
variant="outlined"
|
|
6
|
-
:loading="chargement"
|
|
7
|
-
class="elevation-0"
|
|
8
|
-
@click="importCsv"
|
|
9
|
-
>
|
|
10
|
-
{{ boutonTexte }}
|
|
11
|
-
<template #append>
|
|
12
|
-
<v-icon icon="mdi-microsoft-excel"></v-icon>
|
|
13
|
-
</template>
|
|
14
|
-
</v-btn>
|
|
15
|
-
|
|
16
|
-
<input
|
|
17
|
-
ref="fileInput"
|
|
18
|
-
type="file"
|
|
19
|
-
accept=".csv"
|
|
20
|
-
style="display: none"
|
|
21
|
-
@change="handleFileUpload"
|
|
22
|
-
/>
|
|
23
|
-
</div>
|
|
24
|
-
</template>
|
|
25
|
-
|
|
26
|
-
<script setup lang="ts">
|
|
27
|
-
import { ref, computed } from 'vue'
|
|
28
|
-
import { useI18n } from 'vue-i18n'
|
|
29
|
-
|
|
30
|
-
// Props
|
|
31
|
-
const props = withDefaults(
|
|
32
|
-
defineProps<{
|
|
33
|
-
boutonTexte?: string
|
|
34
|
-
erreurTexte?: string
|
|
35
|
-
chargement?: boolean
|
|
36
|
-
}>(),
|
|
37
|
-
{
|
|
38
|
-
chargement: false, // défaut
|
|
39
|
-
},
|
|
40
|
-
)
|
|
41
|
-
const emit = defineEmits(['import', 'import-erreur'])
|
|
42
|
-
|
|
43
|
-
const { t } = useI18n()
|
|
44
|
-
|
|
45
|
-
const boutonTexte = computed(() => props.boutonTexte ?? t('csqc.bouton.importer'))
|
|
46
|
-
const erreurTexte = computed(() => props.erreurTexte ?? t('csqc.csqcImportCSV.erreur.lectureFichier'))
|
|
47
|
-
|
|
48
|
-
// Références
|
|
49
|
-
const fileInput = ref<HTMLInputElement | null>(null)
|
|
50
|
-
const csvFile = ref<File | null>(null)
|
|
51
|
-
|
|
52
|
-
// Méthodes
|
|
53
|
-
function importCsv() {
|
|
54
|
-
fileInput.value?.click()
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function handleFileUpload(event: Event) {
|
|
58
|
-
const target = event.target as HTMLInputElement
|
|
59
|
-
const file = target.files?.[0]
|
|
60
|
-
|
|
61
|
-
if (file?.name.toLowerCase().endsWith('.csv')) {
|
|
62
|
-
csvFile.value = file
|
|
63
|
-
|
|
64
|
-
const reader = new FileReader()
|
|
65
|
-
|
|
66
|
-
reader.onload = () => {
|
|
67
|
-
try {
|
|
68
|
-
let text = reader.result as string
|
|
69
|
-
|
|
70
|
-
// Supprime BOM UTF-8 si présent
|
|
71
|
-
if (text.charCodeAt(0) === 0xfeff) {
|
|
72
|
-
text = text.slice(1)
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const lignes = text
|
|
76
|
-
.trim()
|
|
77
|
-
.split(/\r?\n/)
|
|
78
|
-
.filter(row => row.trim() !== '') // ignore lignes vides
|
|
79
|
-
|
|
80
|
-
if (lignes.length === 0) {
|
|
81
|
-
emit('import-erreur', 'Le fichier CSV est vide.')
|
|
82
|
-
return
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Détection automatique du séparateur
|
|
86
|
-
const separateur = detecterSeparateur(lignes[0]!)
|
|
87
|
-
|
|
88
|
-
// Découpage des lignes
|
|
89
|
-
const data: string[][] = lignes.map(row => row.split(separateur).map(cell => cell.trim()))
|
|
90
|
-
|
|
91
|
-
emit('import', data)
|
|
92
|
-
} catch (error) {
|
|
93
|
-
emit('import-erreur', erreurTexte || t('csqc.csqcImportCSV.erreur.lectureFichier'))
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
reader.onerror = () => {
|
|
98
|
-
emit('import-erreur', t('csqc.csqcImportCSV.erreur.lectureFichier'))
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
reader.readAsText(file)
|
|
102
|
-
} else {
|
|
103
|
-
const message = erreurTexte || t('csqc.csqcImportCSV.erreur.erreur')
|
|
104
|
-
emit('import-erreur', message)
|
|
105
|
-
csvFile.value = null
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// Fonction pour détecter le séparateur le plus probable
|
|
110
|
-
function detecterSeparateur(ligne: string): string {
|
|
111
|
-
const separateursTestés = [',', ';', '\t', '|']
|
|
112
|
-
let meilleurSeparateur = ','
|
|
113
|
-
let maxColonnes = 0
|
|
114
|
-
|
|
115
|
-
for (const sep of separateursTestés) {
|
|
116
|
-
const nb = ligne.split(sep).length
|
|
117
|
-
if (nb > maxColonnes) {
|
|
118
|
-
maxColonnes = nb
|
|
119
|
-
meilleurSeparateur = sep
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return meilleurSeparateur
|
|
124
|
-
}
|
|
125
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<v-btn
|
|
4
|
+
color="success"
|
|
5
|
+
variant="outlined"
|
|
6
|
+
:loading="chargement"
|
|
7
|
+
class="elevation-0"
|
|
8
|
+
@click="importCsv"
|
|
9
|
+
>
|
|
10
|
+
{{ boutonTexte }}
|
|
11
|
+
<template #append>
|
|
12
|
+
<v-icon icon="mdi-microsoft-excel"></v-icon>
|
|
13
|
+
</template>
|
|
14
|
+
</v-btn>
|
|
15
|
+
|
|
16
|
+
<input
|
|
17
|
+
ref="fileInput"
|
|
18
|
+
type="file"
|
|
19
|
+
accept=".csv"
|
|
20
|
+
style="display: none"
|
|
21
|
+
@change="handleFileUpload"
|
|
22
|
+
/>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script setup lang="ts">
|
|
27
|
+
import { ref, computed } from 'vue'
|
|
28
|
+
import { useI18n } from 'vue-i18n'
|
|
29
|
+
|
|
30
|
+
// Props
|
|
31
|
+
const props = withDefaults(
|
|
32
|
+
defineProps<{
|
|
33
|
+
boutonTexte?: string
|
|
34
|
+
erreurTexte?: string
|
|
35
|
+
chargement?: boolean
|
|
36
|
+
}>(),
|
|
37
|
+
{
|
|
38
|
+
chargement: false, // défaut
|
|
39
|
+
},
|
|
40
|
+
)
|
|
41
|
+
const emit = defineEmits(['import', 'import-erreur'])
|
|
42
|
+
|
|
43
|
+
const { t } = useI18n()
|
|
44
|
+
|
|
45
|
+
const boutonTexte = computed(() => props.boutonTexte ?? t('csqc.bouton.importer'))
|
|
46
|
+
const erreurTexte = computed(() => props.erreurTexte ?? t('csqc.csqcImportCSV.erreur.lectureFichier'))
|
|
47
|
+
|
|
48
|
+
// Références
|
|
49
|
+
const fileInput = ref<HTMLInputElement | null>(null)
|
|
50
|
+
const csvFile = ref<File | null>(null)
|
|
51
|
+
|
|
52
|
+
// Méthodes
|
|
53
|
+
function importCsv() {
|
|
54
|
+
fileInput.value?.click()
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function handleFileUpload(event: Event) {
|
|
58
|
+
const target = event.target as HTMLInputElement
|
|
59
|
+
const file = target.files?.[0]
|
|
60
|
+
|
|
61
|
+
if (file?.name.toLowerCase().endsWith('.csv')) {
|
|
62
|
+
csvFile.value = file
|
|
63
|
+
|
|
64
|
+
const reader = new FileReader()
|
|
65
|
+
|
|
66
|
+
reader.onload = () => {
|
|
67
|
+
try {
|
|
68
|
+
let text = reader.result as string
|
|
69
|
+
|
|
70
|
+
// Supprime BOM UTF-8 si présent
|
|
71
|
+
if (text.charCodeAt(0) === 0xfeff) {
|
|
72
|
+
text = text.slice(1)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const lignes = text
|
|
76
|
+
.trim()
|
|
77
|
+
.split(/\r?\n/)
|
|
78
|
+
.filter(row => row.trim() !== '') // ignore lignes vides
|
|
79
|
+
|
|
80
|
+
if (lignes.length === 0) {
|
|
81
|
+
emit('import-erreur', 'Le fichier CSV est vide.')
|
|
82
|
+
return
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Détection automatique du séparateur
|
|
86
|
+
const separateur = detecterSeparateur(lignes[0]!)
|
|
87
|
+
|
|
88
|
+
// Découpage des lignes
|
|
89
|
+
const data: string[][] = lignes.map(row => row.split(separateur).map(cell => cell.trim()))
|
|
90
|
+
|
|
91
|
+
emit('import', data)
|
|
92
|
+
} catch (error) {
|
|
93
|
+
emit('import-erreur', erreurTexte || t('csqc.csqcImportCSV.erreur.lectureFichier'))
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
reader.onerror = () => {
|
|
98
|
+
emit('import-erreur', t('csqc.csqcImportCSV.erreur.lectureFichier'))
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
reader.readAsText(file)
|
|
102
|
+
} else {
|
|
103
|
+
const message = erreurTexte || t('csqc.csqcImportCSV.erreur.erreur')
|
|
104
|
+
emit('import-erreur', message)
|
|
105
|
+
csvFile.value = null
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Fonction pour détecter le séparateur le plus probable
|
|
110
|
+
function detecterSeparateur(ligne: string): string {
|
|
111
|
+
const separateursTestés = [',', ';', '\t', '|']
|
|
112
|
+
let meilleurSeparateur = ','
|
|
113
|
+
let maxColonnes = 0
|
|
114
|
+
|
|
115
|
+
for (const sep of separateursTestés) {
|
|
116
|
+
const nb = ligne.split(sep).length
|
|
117
|
+
if (nb > maxColonnes) {
|
|
118
|
+
maxColonnes = nb
|
|
119
|
+
meilleurSeparateur = sep
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return meilleurSeparateur
|
|
124
|
+
}
|
|
125
|
+
</script>
|