feat(vue-fiches): tri ordre d'origine, triDefaut, libellés de vue et adaptateur mot (B6-M2)

Extensions optionnelles du composant partagé, sans effet sur / et /agences :
tri 'ordre' (ordre du tableau d'entrée) avec config.triDefaut et libellesTri,
prop libellesVue (Graphe au lieu de Carte, Voir dans le graphe), adaptateur
toMiniMot (kind 'mot'). 22 cas ajoutés à test-vue-fiches (80/80).

Co-Authored-By: Claude Sonnet <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0136n5xMLHuaBDLcPJYCDjRW
This commit is contained in:
Jules Neny
2026-10-08 16:56:18 +02:00
co-authored by Claude Sonnet
parent 68d3b080d7
commit 11f24c7925
5 changed files with 135 additions and 6 deletions
+7 -3
View File
@@ -23,7 +23,7 @@
:class="`vf-seg__btn--${e}`"
:aria-pressed="vf.vueAffichee === e"
@click="vf.setVue(e)"
>{{ LIBELLES_VUE[e] }}<span v-if="e === 'fiches'" class="vf-seg__n"> · {{ vf.resultat.length }}</span></button>
>{{ libellesVue?.[e] ?? LIBELLES_VUE[e] }}<span v-if="e === 'fiches'" class="vf-seg__n"> · {{ vf.resultat.length }}</span></button>
</div>
<label class="vf-recherche">
@@ -79,7 +79,7 @@
<label class="vf-select vf-select--tri">
<span>Tri</span>
<select :value="vf.tri" @change="vf.setTri(($event.target as HTMLSelectElement).value as TriFiches)">
<option v-for="t in vf.cfg.tris" :key="t" :value="t" :selected="t === vf.tri">{{ LIBELLES_TRI[t] }}</option>
<option v-for="t in vf.cfg.tris" :key="t" :value="t" :selected="t === vf.tri">{{ vf.cfg.libellesTri?.[t] ?? LIBELLES_TRI[t] }}</option>
</select>
</label>
@@ -248,7 +248,7 @@
<template v-if="vf.ficheOuverte">
<div class="vf-detail__actions">
<a v-if="lienPageFiche" :href="lienPageFiche" class="vf-lien">Ouvrir la page de la fiche</a>
<button v-if="peutCentrer" type="button" class="vf-lien" @click="vf.voirSurCarte(vf.ficheOuverte.id)">Voir sur la carte</button>
<button v-if="peutCentrer" type="button" class="vf-lien" @click="vf.voirSurCarte(vf.ficheOuverte.id)">{{ libelleVoirCarte }}</button>
<button type="button" class="vf-lien" @click="copierLien">Copier le lien</button>
<span class="vf-detail__statut" role="status">{{ statutLien }}</span>
</div>
@@ -311,6 +311,8 @@ const props = defineProps<{
selectedId?: string | number | null
/** Page propre de la fiche (`/fiche/:id` pour l'Entraide) ; null = pas de page, le lien partagé est l'URL avec `fiche=`. */
lienPage?: (f: MiniFiche) => string | null
/** Libellés des trois états quand « Carte » n'est pas le mot juste (ex. { carte: 'Graphe' }). Le paramètre d'URL reste `vue=carte`. */
libellesVue?: Partial<Record<EtatVue, string>>
}>()
const emit = defineEmits<{
@@ -319,6 +321,8 @@ const emit = defineEmits<{
}>()
const LIBELLES_VUE: Record<EtatVue, string> = { carte: 'Carte', mixte: 'Mixte', fiches: 'Fiches' }
/** « Voir sur la carte » suit le mot choisi pour l'état Carte : « Voir dans le graphe ». */
const libelleVoirCarte = computed(() => (props.libellesVue?.carte ? `Voir dans le ${props.libellesVue.carte.toLowerCase()}` : 'Voir sur la carte'))
const etatsBoutons = computed(() => (['carte', 'mixte', 'fiches'] as EtatVue[]).filter((e) => props.vf.cfg.etats.includes(e)))
// ── Pastilles actives (état Carte, et téléphone en Fiches) ──