@tekkare/romulus 0.1.258 → 0.1.260

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
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.16.0"
6
6
  },
7
- "version": "0.1.257",
7
+ "version": "0.1.259",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
@@ -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 >= 0) chosenTab.value = index + 1;
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 requestedIdx = props.tab ? tabIndexOf(props.tab) : 0;
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(props.tab) === 'les' && props.indication) {
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
- if (!tabOpened) openRequestedTab();
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(() => {
@@ -79,14 +79,23 @@
79
79
  :data="row.doc"
80
80
  :linked-euct="row.linked"
81
81
  :highlight="highlight"
82
+ :class="{ linked_priority: isPriority(row) }"
82
83
  >
83
84
  <template #extra>
85
+ <RmTag v-if="isPriority(row)" variant="indigo">{{ priority?.label }}</RmTag>
84
86
  <RmTag v-if="row.extra?.role" variant="gray">{{ row.extra.role }}</RmTag>
85
87
  <OipScienceCommonScoreBadge :score="row.extra?.score" />
86
88
  </template>
87
89
  </OipScienceClinicalTrialsCardsGlobal>
88
- <OipScienceClinicalTrialsCards v-else :data="row.doc" :linked-nct="row.linked" :highlight="highlight">
90
+ <OipScienceClinicalTrialsCards
91
+ v-else
92
+ :data="row.doc"
93
+ :linked-nct="row.linked"
94
+ :highlight="highlight"
95
+ :class="{ linked_priority: isPriority(row) }"
96
+ >
89
97
  <template #extra>
98
+ <RmTag v-if="isPriority(row)" variant="indigo">{{ priority?.label }}</RmTag>
90
99
  <RmTag v-if="row.extra?.role" variant="gray">{{ row.extra.role }}</RmTag>
91
100
  <OipScienceCommonScoreBadge :score="row.extra?.score" />
92
101
  </template>
@@ -136,10 +145,22 @@ const props = withDefaults(
136
145
  loading?: boolean;
137
146
  /** Termes a surligner dans les cartes (filterStore dans FAS). */
138
147
  highlight?: string[];
148
+ /**
149
+ * Essais a mettre en tete et en avant, par numero NCT ou EUCT (ceux d'une
150
+ * recherche par maladie dans FAS), avec le libelle de leur etiquette.
151
+ */
152
+ priority?: { ids: string[]; label: string } | null;
139
153
  }>(),
140
- { nctIds: () => [], euctIds: () => [], extras: () => ({}), loading: false, highlight: () => [] },
154
+ { nctIds: () => [], euctIds: () => [], extras: () => ({}), loading: false, highlight: () => [], priority: null },
141
155
  );
142
156
 
157
+ const priorityIds = computed(() => new Set(props.priority?.ids ?? []));
158
+ /** Un essai compte aussi par son jumeau de l'autre registre. */
159
+ const isPriority = (row: Row) =>
160
+ priorityIds.value.has(row.id) ||
161
+ priorityIds.value.has(row.linked?.euct_number) ||
162
+ priorityIds.value.has(row.linked?.nct_id);
163
+
143
164
  const { locale } = useI18n();
144
165
  const lang = computed<'fr' | 'en'>(() => (locale.value === 'en' ? 'en' : 'fr'));
145
166
  const { queryCustomElastic } = useOipElastic();
@@ -226,7 +247,7 @@ const rows = computed<Row[]>(() => {
226
247
  date: new Date(doc.decision_date || doc.last_update_date || 0).getTime(),
227
248
  });
228
249
  }
229
- return out.sort((a, b) => b.date - a.date);
250
+ return out.sort((a, b) => Number(isPriority(b)) - Number(isPriority(a)) || b.date - a.date);
230
251
  });
231
252
 
232
253
  // ::::: Filtres locaux
