codevdesign 1.0.75 → 1.0.77

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,46 +1,46 @@
1
- <template>
2
- <v-icon
3
- end
4
- color="grisMoyen"
5
- icon="mdi-microsoft-excel"
6
- @click="exportToXLSX"
7
- >
8
- </v-icon>
9
- </template>
10
-
11
- <script setup lang="ts">
12
- import { utils, writeFileXLSX } from '@e965/xlsx'
13
- import type Colonne from '../../modeles/composants/datatableColonne'
14
-
15
- const props = defineProps<{
16
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
- liste: any[]
18
- nomFichier: string
19
- chargementListe: boolean
20
- colonnes: Colonne[]
21
- }>()
22
-
23
- // Fonction pour exporter les données en Excel
24
- const exportToXLSX = () => {
25
- if (!props.liste.length) {
26
- console.warn('La liste est vide, exportation annulée.')
27
- return
28
- }
29
-
30
- // Colonnes affichées (on exclut action et ancre)
31
- const colonnesExport = props.colonnes.filter(c => c.key && c.key !== 'action' && c.key !== 'ancre')
32
-
33
- const headers = colonnesExport.map(c => c.title ?? String(c.key))
34
- const keys = colonnesExport.map(c => String(c.key))
35
-
36
- const rows = props.liste.map(item => {
37
- return keys.map(key => (key in item ? item[key] : ''))
38
- })
39
-
40
- const data = [headers, ...rows]
41
- const ws = utils.aoa_to_sheet(data)
42
- const wb = utils.book_new()
43
- utils.book_append_sheet(wb, ws, '1')
44
- writeFileXLSX(wb, `${props.nomFichier}.xlsx`)
45
- }
46
- </script>
1
+ <template>
2
+ <v-icon
3
+ end
4
+ color="grisMoyen"
5
+ icon="mdi-microsoft-excel"
6
+ @click="exportToXLSX"
7
+ >
8
+ </v-icon>
9
+ </template>
10
+
11
+ <script setup lang="ts">
12
+ import { utils, writeFileXLSX } from '@e965/xlsx'
13
+ import type Colonne from '../../modeles/composants/datatableColonne'
14
+
15
+ const props = defineProps<{
16
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
+ liste: any[]
18
+ nomFichier: string
19
+ chargementListe: boolean
20
+ colonnes: Colonne[]
21
+ }>()
22
+
23
+ // Fonction pour exporter les données en Excel
24
+ const exportToXLSX = () => {
25
+ if (!props.liste.length) {
26
+ console.warn('La liste est vide, exportation annulée.')
27
+ return
28
+ }
29
+
30
+ // Colonnes affichées (on exclut action et ancre)
31
+ const colonnesExport = props.colonnes.filter(c => c.key && c.key !== 'action' && c.key !== 'ancre')
32
+
33
+ const headers = colonnesExport.map(c => c.title ?? String(c.key))
34
+ const keys = colonnesExport.map(c => String(c.key))
35
+
36
+ const rows = props.liste.map(item => {
37
+ return keys.map(key => (key in item ? item[key] : ''))
38
+ })
39
+
40
+ const data = [headers, ...rows]
41
+ const ws = utils.aoa_to_sheet(data)
42
+ const wb = utils.book_new()
43
+ utils.book_append_sheet(wb, ws, '1')
44
+ writeFileXLSX(wb, `${props.nomFichier}.xlsx`)
45
+ }
46
+ </script>
@@ -5,28 +5,47 @@ class RafraichisseurToken {
5
5
  private popupAffiche = false
6
6
  private timerId: number | null = null
7
7
  private nomTemoin = 'csqc_jeton_secure_expiration'
8
- private urlPortail = ''
8
+ private urlPortailSeConnecter = ''
9
+ private urlPortailRafraichir = ''
10
+ private urlPortailDeconnecte = ''
9
11
  private refreshPromise: Promise<void> | null = null
10
12
  public loggerTrace = false
11
13
 
12
14
  // Lance une seule fois
13
- public async demarrer(nomTemoin: string, urlPortail: string): Promise<void> {
15
+ public async demarrer(
16
+ nomTemoin: string,
17
+ urlPortailSeConnecter: string,
18
+ urlPortailRafraichir: string,
19
+ urlPortailDeconnecte: string,
20
+ ): Promise<void> {
14
21
  window.rafraichisseurToken = this
15
22
  if (this.loggerTrace) {
16
23
  console.log('Nom témoin', nomTemoin)
17
- console.log('URL portail', urlPortail)
24
+ console.log('URL portail se connecter', urlPortailSeConnecter)
25
+ console.log('URL portail rafraichir', urlPortailRafraichir)
26
+ console.log('URL portail déconnecte', urlPortailDeconnecte)
18
27
  }
19
28
 
20
29
  if (nomTemoin == null || nomTemoin === '') {
21
30
  console.warn('[RafraichisseurToken] nomTemoin invalide, rafraichisseur de token désactivé')
22
31
  return
23
32
  }
24
- if (urlPortail == null || urlPortail === '') {
25
- console.warn('[RafraichisseurToken] urlPortail invalide, rafraichisseur de token désactivé')
33
+ if (urlPortailSeConnecter == null || urlPortailSeConnecter === '') {
34
+ console.warn('[RafraichisseurToken] urlPortailSeConnecter invalide, rafraichisseur de token désactivé')
35
+ return
36
+ }
37
+ if (urlPortailRafraichir == null || urlPortailRafraichir === '') {
38
+ console.warn('[RafraichisseurToken] urlPortailRafraichir invalide, rafraichisseur de token désactivé')
39
+ return
40
+ }
41
+ if (urlPortailDeconnecte == null || urlPortailDeconnecte === '') {
42
+ console.warn('[RafraichisseurToken] urlPortailDeconnecte invalide, rafraichisseur de token désactivé')
26
43
  return
27
44
  }
28
45
  this.nomTemoin = nomTemoin
29
- this.urlPortail = urlPortail.replace(/\/+$/, '')
46
+ this.urlPortailSeConnecter = urlPortailSeConnecter.replace(/\/+$/, '')
47
+ this.urlPortailRafraichir = urlPortailRafraichir.replace(/\/+$/, '')
48
+ this.urlPortailDeconnecte = urlPortailDeconnecte.replace(/\/+$/, '')
30
49
 
31
50
  await this.verifierJeton()
32
51
  if (this.timerId != null) return
@@ -36,6 +55,22 @@ class RafraichisseurToken {
36
55
  }
37
56
 
38
57
  public attendreRefreshSiNecessaire(force = false): Promise<void> {
58
+ if (this.urlPortailSeConnecter == null || this.urlPortailSeConnecter === '') {
59
+ if (this.loggerTrace)
60
+ console.warn(
61
+ '[RafraichisseurToken] attendreRefreshSiNecessaire appelé alors que aucun url se connecter a été configuré.',
62
+ )
63
+ return Promise.resolve()
64
+ }
65
+
66
+ if (this.urlPortailRafraichir == null || this.urlPortailRafraichir === '') {
67
+ if (this.loggerTrace)
68
+ console.warn(
69
+ '[RafraichisseurToken] attendreRefreshSiNecessaire appelé alors que aucun url rafraichir a été configuré.',
70
+ )
71
+ return Promise.resolve()
72
+ }
73
+
39
74
  if (this.refreshPromise) return this.refreshPromise
40
75
  if (force || !this.estJetonValide()) {
41
76
  this.refreshPromise = this.rafraichir().finally(() => {
@@ -106,7 +141,6 @@ class RafraichisseurToken {
106
141
  private async rafraichir(): Promise<void> {
107
142
  if (this.loggerTrace) console.log('[RafraichisseurToken] rafraichir() appelé')
108
143
 
109
- if (this.urlPortail == null || this.urlPortail == '') return
110
144
  this.popupAffiche = true // bloquer tout nouveau tick pendant le refresh
111
145
  const url = this.getRefreshUrl()
112
146
  const controller = new AbortController()
@@ -199,12 +233,12 @@ class RafraichisseurToken {
199
233
  //on envoie au portail, pas le choix
200
234
  const retour = encodeURI(window.location.href)
201
235
 
202
- window.open(`${this.urlPortail}/home/SeConnecter?urlRetour=${retour}`, '_self')
236
+ window.open(`${this.urlPortailSeConnecter}?urlRetour=${retour}`, '_self')
203
237
  return
204
238
  }
205
239
 
206
240
  public deconnecterPortail(): void {
207
- window.location.replace(`${this.urlPortail}/deconnecte?urlRetour=${encodeURIComponent(window.location.href)}`)
241
+ window.location.replace(`${this.urlPortailDeconnecte}?urlRetour=${encodeURIComponent(window.location.href)}`)
208
242
  }
209
243
 
210
244
  private lireCookie(): string | null {
@@ -255,7 +289,7 @@ class RafraichisseurToken {
255
289
  // URL refresh selon env (dev = proxy Vite ; prod = portail)
256
290
  private getRefreshUrl(): string {
257
291
  if (import.meta.env.MODE === 'development') return '/portail-refresh'
258
- return this.urlPortail + '/home/Refresh'
292
+ return this.urlPortailRafraichir
259
293
  }
260
294
  }
261
295
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codevdesign",
3
- "version": "1.0.75",
3
+ "version": "1.0.77",
4
4
  "description": "Composants Vuetify 3 pour les projets Codev",
5
5
  "files": [
6
6
  "./**/*.vue",