@tekkare/romulus 0.1.258 → 0.1.259
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/dist/module.json
CHANGED
|
@@ -352,7 +352,10 @@ const headerTabs = computed(() =>
|
|
|
352
352
|
|
|
353
353
|
function selectTab(key: string) {
|
|
354
354
|
const index = availableTabs.value.findIndex((tb) => tb.key === key);
|
|
355
|
-
if (index
|
|
355
|
+
if (index < 0) return;
|
|
356
|
+
// Un clic pendant le chargement l'emporte sur l'onglet demande.
|
|
357
|
+
pendingTab.value = "";
|
|
358
|
+
chosenTab.value = index + 1;
|
|
356
359
|
}
|
|
357
360
|
|
|
358
361
|
/** Ecritures francaises acceptees dans `tab`, pour les liens partages. */
|
|
@@ -675,6 +678,13 @@ const isMounted = ref(false);
|
|
|
675
678
|
let generation = 0;
|
|
676
679
|
const live = (gen: number) => isMounted.value && gen === generation;
|
|
677
680
|
|
|
681
|
+
/**
|
|
682
|
+
* L'onglet demande au chargement, tant que sa section n'est pas arrivee : la
|
|
683
|
+
* fiche pose d'abord l'onglet HAS, et ne doit pas le remonter a l'appelant,
|
|
684
|
+
* qui reecrirait `?tab=` et perdrait la demande (prix, ANSM, LES...).
|
|
685
|
+
*/
|
|
686
|
+
const pendingTab = ref("");
|
|
687
|
+
|
|
678
688
|
watch(
|
|
679
689
|
() => chosenTab.value,
|
|
680
690
|
(val) => {
|
|
@@ -683,7 +693,7 @@ watch(
|
|
|
683
693
|
drawerRecord.value = null;
|
|
684
694
|
// L'onglet ouvert remonte a l'appelant (ex `?tab=` de la page).
|
|
685
695
|
const key = availableTabs.value[val - 1]?.key;
|
|
686
|
-
if (isMounted.value && key && normalizeTab(props.tab) !== key) {
|
|
696
|
+
if (isMounted.value && !pendingTab.value && key && normalizeTab(props.tab) !== key) {
|
|
687
697
|
emit("update:tab", key);
|
|
688
698
|
}
|
|
689
699
|
}
|
|
@@ -924,11 +934,12 @@ const searchTerms = computed<string[]>(() =>
|
|
|
924
934
|
* faux tant que la section n'est pas chargee : l'appelant reessaie plus tard.
|
|
925
935
|
*/
|
|
926
936
|
function openRequestedTab() {
|
|
927
|
-
const
|
|
937
|
+
const requested = pendingTab.value || props.tab;
|
|
938
|
+
const requestedIdx = requested ? tabIndexOf(requested) : 0;
|
|
928
939
|
if (requestedIdx === 0) return false;
|
|
929
940
|
chosenTab.value = requestedIdx;
|
|
930
941
|
// tab=les + indication=<code> : le tiroir de l'indication s'ouvre d'emblee.
|
|
931
|
-
if (normalizeTab(
|
|
942
|
+
if (normalizeTab(requested) === 'les' && props.indication) {
|
|
932
943
|
const record = lesRecords.value.find((r) => r.code === props.indication);
|
|
933
944
|
if (record) drawerLes.value = record;
|
|
934
945
|
}
|
|
@@ -955,6 +966,7 @@ function reset() {
|
|
|
955
966
|
|
|
956
967
|
async function loadAll() {
|
|
957
968
|
const gen = ++generation;
|
|
969
|
+
pendingTab.value = props.tab ?? "";
|
|
958
970
|
isLoadingSecondary.value = true;
|
|
959
971
|
await lanchQuery(gen);
|
|
960
972
|
if (!live(gen)) return;
|
|
@@ -989,8 +1001,13 @@ async function loadAll() {
|
|
|
989
1001
|
if (j !== -1) selectedMitmIndex.value = j;
|
|
990
1002
|
}
|
|
991
1003
|
|
|
992
|
-
// L'onglet demande dependait d'une section secondaire (prix, ANSM, LES...)
|
|
993
|
-
|
|
1004
|
+
// L'onglet demande dependait d'une section secondaire (prix, ANSM, LES...),
|
|
1005
|
+
// sauf si l'on a clique un onglet entre-temps.
|
|
1006
|
+
if (!tabOpened && pendingTab.value) openRequestedTab();
|
|
1007
|
+
// Plus rien en attente : l'onglet ouvert remonte a l'appelant s'il differe.
|
|
1008
|
+
pendingTab.value = "";
|
|
1009
|
+
const key = currentTabKey.value;
|
|
1010
|
+
if (key && normalizeTab(props.tab) !== key) emit("update:tab", key);
|
|
994
1011
|
}
|
|
995
1012
|
|
|
996
1013
|
onMounted(() => {
|