@@ -359,6 +380,9 @@ watch(
359
380
  </script>
360
381
 
361
382
  <style scoped>
383
+ .linked_priority {
384
+ box-shadow: inset 3px 0 0 var(--color-secondary);
385
+ }
362
386
  .load_more {
363
387
  align-self: center;
364
388
  justify-self: center;
@@ -13,6 +13,7 @@
13
13
  :sources="['CT.gov', 'EUCT', 'FINESS']"
14
14
  index-last-update="CT.gov"
15
15
  :loading="isLoading"
16
+ :priority="priority"
16
17
  />
17
18
  </div>
18
19
  </template>
@@ -23,10 +24,20 @@ import useEstablishmentCrossData from '../../../oip-science/composables/useEstab
23
24
  // Meme forme que LinkedTrialExtra de clinical-trials/LinkedList.vue.
24
25
  type LinkedTrialExtra = { score?: number | null; role?: string | null };
25
26
 
26
- const props = withDefaults(defineProps<{ id: string; highlight?: string[]; lang?: 'fr' | 'en' }>(), {
27
- highlight: () => [],
28
- lang: undefined,
29
- });
27
+ const props = withDefaults(
28
+ defineProps<{
29
+ id: string;
30
+ highlight?: string[];
31
+ lang?: 'fr' | 'en';
32
+ /** Essais a mettre en tete et en avant (cf. clinical-trials/LinkedList.vue). */
33
+ priority?: { ids: string[]; label: string } | null;
34
+ }>(),
35
+ {
36
+ highlight: () => [],
37
+ lang: undefined,
38
+ priority: null,
39
+ },
40
+ );
30
41
 
31
42
  const { fetchCrossData } = useEstablishmentCrossData();
32
43
 
@@ -12,6 +12,7 @@
12
12
  :sources="['CT.gov', 'EUCT', 'RPPS']"
13
13
  index-last-update="HCPs"
14
14
  :loading="isLoading"
15
+ :priority="priority"
15
16
  />
16
17
  </div>
17
18
  </template>
@@ -24,10 +25,20 @@ import useOipElastic from '../../../oip-science/composables/useOipElastic';
24
25
  type LinkedTrialExtra = { score?: number | null; role?: string | null };
25
26
  type HcpTrialName = { first_name?: string; last_name?: string; name?: string; match_method: string; score: number };
26
27
 
27
- const props = withDefaults(defineProps<{ id: string; highlight?: string[]; lang?: 'fr' | 'en' }>(), {
28
- highlight: () => [],
29
- lang: undefined,
30
- });
28
+ const props = withDefaults(
29
+ defineProps<{
30
+ id: string;
31
+ highlight?: string[];
32
+ lang?: 'fr' | 'en';
33
+ /** Essais a mettre en tete et en avant (cf. clinical-trials/LinkedList.vue). */
34
+ priority?: { ids: string[]; label: string } | null;
35
+ }>(),
36
+ {
37
+ highlight: () => [],
38
+ lang: undefined,
39
+ priority: null,
40
+ },
41
+ );
31
42
 
32
43
  const { queryOneElastic } = useOipElastic();
33
44
 
@@ -6,14 +6,19 @@
6
6
  <div class="oip-science">
7
7
  <div v-if="!isLoading && pubmedResults.length" class="oip_grid gap-24">
8
8
  <RmResultsLine icon="Article" :items="[{ count: pubmedResults.length, label: $t('oipScience.resultKpis.publications', pubmedResults.length) }]" />
9
- <div v-for="(res, index) in pubmedResults" :key="index">
9
+ <div v-for="(res, index) in ordered" :key="index">
10
10
  <OipSciencePubmedCards
11
11
  :data="res"
12
12
  :id="res.PubMed_ID"
13
13
  :match-score="scoreByPmid[res.PubMed_ID] ?? null"
14
14
  :match-method="methodByPmid[res.PubMed_ID] || null"
15
15
  :highlight="highlight"
16
- />
16
+ :class="{ linked_priority: isPriority(res) }"
17
+ >
18
+ <template #extra>
19
+ <RmTag v-if="isPriority(res)" variant="indigo">{{ priority?.label }}</RmTag>
20
+ </template>
21
+ </OipSciencePubmedCards>
17
22
  </div>
18
23
  </div>
19
24
  <RmLoadingState v-if="isLoading" :lines="3" :chart-height="240" />
@@ -29,10 +34,20 @@
29
34
  import indexConfig from '../../../oip-science/indexConfig.json';
30
35
  import useOipElastic from '../../../oip-science/composables/useOipElastic';
31
36
 
32
- const props = withDefaults(defineProps<{ id: string; highlight?: string[]; lang?: 'fr' | 'en' }>(), {
33
- highlight: () => [],
34
- lang: undefined,
35
- });
37
+ const props = withDefaults(
38
+ defineProps<{
39
+ id: string;
40
+ highlight?: string[];
41
+ lang?: 'fr' | 'en';
42
+ /** Publications a mettre en tete et en avant, par PMID. */
43
+ priority?: { ids: string[]; label: string } | null;
44
+ }>(),
45
+ {
46
+ highlight: () => [],
47
+ lang: undefined,
48
+ priority: null,
49
+ },
50
+ );
36
51
 
37
52
  const { queryCustomElastic, queryOneElastic } = useOipElastic();
38
53
 
@@ -125,4 +140,17 @@ async function load(urlId: string) {
125
140
  }
126
141
 
127
142
  watch(() => props.id, (id) => { if (id) load(id); }, { immediate: true });
143
+
144
+ const priorityIds = computed(() => new Set(props.priority?.ids ?? []));
145
+ const isPriority = (res: any) => priorityIds.value.has(String(res?.PubMed_ID));
146
+ /** Les publications prioritaires d'abord, chaque groupe gardant l'ordre par date. */
147
+ const ordered = computed(() =>
148
+ [...pubmedResults.value].sort((a, b) => Number(isPriority(b)) - Number(isPriority(a))),
149
+ );
128
150
  </script>
151
+
152
+ <style scoped>
153
+ .linked_priority {
154
+ box-shadow: inset 3px 0 0 var(--color-secondary);
155
+ }
156
+ </style>
@@ -53,6 +53,7 @@
53
53
  :class="matchScore >= 0.85 ? 'score-high' : 'score-low'"
54
54
  :data-tooltip="$t('oipScience.common.matchingScoreTooltip')"
55
55
  >{{ $t('oipScience.cards.matchingScore') }} : {{ Math.round(matchScore * 100) }}%</span>
56
+ <slot name="extra" />
56
57
  </template>
57
58
 
58
59
  <RmDrawer v-model="showModal" size="md" :label="$t('oipScience.cards.pubmedAbstract')">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tekkare/romulus",
3
- "version": "0.1.258",
3
+ "version": "0.1.260",
4
4
  "description": "Romulus Design System - Nuxt module by Tekkare",
5
5
  "license": "MIT",
6
6
  "type": "module",