@tekkare/romulus 0.1.335 → 0.1.337

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.334",
7
+ "version": "0.1.336",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
@@ -21,8 +21,9 @@
21
21
  hauteur et au rayon de la rangee. Elles tomberont avec ces champs.
22
22
  -->
23
23
  <script setup lang="ts">
24
- import { computed, onBeforeUnmount, onMounted, ref, useSlots } from 'vue'
24
+ import { computed, nextTick, onBeforeUnmount, onMounted, ref, useSlots, watch } from 'vue'
25
25
  import { useRmFilterBarView } from '../composables/useRmFilterBarView'
26
+ import type { RmFilterSummaryItem } from './FilterSummary.vue'
26
27
 
27
28
  const props = withDefaults(
28
29
  defineProps<{
@@ -50,6 +51,12 @@ const props = withDefaults(
50
51
  * (le bandeau de page). Sa hauteur est suivie par ResizeObserver.
51
52
  */
52
53
  stickyTo?: string | null
54
+ /**
55
+ * Filtres poses, resumes en pills sous la barre quand le panneau est
56
+ * ferme (RmFilterSummary). Un clic ouvre le panneau sur le champ qui
57
+ * porte `data-rm-filter="<key>"`.
58
+ */
59
+ summary?: RmFilterSummaryItem[] | null
53
60
  }>(),
54
61
  {
55
62
  filtersAmount: 0,
@@ -62,6 +69,7 @@ const props = withDefaults(
62
69
  saveScopeMsg: null,
63
70
  lang: 'fr',
64
71
  stickyTo: 'rm_page_header',
72
+ summary: null,
65
73
  },
66
74
  )
67
75
 
@@ -109,6 +117,75 @@ function toggle(which: RmFilterBarPanel) {
109
117
  panel.value = panel.value === which ? null : which
110
118
  }
111
119
 
120
+ /**
121
+ * Ouvre le panneau sur un filtre : le champ qui porte `data-rm-filter="<key>"`.
122
+ * Une liste deroulante (`aria-haspopup`) s'ouvre ; tout autre champ (case,
123
+ * nombre) recoit seulement le focus, un clic le changerait.
124
+ */
125
+ async function openFilter(key: string) {
126
+ panel.value = 'filters'
127
+ await nextTick()
128
+ // Une tache plus tard, pas une micro-tache : le clic sur la pill est encore
129
+ // en train de remonter au document, et la liste qu'on ouvrirait le prendrait
130
+ // pour un clic dehors et se refermerait aussitot.
131
+ await new Promise((resolve) => setTimeout(resolve))
132
+ const field = root.value?.querySelector<HTMLElement>(`.rm-fbar__filters [data-rm-filter="${CSS.escape(key)}"]`)
133
+ if (!field) return
134
+ field.scrollIntoView({ block: 'nearest' })
135
+ const trigger = field.matches('[aria-haspopup]') ? field : field.querySelector<HTMLElement>('[aria-haspopup]')
136
+ if (trigger) {
137
+ trigger.focus()
138
+ trigger.click()
139
+ return
140
+ }
141
+ field.querySelector<HTMLElement>('input, select, textarea, button, [tabindex]:not([tabindex="-1"])')?.focus()
142
+ }
143
+
144
+ defineExpose({ openFilter })
145
+
146
+ /**
147
+ * Les pills suivent l'ordre des champs du panneau : la page les decrit dans
148
+ * l'ordre de son etat, qui n'est pas celui qu'on lit en ouvrant les filtres.
149
+ * Relu a chaque changement du resume : un champ peut apparaitre avec les
150
+ * donnees. Un filtre sans champ marque passe en dernier.
151
+ */
152
+ const fieldOrder = ref<string[]>([])
153
+
154
+ function readFieldOrder() {
155
+ const fields = root.value?.querySelectorAll<HTMLElement>('.rm-fbar__filters [data-rm-filter]') ?? []
156
+ fieldOrder.value = [...fields].map((field) => field.dataset.rmFilter ?? '')
157
+ }
158
+
159
+ const orderedSummary = computed(() => {
160
+ const order = fieldOrder.value
161
+ const rank = (key: string) => (order.includes(key) ? order.indexOf(key) : order.length)
162
+ return [...(props.summary ?? [])].sort((a, b) => rank(a.key) - rank(b.key))
163
+ })
164
+
165
+ watch(() => props.summary, () => nextTick(readFieldOrder))
166
+
167
+ /**
168
+ * Les pills flottent sous la barre, par-dessus le contenu quand la page
169
+ * defile. En haut de page, elles ne doivent rien recouvrir : la barre garde
170
+ * en marge basse la hauteur de leur rangee (plusieurs lignes si elles
171
+ * passent a la ligne).
172
+ */
173
+ const summaryEl = ref<HTMLElement | null>(null)
174
+ const summaryHeight = ref(0)
175
+ let summarySize: ResizeObserver | null = null
176
+
177
+ watch(summaryEl, (el) => {
178
+ summarySize?.disconnect()
179
+ summarySize = null
180
+ summaryHeight.value = 0
181
+ if (!el) return
182
+ summarySize = new ResizeObserver(() => {
183
+ summaryHeight.value = el.offsetHeight
184
+ })
185
+ summarySize.observe(el)
186
+ summaryHeight.value = el.offsetHeight
187
+ })
188
+
112
189
  /**
113
190
  * Un clic hors de la barre referme le panneau ouvert. Les menus des listes
114
191
  * deroulantes, les popovers et les modales sont teleportes sous <body>, hors
@@ -175,6 +252,7 @@ function watchHeader() {
175
252
  onMounted(() => {
176
253
  watchHeader()
177
254
  watchAdvanced()
255
+ readFieldOrder()
178
256
  document.addEventListener('pointerdown', onDocPointerDown)
179
257
  })
180
258
 
@@ -183,6 +261,8 @@ onBeforeUnmount(() => {
183
261
  headerSize = null
184
262
  advancedSize?.disconnect()
185
263
  advancedSize = null
264
+ summarySize?.disconnect()
265
+ summarySize = null
186
266
  document.removeEventListener('pointerdown', onDocPointerDown)
187
267
  })
188
268
  </script>
@@ -193,7 +273,11 @@ onBeforeUnmount(() => {
193
273
  ref="root"
194
274
  class="rm-fbar"
195
275
  :class="panel ? 'rm-fbar--open' : 'rm-fbar--closed'"
196
- :style="{ top: `${stickyTop}px`, '--rm-fbar-advanced-w': `${advancedWidth}px` }"
276
+ :style="{
277
+ top: `${stickyTop}px`,
278
+ '--rm-fbar-advanced-w': `${advancedWidth}px`,
279
+ marginBottom: summaryHeight ? `calc(${summaryHeight}px + 2 * var(--space-8))` : undefined,
280
+ }"
197
281
  >
198
282
  <!-- La bande traverse le cadre ; la rangee, elle, se cale sur la colonne
199
283
  de contenu et ne s'en ecarte que si son contenu ne tient pas : un rail
@@ -282,6 +366,15 @@ onBeforeUnmount(() => {
282
366
  </div>
283
367
  </div>
284
368
 
369
+ <!-- Panneau ferme, ce qui est filtre reste lisible : une pill par filtre
370
+ pose, qui flotte sous la barre, hors de sa bande, par-dessus le
371
+ contenu. Panneau ouvert, les champs le disent deja. -->
372
+ <div v-if="$slots.Filters && summary?.length && !panel" ref="summaryEl" class="rm-fbar__summary">
373
+ <div class="rm-fbar__summary-row">
374
+ <RmFilterSummary :items="orderedSummary" :lang="lang" @pick="openFilter" />
375
+ </div>
376
+ </div>
377
+
285
378
  <div v-if="$slots.Filters" v-show="open" class="rm-fbar__panel">
286
379
  <!-- Le panneau se presente comme une section : son titre, et les
287
380
  commandes juste a cote, pres des filtres qu'elles vident. -->
@@ -340,5 +433,5 @@ onBeforeUnmount(() => {
340
433
  </template>
341
434
 
342
435
  <style scoped>
343
- .rm-fbar{margin-inline:calc((min(var(--oip-content-max, 100%), 100%) - var(--oip-main-w, 100%))/2);position:sticky;width:var(--oip-main-w,100%);z-index:91;--rm-fbar-field-h:32px;backdrop-filter:blur(12px);background:color-mix(in srgb,var(--bg-surface-3) 80%,transparent);border-bottom:1px solid var(--border-default);display:flex;flex-direction:column;font-family:var(--font-sans)}.rm-fbar__views{align-items:center;display:flex;flex:0 0 auto}.rm-fbar__views:empty{display:none}.rm-fbar__band{display:flex;justify-content:center;padding-inline:32px}.rm-fbar__rail-row,.rm-fbar__row{max-width:100%;min-width:min(100%,var(--oip-content-max,100%));width:-moz-max-content;width:max-content}.rm-fbar__row{align-items:flex-start;display:flex;gap:var(--space-12);padding-block:8px}.rm-fbar--open .rm-fbar__band:not(:has(~.rm-fbar__band--rail)){border-bottom:1px solid var(--border-default)}.rm-fbar__toggle :deep(p),.rm-fbar__toggle :deep(span){font-size:inherit;font-weight:inherit;line-height:inherit;margin:0}.rm-fbar__toggle{align-items:center;background:var(--bg-surface);border:1px solid var(--border-default);border-radius:var(--radius-pill);color:var(--text-primary);cursor:pointer;display:flex;flex:0 0 auto;font-family:inherit;font-size:var(--font-14);font-weight:var(--weight-medium);gap:var(--space-6);height:var(--rm-fbar-field-h);justify-content:center;padding:0 14px}.rm-fbar__toggle:hover{background:var(--bg-surface-3)}.rm-fbar__toggle.is-active,.rm-fbar__toggle.is-active:hover{background:var(--color-primary);border-color:var(--color-primary);color:var(--color-text-inverse)}.rm-fbar__toggle.is-active .rm-fbar__badge{background:var(--color-text-inverse);color:var(--color-primary)}.rm-fbar__badge{align-items:center;background:var(--color-primary);border-radius:16px;color:var(--color-text-inverse);display:inline-flex;font-size:var(--font-11);font-weight:var(--weight-bold);justify-content:center;min-width:18px;padding:0 5px}.rm-fbar__view{align-items:center;display:flex;flex:0 0 auto}.rm-fbar__advanced{align-items:center;background:none;border:none;border-left:1px solid var(--border-default);color:var(--color-primary);cursor:pointer;display:inline-flex;font-family:inherit;font-size:var(--font-13);font-weight:var(--weight-medium);height:var(--rm-fbar-field-h);padding:0 0 0 var(--space-12);position:absolute;right:14px;text-decoration-line:underline;top:0;white-space:nowrap;z-index:2}.rm-fbar__advanced.is-active,.rm-fbar__advanced:hover{color:var(--color-primary-hover,var(--color-primary));text-decoration-thickness:2px}.rm-fbar__rail-row{display:flex;padding-bottom:var(--space-8)}.rm-fbar--open .rm-fbar__band--rail{border-bottom:1px solid var(--border-default)}.rm-fbar__rail{align-items:center;display:flex;flex:0 1 auto;min-width:0;overflow-x:auto;scrollbar-width:thin}.rm-fbar__rail:empty{display:none}.rm-fbar__search{align-items:center;display:flex;flex:1 1 auto;gap:var(--space-8);min-width:0;position:relative}.rm-fbar__search:empty{display:none}.rm-fbar__search :deep(.rm-search-tags__field){border-radius:var(--radius-pill);box-sizing:border-box;height:var(--rm-fbar-field-h);padding-block:0;padding-right:calc(var(--rm-fbar-advanced-w, 0px) + 14px + var(--space-12))}.rm-fbar__search :deep(.rm-search-tags__field.is-open),.rm-fbar__search :deep(.rm-search-tags__field.is-panel){border-radius:var(--radius-pill)}.rm-fbar__search :deep(.rm-search-tags__list),.rm-fbar__search :deep(.rm-search-tags__panel){border-radius:var(--radius-2xl);border-top:1px solid var(--border-default);box-shadow:var(--shadow-lg);margin-top:var(--space-6);padding:var(--space-6)}.rm-fbar__search :deep(.rm-search-tags__option){border-radius:var(--radius-lg)}.rm-fbar__search :deep(.search-bar-wrapper){flex:1 1 auto;min-width:0}.rm-fbar__search :deep(.search-bar){background:var(--bg-surface);box-sizing:border-box;display:flex;height:var(--rm-fbar-field-h);width:100%}.rm-fbar__search :deep(.filters_input_search){border-radius:var(--radius-pill);box-sizing:border-box;height:auto;min-height:var(--rm-fbar-field-h);padding-right:calc(var(--rm-fbar-advanced-w, 0px) + var(--space-12));width:100%}.rm-fbar__search :deep(.research_tags:not(:has(*))){display:none}.rm-fbar__search :deep(.select_shortcut){box-sizing:border-box;font-size:var(--font-11);height:24px;padding-block:0}.rm-fbar__search :deep(.select_shortcut:hover){background:var(--bg-surface-3)!important;border-color:var(--border-default)!important;color:inherit!important}.rm-fbar__search :deep(.select_shortcut:hover svg){color:inherit!important}.rm-fbar__search :deep(.remove_search_section){border-left:none;border-radius:0 var(--radius-pill) var(--radius-pill) 0}.rm-fbar__search :deep(.remove_search_section:hover){background:transparent!important}.rm-fbar__search :deep(.remove_search_section:hover svg){color:var(--text-primary)!important}.rm-fbar__search :deep(.filters_input_search.no_bottom){border-bottom:1.5px solid var(--color-primary)!important;border-radius:var(--radius-pill)}.rm-fbar__search :deep(.search_suggestions){border:1px solid var(--border-default);border-radius:var(--radius-2xl);box-shadow:var(--shadow-lg);left:0;padding:var(--space-6);right:0;top:calc(100% + 6px);width:auto}.rm-fbar__search :deep(.sugg_container>*){border-radius:var(--radius-lg)}.rm-fbar__search :deep(.sugg_container>.selected){background:color-mix(in srgb,var(--color-primary) 6%,transparent)!important}.rm-fbar__panel{--rm-filter-col:224px;--rm-fbar-panel-field-h:40px;align-items:end;display:grid;gap:var(--space-8);grid-template-columns:repeat(auto-fit,minmax(0,var(--rm-filter-col)));justify-content:start;padding-block:16px 20px;padding-inline:max(32px,(100% - var(--oip-content-max,100%))/2 + 32px)}.rm-fbar__panel--wide{align-items:stretch;display:flex;flex-direction:column;gap:var(--space-12)}.rm-fbar__filters{display:contents}.rm-fbar__filters :deep(.filter-chip),.rm-fbar__filters :deep(.filter-complex__trigger),.rm-fbar__filters :deep(.rm-csel__field),.rm-fbar__filters :deep(.rm-dsel__field),.rm-fbar__filters :deep(.rm-msel__field),.rm-fbar__filters :deep(.rm-number__box){border-radius:var(--radius-lg);height:var(--rm-fbar-panel-field-h);width:100%}.rm-fbar__filters :deep(.rm-csel),.rm-fbar__filters :deep(.rm-dsel),.rm-fbar__filters :deep(.rm-msel){align-items:stretch;width:100%}.rm-fbar__panel-head{align-items:baseline;display:flex;gap:var(--space-16);grid-column:1/-1;width:100%}.rm-fbar__customize{grid-column:1/-1}.rm-fbar__panel :deep(.filters_row_break){grid-column:1/-1}.rm-fbar__panel-title{font-family:var(--font-serif);font-size:var(--font-18);font-weight:700;margin:0}.rm-fbar__action{background:none;border:none;cursor:pointer;font-family:inherit;font-size:var(--font-14);font-weight:var(--weight-medium);padding:0;text-decoration-line:underline}.rm-fbar__action--save{color:var(--color-primary)}.rm-fbar__action--clear{color:var(--color-danger)}.rm-fbar__action--clear:hover{opacity:.8;text-decoration-thickness:2px}.rm-fbar__action-sep{align-self:center;background:var(--border-default);height:14px;width:1px}
436
+ .rm-fbar{margin-inline:calc((min(var(--oip-content-max, 100%), 100%) - var(--oip-main-w, 100%))/2);position:sticky;width:var(--oip-main-w,100%);z-index:91;--rm-fbar-field-h:32px;backdrop-filter:blur(12px);background:color-mix(in srgb,var(--bg-surface-3) 80%,transparent);border-bottom:1px solid var(--border-default);display:flex;flex-direction:column;font-family:var(--font-sans)}.rm-fbar__summary{display:flex;justify-content:center;left:0;padding-inline:32px;pointer-events:none;position:absolute;right:0;top:calc(100% + var(--space-8))}.rm-fbar__summary-row{max-width:100%;min-width:min(100%,var(--oip-content-max,100%));width:-moz-max-content;width:max-content}.rm-fbar__summary :deep(.rm-fsum__pill){pointer-events:auto}.rm-fbar__views{align-items:center;display:flex;flex:0 0 auto}.rm-fbar__views:empty{display:none}.rm-fbar__band{display:flex;justify-content:center;padding-inline:32px}.rm-fbar__rail-row,.rm-fbar__row{max-width:100%;min-width:min(100%,var(--oip-content-max,100%));width:-moz-max-content;width:max-content}.rm-fbar__row{align-items:flex-start;display:flex;gap:var(--space-12);padding-block:8px}.rm-fbar--open .rm-fbar__band:not(:has(~.rm-fbar__band--rail)){border-bottom:1px solid var(--border-default)}.rm-fbar__toggle :deep(p),.rm-fbar__toggle :deep(span){font-size:inherit;font-weight:inherit;line-height:inherit;margin:0}.rm-fbar__toggle{align-items:center;background:var(--bg-surface);border:1px solid var(--border-default);border-radius:var(--radius-pill);color:var(--text-primary);cursor:pointer;display:flex;flex:0 0 auto;font-family:inherit;font-size:var(--font-14);font-weight:var(--weight-medium);gap:var(--space-6);height:var(--rm-fbar-field-h);justify-content:center;padding:0 14px}.rm-fbar__toggle:hover{background:var(--bg-surface-3)}.rm-fbar__toggle.is-active,.rm-fbar__toggle.is-active:hover{background:var(--color-primary);border-color:var(--color-primary);color:var(--color-text-inverse)}.rm-fbar__toggle.is-active .rm-fbar__badge{background:var(--color-text-inverse);color:var(--color-primary)}.rm-fbar__badge{align-items:center;background:var(--color-primary);border-radius:16px;color:var(--color-text-inverse);display:inline-flex;font-size:var(--font-11);font-weight:var(--weight-bold);justify-content:center;min-width:18px;padding:0 5px}.rm-fbar__view{align-items:center;display:flex;flex:0 0 auto}.rm-fbar__advanced{align-items:center;background:none;border:none;border-left:1px solid var(--border-default);color:var(--color-primary);cursor:pointer;display:inline-flex;font-family:inherit;font-size:var(--font-13);font-weight:var(--weight-medium);height:var(--rm-fbar-field-h);padding:0 0 0 var(--space-12);position:absolute;right:14px;text-decoration-line:underline;top:0;white-space:nowrap;z-index:2}.rm-fbar__advanced.is-active,.rm-fbar__advanced:hover{color:var(--color-primary-hover,var(--color-primary));text-decoration-thickness:2px}.rm-fbar__rail-row{display:flex;padding-bottom:var(--space-8)}.rm-fbar--open .rm-fbar__band--rail{border-bottom:1px solid var(--border-default)}.rm-fbar__rail{align-items:center;display:flex;flex:0 1 auto;min-width:0;overflow-x:auto;scrollbar-width:thin}.rm-fbar__rail:empty{display:none}.rm-fbar__search{align-items:center;display:flex;flex:1 1 auto;gap:var(--space-8);min-width:0;position:relative}.rm-fbar__search:empty{display:none}.rm-fbar__search :deep(.rm-search-tags__field){border-radius:var(--radius-pill);box-sizing:border-box;height:var(--rm-fbar-field-h);padding-block:0;padding-right:calc(var(--rm-fbar-advanced-w, 0px) + 14px + var(--space-12))}.rm-fbar__search :deep(.rm-search-tags__field.is-open),.rm-fbar__search :deep(.rm-search-tags__field.is-panel){border-radius:var(--radius-pill)}.rm-fbar__search :deep(.rm-search-tags__list),.rm-fbar__search :deep(.rm-search-tags__panel){border-radius:var(--radius-2xl);border-top:1px solid var(--border-default);box-shadow:var(--shadow-lg);margin-top:var(--space-6);padding:var(--space-6)}.rm-fbar__search :deep(.rm-search-tags__option){border-radius:var(--radius-lg)}.rm-fbar__search :deep(.search-bar-wrapper){flex:1 1 auto;min-width:0}.rm-fbar__search :deep(.search-bar){background:var(--bg-surface);box-sizing:border-box;display:flex;height:var(--rm-fbar-field-h);width:100%}.rm-fbar__search :deep(.filters_input_search){border-radius:var(--radius-pill);box-sizing:border-box;height:auto;min-height:var(--rm-fbar-field-h);padding-right:calc(var(--rm-fbar-advanced-w, 0px) + var(--space-12));width:100%}.rm-fbar__search :deep(.research_tags:not(:has(*))){display:none}.rm-fbar__search :deep(.select_shortcut){box-sizing:border-box;font-size:var(--font-11);height:24px;padding-block:0}.rm-fbar__search :deep(.select_shortcut:hover){background:var(--bg-surface-3)!important;border-color:var(--border-default)!important;color:inherit!important}.rm-fbar__search :deep(.select_shortcut:hover svg){color:inherit!important}.rm-fbar__search :deep(.remove_search_section){border-left:none;border-radius:0 var(--radius-pill) var(--radius-pill) 0}.rm-fbar__search :deep(.remove_search_section:hover){background:transparent!important}.rm-fbar__search :deep(.remove_search_section:hover svg){color:var(--text-primary)!important}.rm-fbar__search :deep(.filters_input_search.no_bottom){border-bottom:1.5px solid var(--color-primary)!important;border-radius:var(--radius-pill)}.rm-fbar__search :deep(.search_suggestions){border:1px solid var(--border-default);border-radius:var(--radius-2xl);box-shadow:var(--shadow-lg);left:0;padding:var(--space-6);right:0;top:calc(100% + 6px);width:auto}.rm-fbar__search :deep(.sugg_container>*){border-radius:var(--radius-lg)}.rm-fbar__search :deep(.sugg_container>.selected){background:color-mix(in srgb,var(--color-primary) 6%,transparent)!important}.rm-fbar__panel{--rm-filter-col:224px;--rm-fbar-panel-field-h:40px;align-items:end;display:grid;gap:var(--space-8);grid-template-columns:repeat(auto-fit,minmax(0,var(--rm-filter-col)));justify-content:start;padding-block:16px 20px;padding-inline:max(32px,(100% - var(--oip-content-max,100%))/2 + 32px)}.rm-fbar__panel--wide{align-items:stretch;display:flex;flex-direction:column;gap:var(--space-12)}.rm-fbar__filters{display:contents}.rm-fbar__filters :deep(.filter-chip),.rm-fbar__filters :deep(.filter-complex__trigger),.rm-fbar__filters :deep(.rm-csel__field),.rm-fbar__filters :deep(.rm-dsel__field),.rm-fbar__filters :deep(.rm-msel__field),.rm-fbar__filters :deep(.rm-number__box){border-radius:var(--radius-lg);height:var(--rm-fbar-panel-field-h);width:100%}.rm-fbar__filters :deep(.rm-csel),.rm-fbar__filters :deep(.rm-dsel),.rm-fbar__filters :deep(.rm-msel){align-items:stretch;width:100%}.rm-fbar__panel-head{align-items:baseline;display:flex;gap:var(--space-16);grid-column:1/-1;width:100%}.rm-fbar__customize{grid-column:1/-1}.rm-fbar__panel :deep(.filters_row_break){grid-column:1/-1}.rm-fbar__panel-title{font-family:var(--font-serif);font-size:var(--font-18);font-weight:700;margin:0}.rm-fbar__action{background:none;border:none;cursor:pointer;font-family:inherit;font-size:var(--font-14);font-weight:var(--weight-medium);padding:0;text-decoration-line:underline}.rm-fbar__action--save{color:var(--color-primary)}.rm-fbar__action--clear{color:var(--color-danger)}.rm-fbar__action--clear:hover{opacity:.8;text-decoration-thickness:2px}.rm-fbar__action-sep{align-self:center;background:var(--border-default);height:14px;width:1px}
344
437
  </style>
@@ -0,0 +1,81 @@
1
+ <!--
2
+ Resume des filtres poses, sous la barre de filtres.
3
+
4
+ Panneau ferme, la barre ne dit que le nombre de filtres actifs : on ne voit
5
+ plus ce qui est selectionne. Une pill par filtre pose, « Libelle : valeurs »,
6
+ tronquee quand elle est longue. Plusieurs valeurs : la liste complete sort au
7
+ survol et au focus (RmTooltip), une par ligne. Un clic emet `pick` avec la
8
+ cle du filtre : RmFilterBar ouvre alors son panneau sur ce filtre.
9
+
10
+ Le composant ne connait pas les filtres de la page : c'est elle qui decrit ce
11
+ qui est pose (libelles traduits, valeurs lisibles, plage d'annees deja
12
+ resumee), parce qu'elle seule sait lire son etat.
13
+ -->
14
+ <script setup lang="ts">
15
+ import { computed } from 'vue'
16
+
17
+ export interface RmFilterSummaryItem {
18
+ /** Cle du filtre, la meme que l'attribut `data-rm-filter` pose sur le champ du panneau. */
19
+ key: string
20
+ /** Libelle du filtre, celui du champ. */
21
+ label: string
22
+ /** Valeurs lisibles, une par entree. */
23
+ values: string[]
24
+ /** Resume deja forme (« 2020 - 2026 ») ; a defaut, les valeurs jointes. */
25
+ text?: string
26
+ }
27
+
28
+ const props = withDefaults(defineProps<{
29
+ items: RmFilterSummaryItem[]
30
+ lang?: 'fr' | 'en'
31
+ }>(), {
32
+ lang: 'fr',
33
+ })
34
+
35
+ const emit = defineEmits<{ pick: [key: string] }>()
36
+
37
+ const LABELS = {
38
+ fr: { region: 'Filtres posés', edit: 'Modifier le filtre', sep: ' : ' },
39
+ en: { region: 'Active filters', edit: 'Edit filter', sep: ' : ' },
40
+ } as const
41
+
42
+ const t = computed(() => LABELS[props.lang] ?? LABELS.fr)
43
+
44
+ const pills = computed(() =>
45
+ props.items
46
+ .filter((item) => item.values.length > 0)
47
+ .map((item) => ({ ...item, summary: item.text ?? item.values.join(', ') })),
48
+ )
49
+ </script>
50
+
51
+ <template>
52
+ <ul v-if="pills.length" class="rm-fsum" :aria-label="t.region">
53
+ <li v-for="pill in pills" :key="pill.key" class="rm-fsum__item">
54
+ <RmTooltip
55
+ dir="bottom"
56
+ full
57
+ max-width="360px"
58
+ :disabled="pill.values.length < 2"
59
+ >
60
+ <button
61
+ type="button"
62
+ class="rm-fsum__pill"
63
+ :aria-label="`${t.edit} ${pill.label}${t.sep}${pill.values.join(', ')}`"
64
+ @click="emit('pick', pill.key)"
65
+ >
66
+ <span class="rm-fsum__label">{{ pill.label }}{{ t.sep }}</span>
67
+ <span class="rm-fsum__value">{{ pill.summary }}</span>
68
+ </button>
69
+ <template #content>
70
+ <ul class="rm-fsum__list">
71
+ <li v-for="value in pill.values" :key="value">{{ value }}</li>
72
+ </ul>
73
+ </template>
74
+ </RmTooltip>
75
+ </li>
76
+ </ul>
77
+ </template>
78
+
79
+ <style scoped>
80
+ .rm-fsum{display:flex;flex-wrap:wrap;gap:var(--space-6);list-style:none;margin:0;padding:0}.rm-fsum__item{display:flex;min-width:0}.rm-fsum__pill{--rm-fsum-accent:var(--rm-shell-accent,var(--color-primary));align-items:center;background:color-mix(in srgb,var(--rm-fsum-accent) 16%,var(--rm-shell-surface,var(--bg-surface)));border:1px solid color-mix(in srgb,var(--rm-fsum-accent) 40%,transparent);border-radius:var(--radius-pill);box-shadow:var(--shadow-sm);color:var(--text-primary);cursor:pointer;display:inline-flex;font-family:inherit;font-size:var(--font-13);height:26px;max-width:340px;padding:0 var(--space-12);white-space:nowrap}.rm-fsum__pill:hover{background:color-mix(in srgb,var(--rm-fsum-accent) 26%,var(--rm-shell-surface,var(--bg-surface)));border-color:var(--rm-fsum-accent)}.rm-fsum__pill:focus-visible{outline:2px solid var(--color-primary);outline-offset:2px}.rm-fsum__label{color:var(--text-secondary);flex:0 0 auto;white-space:pre}.rm-fsum__value{font-weight:var(--weight-medium);min-width:0;overflow:hidden;text-overflow:ellipsis}.rm-fsum__list{list-style:none;margin:0;padding:0;white-space:normal}.rm-fsum__list li+li{margin-top:var(--space-2,2px)}
81
+ </style>
@@ -124,7 +124,12 @@
124
124
  :avis-count="overviewHistory.length"
125
125
  />
126
126
  </div>
127
- <div v-else-if="chosenTab === mitmTabIndex && mitmTabIndex > 0" class="arg_page_layout">
127
+ <!-- MITM et « SMR & ASMR » lisent les memes documents MITM : meme selecteur
128
+ de CIS, la specialite choisie suit d'un onglet a l'autre. -->
129
+ <div
130
+ v-else-if="(chosenTab === mitmTabIndex && mitmTabIndex > 0) || (chosenTab === smrTabIndex && smrTabIndex > 0)"
131
+ class="arg_page_layout"
132
+ >
128
133
  <div v-if="resultsQueryMitm.length > 1" class="cis-switch">
129
134
  <span class="oip_filter_label cis-switch-label">
130
135
  {{ locale === 'en' ? 'Specialty (CIS):' : 'Spécialité (CIS) :' }}
@@ -140,11 +145,14 @@
140
145
  {{ heartStripBrandPrefix(m._source.cis_label, brandMatch) }}
141
146
  </button>
142
147
  </div>
143
- <OipDrugsHeartMitmDetailsOverview
144
- v-if="selectedMitmCis"
145
- :cis="selectedMitmCis"
146
- @select="drawerRecord = $event"
147
- />
148
+ <template v-if="selectedMitmCis">
149
+ <OipDrugsHeartMitmDetailsSmrAsmr
150
+ v-if="chosenTab === smrTabIndex"
151
+ :cis="selectedMitmCis"
152
+ @select="drawerRecord = $event"
153
+ />
154
+ <OipDrugsHeartMitmDetailsOverview v-else :cis="selectedMitmCis" />
155
+ </template>
148
156
  </div>
149
157
  <div v-else-if="chosenTab === putTabIndex && putTabIndex > 0" class="arg_page_layout">
150
158
  <OipDrugsHeartResultsDetailsRecordList
@@ -329,7 +337,11 @@ const availableTabs = computed(() => {
329
337
  if (resultsQueryPrice.value.length > 0) tabs.push({ key: 'price', label: t('oipDrugs.heart.details.tabs.price') });
330
338
  if (resultsQueryIntlPrice.value.length > 0 || intlDecisionCount.value > 0) tabs.push({ key: 'international', label: en ? 'International view' : 'Regard international' });
331
339
  if (resultsQueryAnsm.value.length > 0) tabs.push({ key: 'ansm', label: 'ANSM' });
332
- if (resultsQueryMitm.value.length > 0) tabs.push({ key: 'mitm', label: 'MITM' });
340
+ if (resultsQueryMitm.value.length > 0) {
341
+ tabs.push({ key: 'mitm', label: 'MITM' });
342
+ // Les avis SMR / ASMR du CIS ont leur onglet, le MITM garde les CIP.
343
+ tabs.push({ key: 'smr', label: 'SMR & ASMR' });
344
+ }
333
345
  if (resultsQueryPut.value.length > 0) tabs.push({ key: 'put', label: 'PUT' });
334
346
  if (resultsQueryLes.value.length > 0) tabs.push({ key: 'les', label: 'LES' });
335
347
  // Les alertes ferment la liste : elles completent la fiche, elles ne la
@@ -369,6 +381,8 @@ const TAB_ALIASES: Record<string, string> = {
369
381
  liste_en_sus: 'les',
370
382
  regard_international: 'international',
371
383
  prix_internationaux: 'international',
384
+ smr_asmr: 'smr',
385
+ asmr: 'smr',
372
386
  };
373
387
 
374
388
  const normalizeTab = (rawKey: string) => TAB_ALIASES[String(rawKey).toLowerCase()] ?? rawKey;
@@ -388,6 +402,7 @@ const priceTabIndex = computed(() => tabIndexOf('price'));
388
402
  const internationalTabIndex = computed(() => tabIndexOf('international'));
389
403
  const ansmTabIndex = computed(() => tabIndexOf('ansm'));
390
404
  const mitmTabIndex = computed(() => tabIndexOf('mitm'));
405
+ const smrTabIndex = computed(() => tabIndexOf('smr'));
391
406
  const putTabIndex = computed(() => tabIndexOf('put'));
392
407
  const lesTabIndex = computed(() => tabIndexOf('les'));
393
408
 
@@ -1,161 +1,138 @@
1
1
  <!--
2
- Onglet MITM d'une specialite.
2
+ Onglet MITM d'une specialite : les CIP rattaches a la molecule, en tableau.
3
3
 
4
- L'index MITM tient, pour un code CIS, l'integralite des avis de la Commission
5
- de la transparence : une quarantaine de SMR et autant d'ASMR, chacun avec son
6
- texte complet. En trois tableaux empiles, on lisait des colonnes tronquees
7
- sans jamais voir un avis en entier. Ici, l'identite du produit et ses deux
8
- derniers niveaux se lisent en tete, puis chaque avis devient une carte,
9
- SMR et ASMR reunis par code, le texte integral s'ouvrant dans le tiroir.
4
+ `molecule` porte, pour chaque presentation (CIP) partageant la molecule, sa
5
+ marque, son libelle et son code CIS. Le SMR et l'ASMR ne sont pas sur ces
6
+ lignes : ils vivent sur le document MITM de chaque CIS, qu'on relit par
7
+ `cis_code`. Un CIS absent de l'index laisse ses cellules vides. Les avis
8
+ eux-memes sont dans l'onglet « SMR & ASMR » (SmrAsmr.vue).
10
9
  -->
11
10
  <script setup lang="ts">
12
- import { HEART_SOURCE_UUIDS } from "../../../../../oip-drugs/utils/sourceUuids";
13
- import useDirectusSources from "../../../../../oip-drugs/composables/useDirectusSources";
11
+ import { ES_INDEX } from "../../../../../oip-drugs/esIndices";
12
+ import useOipDrugsElastic from "../../../../../oip-drugs/composables/useOipDrugsElastic";
13
+ import {
14
+ heartAsmrTone,
15
+ heartMitmLast,
16
+ heartSmrTone,
17
+ type HeartMitmTone,
18
+ } from "../../../../../oip-drugs/utils/heartMitmTone";
14
19
 
15
- // Libelle de source : Directus, comme le panneau « Sources » du rail.
16
- const { load: loadSourceMeta, metaByUuid } = useDirectusSources();
17
- loadSourceMeta([HEART_SOURCE_UUIDS.HAS]);
18
20
  const props = defineProps<{
19
21
  /** Le document MITM du CIS choisi (_source). */
20
22
  cis: any;
21
23
  }>();
22
24
 
23
- const emit = defineEmits<{ (event: "select", record: any): void }>();
24
-
25
25
  const { locale } = useI18n();
26
- const hasSourceName = computed(
27
- () => metaByUuid(HEART_SOURCE_UUIDS.HAS, locale.value === "en" ? "en" : "fr").name,
28
- );
29
-
30
- /** `20260708` dans l'index, une date ailleurs. */
31
- function isoDate(raw: string | null | undefined) {
32
- if (!raw) return null;
33
- const value = String(raw);
34
- if (/^\d{8}$/.test(value)) {
35
- return `${value.slice(0, 4)}-${value.slice(4, 6)}-${value.slice(6, 8)}`;
36
- }
37
- return value;
38
- }
39
-
40
- /** Les libelles d'avis portent des `<br>` : on les rend au lecteur, pas au DOM. */
41
- function plain(text: string | null | undefined) {
42
- if (!text) return "";
43
- return text
44
- .replace(/<br\s*\/?>/gi, "\n")
45
- .replace(/<[^>]+>/g, "")
46
- .trim();
47
- }
48
-
49
- /** Important, Modere, Faible, Insuffisant. */
50
- function smrTone(value: string) {
51
- const v = (value || "").toLowerCase();
52
- const bad = v.includes("insuffisant");
53
- const good = v.includes("important");
54
- // Un avis peut etre important sur une indication et insuffisant sur une autre.
55
- if (bad && good) return "neutral" as const;
56
- if (bad) return "bad" as const;
57
- if (good) return "good" as const;
58
- return "neutral" as const;
59
- }
26
+ const { queryCustomElastic } = useOipDrugsElastic();
60
27
 
61
- /** ASMR I a V : plus le niveau est haut, plus le progres est net. */
62
- function asmrTone(value: string) {
63
- const level = (value || "").trim().match(/^(I{1,3}|IV|V)\b/)?.[1];
64
- if (level === "I" || level === "II") return "good" as const;
65
- if (level === "III") return "post" as const;
66
- if (level === "IV") return "warn" as const;
67
- return "neutral" as const;
68
- }
69
-
70
- // Premier niveau renseigne : l'index met des lignes de remplissage nulles en
71
- // tete de `last_smr`/`last_asmr`, le KPI affichait un tiret a tort.
72
- const lastSmr = computed(() => (props.cis?.last_smr ?? []).find((s: any) => s?.value) ?? null);
73
- const lastAsmr = computed(() => (props.cis?.last_asmr ?? []).find((s: any) => s?.value) ?? null);
74
-
75
- const atcLabel = computed(() =>
76
- locale.value === "en"
77
- ? props.cis?.atc5_english_code_label
78
- : props.cis?.atc5_french_code_label,
28
+ /** Les lignes de `molecule` qui disent quelque chose. */
29
+ const attached = computed<any[]>(() =>
30
+ (props.cis?.molecule ?? []).filter((row: any) => row?.brand || row?.drug_label || row?.cis_code),
79
31
  );
80
32
 
81
- /**
82
- * Les avis, un par code HAS.
83
- *
84
- * SMR et ASMR sont deux listes separees dans l'index alors qu'ils sont rendus
85
- * dans le meme avis : on les rassemble par `has_code`, sinon chaque decision
86
- * apparaissait deux fois.
87
- */
88
- const opinions = computed(() => {
89
- const byCode = new Map<string, any>();
33
+ type Levels = { smr: string | null; asmr: string | null };
90
34
 
91
- const push = (entry: any, kind: "smr" | "asmr") => {
92
- // L'index porte des lignes de remplissage entierement nulles : sans ce
93
- // garde, chacune devenait un avis vide dans la liste.
94
- if (!entry?.has_code && !entry?.has_date && !entry?.label && !entry?.value) return;
95
- const code = entry.has_code || `${kind}-${entry.has_date}`;
96
- const found = byCode.get(code) ?? {
97
- code: entry.has_code || null,
98
- date: isoDate(entry.has_date),
99
- reason: entry.has_reason || null,
100
- };
101
- // Un meme avis peut rendre plusieurs niveaux (important ici, insuffisant
102
- // la) : on les cumule au lieu de garder le dernier.
103
- const previous = found[kind];
104
- found[kind] = {
105
- value: [previous?.value, entry.value].filter(Boolean).join(", ") || null,
106
- label: [previous?.label, plain(entry.label)].filter(Boolean).join("\n\n"),
107
- };
108
- byCode.set(code, found);
109
- };
35
+ /** Derniers niveaux SMR / ASMR par code CIS, relus dans l'index MITM. */
36
+ const levelsByCis = ref<Record<string, Levels>>({});
37
+ const loadingLevels = ref(false);
110
38
 
111
- (props.cis?.smr ?? []).forEach((entry: any) => push(entry, "smr"));
112
- (props.cis?.asmr ?? []).forEach((entry: any) => push(entry, "asmr"));
113
-
114
- // `has_date` peut etre nul : NaN dans le comparateur rendait l'ordre
115
- // aleatoire, on classe ces avis en fin de liste.
116
- const time = (d: string | null) => (d ? new Date(d).getTime() : 0);
117
- return [...byCode.values()].sort((a, b) => time(b.date) - time(a.date));
39
+ const levelsOf = (source: any): Levels => ({
40
+ smr: heartMitmLast(source?.last_smr)?.value ?? null,
41
+ asmr: heartMitmLast(source?.last_asmr)?.value ?? null,
118
42
  });
119
43
 
120
- const records = computed(() =>
121
- opinions.value.map((opinion) => ({
122
- key: opinion.code || opinion.date,
123
- typeLabel:
124
- opinion.reason || (locale.value === "en" ? "Transparency opinion" : "Avis de transparence"),
125
- icon: "FileText",
126
- date: opinion.date,
127
- ref: opinion.code,
128
- title:
129
- opinion.smr?.label ||
130
- opinion.asmr?.label ||
131
- (locale.value === "en" ? "Transparency opinion" : "Avis de transparence"),
132
- excerpt: opinion.smr?.label ? opinion.asmr?.label : null,
133
- status: opinion.smr?.value ? `SMR ${opinion.smr.value}` : null,
134
- statusTone: smrTone(opinion.smr?.value),
135
- badge: opinion.asmr?.value ? `ASMR ${opinion.asmr.value}` : null,
136
- badgeTone: asmrTone(opinion.asmr?.value),
137
- sourceLabel: hasSourceName.value,
138
- sections: [
139
- {
140
- key: "smr",
141
- label: locale.value === "en" ? "Actual benefit (SMR)" : "Service médical rendu (SMR)",
142
- body: opinion.smr?.label ?? "",
143
- },
144
- {
145
- key: "asmr",
146
- label:
147
- locale.value === "en"
148
- ? "Improvement in actual benefit (ASMR)"
149
- : "Amélioration du service médical rendu (ASMR)",
150
- body: opinion.asmr?.label ?? "",
151
- },
152
- ],
153
- })),
44
+ let generation = 0;
45
+ async function loadLevels() {
46
+ const gen = ++generation;
47
+ const ownCode = String(props.cis?.cis_code ?? "");
48
+ const own: Record<string, Levels> = ownCode ? { [ownCode]: levelsOf(props.cis) } : {};
49
+ const codes = [
50
+ ...new Set(attached.value.map((row) => String(row.cis_code ?? "")).filter(Boolean)),
51
+ ].filter((code) => code !== ownCode);
52
+ levelsByCis.value = own;
53
+ loadingLevels.value = codes.length > 0;
54
+ if (!codes.length) return;
55
+
56
+ const res = await queryCustomElastic({
57
+ index: ES_INDEX.MITM_BDPM,
58
+ customQuery: {
59
+ size: 1000,
60
+ _source: ["cis_code", "last_smr", "last_asmr", "@timestamp"],
61
+ query: { terms: { "cis_code.keyword": codes } },
62
+ },
63
+ allAnswer: true,
64
+ }).catch((error) => {
65
+ console.error("Error fetching MITM levels:", error);
66
+ return null;
67
+ });
68
+ if (gen !== generation) return;
69
+
70
+ // Plusieurs instantanes d'un meme CIS : on garde le plus recent.
71
+ const time = (source: any) => new Date(source?.["@timestamp"] || 0).getTime();
72
+ const latest = new Map<string, any>();
73
+ for (const hit of res?.hits?.hits ?? []) {
74
+ const code = String(hit._source?.cis_code ?? "");
75
+ const found = latest.get(code);
76
+ if (code && (!found || time(hit._source) > time(found))) latest.set(code, hit._source);
77
+ }
78
+ const next = { ...own };
79
+ latest.forEach((source, code) => {
80
+ next[code] = levelsOf(source);
81
+ });
82
+ levelsByCis.value = next;
83
+ loadingLevels.value = false;
84
+ }
85
+
86
+ watch(() => props.cis, loadLevels, { immediate: true });
87
+
88
+ const rows = computed(() =>
89
+ attached.value.map((row, index) => {
90
+ const levels = levelsByCis.value[String(row.cis_code ?? "")];
91
+ return {
92
+ key: `${row.drug_code ?? ""}-${row.cis_code ?? ""}-${index}`,
93
+ brand: row.brand || "-",
94
+ label: row.drug_label || "-",
95
+ cip: row.drug_code || "-",
96
+ cisCode: row.cis_code || "-",
97
+ owner: row.owner_regroup || "-",
98
+ smr: levels?.smr ?? null,
99
+ asmr: levels?.asmr ?? null,
100
+ current: String(row.cis_code ?? "") === String(props.cis?.cis_code ?? ""),
101
+ };
102
+ }),
154
103
  );
155
104
 
156
- const attached = computed(() =>
157
- (props.cis?.molecule ?? []).filter((row: any) => row?.brand || row?.drug_label || row?.cis_code),
158
- );
105
+ /** Les colonnes SMR / ASMR n'apparaissent que si au moins un CIP en a un. */
106
+ const hasSmr = computed(() => loadingLevels.value || rows.value.some((row) => row.smr));
107
+ const hasAsmr = computed(() => loadingLevels.value || rows.value.some((row) => row.asmr));
108
+
109
+ const columns = computed(() => {
110
+ const en = locale.value === "en";
111
+ return [
112
+ { key: "brand", label: en ? "Brand" : "Marque", sortable: true },
113
+ {
114
+ key: "label",
115
+ label: en ? "Presentation" : "Présentation",
116
+ sortable: true,
117
+ rowHeader: true,
118
+ minWidth: "280px",
119
+ },
120
+ { key: "cip", label: en ? "CIP code" : "Code CIP", sortable: true, width: "140px" },
121
+ { key: "cisCode", label: en ? "CIS code" : "Code CIS", sortable: true, width: "110px" },
122
+ { key: "owner", label: en ? "Manufacturer" : "Laboratoire", sortable: true },
123
+ ...(hasSmr.value ? [{ key: "smr", label: "SMR", sortable: true }] : []),
124
+ ...(hasAsmr.value ? [{ key: "asmr", label: "ASMR", sortable: true }] : []),
125
+ ];
126
+ });
127
+
128
+ /** Ton du niveau vers la variante de RmBadge. */
129
+ const BADGE: Record<HeartMitmTone, "active" | "error" | "pending" | "info" | "grey"> = {
130
+ good: "active",
131
+ bad: "error",
132
+ warn: "pending",
133
+ post: "info",
134
+ neutral: "grey",
135
+ };
159
136
  </script>
160
137
 
161
138
  <template>
@@ -164,8 +141,8 @@ const attached = computed(() =>
164
141
  <RmIcon name="Info" :size="14" />
165
142
  {{
166
143
  locale === "en"
167
- ? `Opinions cover the presentation ${cis.cis_label}.`
168
- : `Les avis portent sur la présentation ${cis.cis_label}.`
144
+ ? "Presentations (CIP) sharing the molecule of this specialty."
145
+ : "Présentations (CIP) partageant la molécule de cette spécialité."
169
146
  }}
170
147
  <a
171
148
  v-if="cis.url_link"
@@ -178,68 +155,32 @@ const attached = computed(() =>
178
155
  </a>
179
156
  </p>
180
157
 
181
- <!-- Meme bandeau de synthese que l'onglet Prix : les niveaux en vigueur et
182
- l'ampleur de l'historique, avant d'entrer dans le detail. -->
183
- <div class="mi_kpis">
184
- <div class="mi_kpi">
185
- <p class="mi_kpi_value" :class="`is_${smrTone(lastSmr?.value)}`">
186
- {{ lastSmr?.value || "-" }}
187
- </p>
188
- <p class="mi_kpi_label">{{ locale === "en" ? "Current SMR" : "SMR en vigueur" }}</p>
189
- </div>
190
-
191
- <div class="mi_kpi">
192
- <p class="mi_kpi_value" :class="`is_${asmrTone(lastAsmr?.value)}`">
193
- {{ lastAsmr?.value || "-" }}
194
- </p>
195
- <p class="mi_kpi_label">{{ locale === "en" ? "Current ASMR" : "ASMR en vigueur" }}</p>
196
- </div>
197
-
198
- <div class="mi_kpi">
199
- <p class="mi_kpi_value">{{ records.length }}</p>
200
- <p class="mi_kpi_label">
201
- {{ locale === "en" ? "Opinions recorded" : "Avis recensés" }}
202
- </p>
203
- </div>
204
-
205
- <div class="mi_kpi">
206
- <p class="mi_kpi_value">
207
- <RmDate
208
- v-if="isoDate(lastSmr?.has_date || lastAsmr?.has_date)"
209
- :date="isoDate(lastSmr?.has_date || lastAsmr?.has_date)!"
210
- :lang="locale"
211
- />
212
- <template v-else>-</template>
213
- </p>
214
- <p class="mi_kpi_label">
215
- {{ locale === "en" ? "Last assessment" : "Dernière évaluation" }}
216
- </p>
217
- </div>
218
- </div>
219
-
220
- <OipDrugsHeartResultsDetailsRecordList
221
- :title="locale === 'en' ? 'Transparency Committee opinions' : 'Avis de la Commission de la transparence'"
222
- :subtitle="locale === 'en' ? 'opinions recorded for this presentation' : 'avis recensés pour cette présentation'"
223
- :items="records"
224
- :empty-label="locale === 'en' ? 'No opinion recorded.' : 'Aucun avis recensé.'"
225
- @select="emit('select', $event)"
226
- />
227
-
228
- <template v-if="attached.length">
229
- <h3 class="mi_section">
230
- {{ locale === "en" ? "Products attached to this molecule" : "Produits rattachés à cette molécule" }}
231
- </h3>
232
- <ul class="mi_attached">
233
- <li v-for="row in attached" :key="row.cis_code || row.drug_code">
234
- <b>{{ row.brand || "-" }}</b>
235
- <span>{{ row.drug_label }}</span>
236
- <span class="mi_attached_meta">
237
- <template v-if="row.cis_code">CIS {{ row.cis_code }}</template>
238
- <template v-if="row.owner_regroup"> · {{ row.owner_regroup }}</template>
239
- </span>
240
- </li>
241
- </ul>
242
- </template>
158
+ <RmTable
159
+ :columns="columns"
160
+ :rows="rows"
161
+ :caption="locale === 'en' ? 'Products attached to this molecule' : 'Produits rattachés à cette molécule'"
162
+ row-key="key"
163
+ compact
164
+ search="auto"
165
+ :search-placeholder="
166
+ locale === 'en' ? 'Search a brand, a CIP code...' : 'Rechercher une marque, un code CIP...'
167
+ "
168
+ :page-size="25"
169
+ max-height="600px"
170
+ :empty-text="locale === 'en' ? 'No product attached to this molecule' : 'Aucun produit rattaché à cette molécule'"
171
+ >
172
+ <template #label="{ row }">
173
+ <span :class="{ mi_current: row.current }">{{ row.label }}</span>
174
+ </template>
175
+ <template #smr="{ value }">
176
+ <RmBadge v-if="value" :variant="BADGE[heartSmrTone(value)]">{{ value }}</RmBadge>
177
+ <template v-else>{{ loadingLevels ? "…" : "-" }}</template>
178
+ </template>
179
+ <template #asmr="{ value }">
180
+ <RmBadge v-if="value" :variant="BADGE[heartAsmrTone(value)]">{{ value }}</RmBadge>
181
+ <template v-else>{{ loadingLevels ? "…" : "-" }}</template>
182
+ </template>
183
+ </RmTable>
243
184
 
244
185
  <p class="mi_source">
245
186
  <OipDrugsHeartMitmSource
@@ -257,13 +198,7 @@ const attached = computed(() =>
257
198
  gap: 16px;
258
199
  box-sizing: border-box;
259
200
  width: 100%;
260
- }
261
-
262
- /* La liste d'avis pose deja sa propre gouttiere de 32px ; les autres blocs la
263
- prennent en marge et non en retrait interne, pour que leur cadre s'aligne sur
264
- celui des cartes plutot que de le deborder. */
265
- .mi > :not(.rl) {
266
- margin-inline: 32px;
201
+ padding-inline: 32px;
267
202
  }
268
203
 
269
204
  .mi_scope {
@@ -281,97 +216,9 @@ const attached = computed(() =>
281
216
  font-weight: 600;
282
217
  }
283
218
 
284
- /* Bandeau de synthese : meme dessin que celui de l'onglet Prix. */
285
- .mi_kpis {
286
- display: grid;
287
- grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
288
- border: 1px solid var(--light);
289
- /* Le filet degrade court d'un bord a l'autre : arrondir le haut le tronquait
290
- a ses extremites. */
291
- border-radius: 0 0 12px 12px;
292
- background: var(--white);
293
- overflow: hidden;
294
- box-shadow: var(--small-shadow);
295
- }
296
-
297
- .mi_kpis::before {
298
- content: "";
299
- grid-column: 1 / -1;
300
- height: 3px;
301
- background: linear-gradient(to right, var(--primary), color-mix(in srgb, var(--primary) 35%, var(--white)));
302
- }
303
-
304
- .mi_kpi {
305
- display: flex;
306
- flex-direction: column;
307
- align-items: center;
308
- gap: 6px;
309
- padding: 20px 16px;
310
- border-left: 1px solid var(--light);
311
- text-align: center;
312
- }
313
-
314
- .mi_kpi:first-of-type {
315
- border-left: none;
316
- }
317
-
318
- .mi_kpi_value {
319
- color: var(--primary);
320
- font-size: 19px;
321
- font-weight: 800;
322
- white-space: nowrap;
323
- }
324
-
325
- /* Le niveau porte sa propre lecture : favorable, moyen, insuffisant. */
326
- .mi_kpi_value.is_good {
327
- color: var(--system-success-hover);
328
- }
329
-
330
- .mi_kpi_value.is_bad {
331
- color: var(--system-alert-hover);
332
- }
333
-
334
- .mi_kpi_value.is_warn {
335
- color: #b45309;
336
- }
337
-
338
- .mi_kpi_label {
339
- color: var(--medium);
340
- font-size: 11px;
341
- font-weight: 600;
342
- letter-spacing: 0.04em;
343
- text-transform: uppercase;
344
- white-space: nowrap;
345
- }
346
-
347
- .mi_section {
348
- margin-top: 8px;
349
- font-size: 16px;
350
- font-weight: 800;
351
- }
352
-
353
- .mi_attached {
354
- display: flex;
355
- flex-direction: column;
356
- gap: 8px;
357
- list-style: none;
358
- }
359
-
360
- .mi_attached li {
361
- display: flex;
362
- flex-wrap: wrap;
363
- align-items: baseline;
364
- gap: 8px;
365
- padding: 10px 14px;
366
- border: 1px solid var(--light);
367
- border-radius: 12px;
368
- background: var(--white);
369
- font-size: 14px;
370
- }
371
-
372
- .mi_attached_meta {
373
- color: var(--medium);
374
- font-size: 13px;
219
+ /* La specialite affichee se repere parmi ses voisines de molecule. */
220
+ .mi_current {
221
+ font-weight: 700;
375
222
  }
376
223
 
377
224
  .mi_source {
@@ -0,0 +1,291 @@
1
+ <!--
2
+ Onglet « SMR & ASMR » d'une specialite MITM.
3
+
4
+ L'index MITM tient, pour un code CIS, l'integralite des avis de la Commission
5
+ de la transparence : une quarantaine de SMR et autant d'ASMR, chacun avec son
6
+ texte complet. Les deux derniers niveaux se lisent en tete, puis chaque avis
7
+ devient une carte, SMR et ASMR reunis par code, le texte integral s'ouvrant
8
+ dans le tiroir. Les CIP rattaches restent dans l'onglet MITM (Overview).
9
+ -->
10
+ <script setup lang="ts">
11
+ import { HEART_SOURCE_UUIDS } from "../../../../../oip-drugs/utils/sourceUuids";
12
+ import useDirectusSources from "../../../../../oip-drugs/composables/useDirectusSources";
13
+ import {
14
+ heartAsmrTone as asmrTone,
15
+ heartMitmLast,
16
+ heartSmrTone as smrTone,
17
+ } from "../../../../../oip-drugs/utils/heartMitmTone";
18
+
19
+ // Libelle de source : Directus, comme le panneau « Sources » du rail.
20
+ const { load: loadSourceMeta, metaByUuid } = useDirectusSources();
21
+ loadSourceMeta([HEART_SOURCE_UUIDS.HAS]);
22
+ const props = defineProps<{
23
+ /** Le document MITM du CIS choisi (_source). */
24
+ cis: any;
25
+ }>();
26
+
27
+ const emit = defineEmits<{ (event: "select", record: any): void }>();
28
+
29
+ const { locale } = useI18n();
30
+ const hasSourceName = computed(
31
+ () => metaByUuid(HEART_SOURCE_UUIDS.HAS, locale.value === "en" ? "en" : "fr").name,
32
+ );
33
+
34
+ /** `20260708` dans l'index, une date ailleurs. */
35
+ function isoDate(raw: string | null | undefined) {
36
+ if (!raw) return null;
37
+ const value = String(raw);
38
+ if (/^\d{8}$/.test(value)) {
39
+ return `${value.slice(0, 4)}-${value.slice(4, 6)}-${value.slice(6, 8)}`;
40
+ }
41
+ return value;
42
+ }
43
+
44
+ /** Les libelles d'avis portent des `<br>` : on les rend au lecteur, pas au DOM. */
45
+ function plain(text: string | null | undefined) {
46
+ if (!text) return "";
47
+ return text
48
+ .replace(/<br\s*\/?>/gi, "\n")
49
+ .replace(/<[^>]+>/g, "")
50
+ .trim();
51
+ }
52
+
53
+ const lastSmr = computed(() => heartMitmLast(props.cis?.last_smr));
54
+ const lastAsmr = computed(() => heartMitmLast(props.cis?.last_asmr));
55
+
56
+ /**
57
+ * Les avis, un par code HAS.
58
+ *
59
+ * SMR et ASMR sont deux listes separees dans l'index alors qu'ils sont rendus
60
+ * dans le meme avis : on les rassemble par `has_code`, sinon chaque decision
61
+ * apparaissait deux fois.
62
+ */
63
+ const opinions = computed(() => {
64
+ const byCode = new Map<string, any>();
65
+
66
+ const push = (entry: any, kind: "smr" | "asmr") => {
67
+ // L'index porte des lignes de remplissage entierement nulles : sans ce
68
+ // garde, chacune devenait un avis vide dans la liste.
69
+ if (!entry?.has_code && !entry?.has_date && !entry?.label && !entry?.value) return;
70
+ const code = entry.has_code || `${kind}-${entry.has_date}`;
71
+ const found = byCode.get(code) ?? {
72
+ code: entry.has_code || null,
73
+ date: isoDate(entry.has_date),
74
+ reason: entry.has_reason || null,
75
+ };
76
+ // Un meme avis peut rendre plusieurs niveaux (important ici, insuffisant
77
+ // la) : on les cumule au lieu de garder le dernier.
78
+ const previous = found[kind];
79
+ found[kind] = {
80
+ value: [previous?.value, entry.value].filter(Boolean).join(", ") || null,
81
+ label: [previous?.label, plain(entry.label)].filter(Boolean).join("\n\n"),
82
+ };
83
+ byCode.set(code, found);
84
+ };
85
+
86
+ (props.cis?.smr ?? []).forEach((entry: any) => push(entry, "smr"));
87
+ (props.cis?.asmr ?? []).forEach((entry: any) => push(entry, "asmr"));
88
+
89
+ // `has_date` peut etre nul : NaN dans le comparateur rendait l'ordre
90
+ // aleatoire, on classe ces avis en fin de liste.
91
+ const time = (d: string | null) => (d ? new Date(d).getTime() : 0);
92
+ return [...byCode.values()].sort((a, b) => time(b.date) - time(a.date));
93
+ });
94
+
95
+ const records = computed(() =>
96
+ opinions.value.map((opinion) => ({
97
+ key: opinion.code || opinion.date,
98
+ typeLabel:
99
+ opinion.reason || (locale.value === "en" ? "Transparency opinion" : "Avis de transparence"),
100
+ icon: "FileText",
101
+ date: opinion.date,
102
+ ref: opinion.code,
103
+ title:
104
+ opinion.smr?.label ||
105
+ opinion.asmr?.label ||
106
+ (locale.value === "en" ? "Transparency opinion" : "Avis de transparence"),
107
+ excerpt: opinion.smr?.label ? opinion.asmr?.label : null,
108
+ status: opinion.smr?.value ? `SMR ${opinion.smr.value}` : null,
109
+ statusTone: smrTone(opinion.smr?.value),
110
+ badge: opinion.asmr?.value ? `ASMR ${opinion.asmr.value}` : null,
111
+ badgeTone: asmrTone(opinion.asmr?.value),
112
+ sourceLabel: hasSourceName.value,
113
+ sections: [
114
+ {
115
+ key: "smr",
116
+ label: locale.value === "en" ? "Actual benefit (SMR)" : "Service médical rendu (SMR)",
117
+ body: opinion.smr?.label ?? "",
118
+ },
119
+ {
120
+ key: "asmr",
121
+ label:
122
+ locale.value === "en"
123
+ ? "Improvement in actual benefit (ASMR)"
124
+ : "Amélioration du service médical rendu (ASMR)",
125
+ body: opinion.asmr?.label ?? "",
126
+ },
127
+ ],
128
+ })),
129
+ );
130
+ </script>
131
+
132
+ <template>
133
+ <section class="oip-drugs mi">
134
+ <p class="mi_scope">
135
+ <RmIcon name="Info" :size="14" />
136
+ {{
137
+ locale === "en"
138
+ ? `Opinions cover the presentation ${cis.cis_label}.`
139
+ : `Les avis portent sur la présentation ${cis.cis_label}.`
140
+ }}
141
+ </p>
142
+
143
+ <!-- Meme bandeau de synthese que l'onglet Prix : les niveaux en vigueur et
144
+ l'ampleur de l'historique, avant d'entrer dans le detail. -->
145
+ <div class="mi_kpis">
146
+ <div class="mi_kpi">
147
+ <p class="mi_kpi_value" :class="`is_${smrTone(lastSmr?.value)}`">
148
+ {{ lastSmr?.value || "-" }}
149
+ </p>
150
+ <p class="mi_kpi_label">{{ locale === "en" ? "Current SMR" : "SMR en vigueur" }}</p>
151
+ </div>
152
+
153
+ <div class="mi_kpi">
154
+ <p class="mi_kpi_value" :class="`is_${asmrTone(lastAsmr?.value)}`">
155
+ {{ lastAsmr?.value || "-" }}
156
+ </p>
157
+ <p class="mi_kpi_label">{{ locale === "en" ? "Current ASMR" : "ASMR en vigueur" }}</p>
158
+ </div>
159
+
160
+ <div class="mi_kpi">
161
+ <p class="mi_kpi_value">{{ records.length }}</p>
162
+ <p class="mi_kpi_label">
163
+ {{ locale === "en" ? "Opinions recorded" : "Avis recensés" }}
164
+ </p>
165
+ </div>
166
+
167
+ <div class="mi_kpi">
168
+ <p class="mi_kpi_value">
169
+ <RmDate
170
+ v-if="isoDate(lastSmr?.has_date || lastAsmr?.has_date)"
171
+ :date="isoDate(lastSmr?.has_date || lastAsmr?.has_date)!"
172
+ :lang="locale"
173
+ />
174
+ <template v-else>-</template>
175
+ </p>
176
+ <p class="mi_kpi_label">
177
+ {{ locale === "en" ? "Last assessment" : "Dernière évaluation" }}
178
+ </p>
179
+ </div>
180
+ </div>
181
+
182
+ <OipDrugsHeartResultsDetailsRecordList
183
+ :title="locale === 'en' ? 'Transparency Committee opinions' : 'Avis de la Commission de la transparence'"
184
+ :subtitle="locale === 'en' ? 'opinions recorded for this presentation' : 'avis recensés pour cette présentation'"
185
+ :items="records"
186
+ :empty-label="locale === 'en' ? 'No opinion recorded.' : 'Aucun avis recensé.'"
187
+ @select="emit('select', $event)"
188
+ />
189
+
190
+ <p class="mi_source">
191
+ <OipDrugsHeartMitmSource
192
+ :last-label="$t('oipDrugs.heart.sources.lastUpdate')"
193
+ :last-date="cis?.update_date"
194
+ />
195
+ </p>
196
+ </section>
197
+ </template>
198
+
199
+ <style scoped>
200
+ .mi {
201
+ display: flex;
202
+ flex-direction: column;
203
+ gap: 16px;
204
+ box-sizing: border-box;
205
+ width: 100%;
206
+ }
207
+
208
+ /* La liste d'avis pose deja sa propre gouttiere de 32px ; les autres blocs la
209
+ prennent en marge et non en retrait interne, pour que leur cadre s'aligne sur
210
+ celui des cartes plutot que de le deborder. */
211
+ .mi > :not(.rl) {
212
+ margin-inline: 32px;
213
+ }
214
+
215
+ .mi_scope {
216
+ display: flex;
217
+ flex-wrap: wrap;
218
+ align-items: center;
219
+ gap: 6px;
220
+ color: var(--medium);
221
+ font-size: 13px;
222
+ }
223
+
224
+ /* Bandeau de synthese : meme dessin que celui de l'onglet Prix. */
225
+ .mi_kpis {
226
+ display: grid;
227
+ grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
228
+ border: 1px solid var(--light);
229
+ /* Le filet degrade court d'un bord a l'autre : arrondir le haut le tronquait
230
+ a ses extremites. */
231
+ border-radius: 0 0 12px 12px;
232
+ background: var(--white);
233
+ overflow: hidden;
234
+ box-shadow: var(--small-shadow);
235
+ }
236
+
237
+ .mi_kpis::before {
238
+ content: "";
239
+ grid-column: 1 / -1;
240
+ height: 3px;
241
+ background: linear-gradient(to right, var(--primary), color-mix(in srgb, var(--primary) 35%, var(--white)));
242
+ }
243
+
244
+ .mi_kpi {
245
+ display: flex;
246
+ flex-direction: column;
247
+ align-items: center;
248
+ gap: 6px;
249
+ padding: 20px 16px;
250
+ border-left: 1px solid var(--light);
251
+ text-align: center;
252
+ }
253
+
254
+ .mi_kpi:first-of-type {
255
+ border-left: none;
256
+ }
257
+
258
+ .mi_kpi_value {
259
+ color: var(--primary);
260
+ font-size: 19px;
261
+ font-weight: 800;
262
+ white-space: nowrap;
263
+ }
264
+
265
+ /* Le niveau porte sa propre lecture : favorable, moyen, insuffisant. */
266
+ .mi_kpi_value.is_good {
267
+ color: var(--system-success-hover);
268
+ }
269
+
270
+ .mi_kpi_value.is_bad {
271
+ color: var(--system-alert-hover);
272
+ }
273
+
274
+ .mi_kpi_value.is_warn {
275
+ color: #b45309;
276
+ }
277
+
278
+ .mi_kpi_label {
279
+ color: var(--medium);
280
+ font-size: 11px;
281
+ font-weight: 600;
282
+ letter-spacing: 0.04em;
283
+ text-transform: uppercase;
284
+ white-space: nowrap;
285
+ }
286
+
287
+ .mi_source {
288
+ color: var(--medium);
289
+ font-size: 13px;
290
+ }
291
+ </style>
@@ -33,7 +33,8 @@
33
33
  </p>
34
34
  </RmPageHeader>
35
35
 
36
- <OipDrugsHeartMitmDetailsOverview :cis="source" @select="drawerRecord = $event" />
36
+ <OipDrugsHeartMitmDetailsSmrAsmr :cis="source" @select="drawerRecord = $event" />
37
+ <OipDrugsHeartMitmDetailsOverview :cis="source" />
37
38
 
38
39
  <OipDrugsHeartResultsDetailsRecordDrawer
39
40
  :record="drawerRecord"
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Lecture des niveaux SMR / ASMR de l'index MITM, partagee par l'onglet
3
+ * « SMR & ASMR » et le tableau des CIP de l'onglet MITM.
4
+ */
5
+
6
+ export type HeartMitmTone = "good" | "bad" | "warn" | "post" | "neutral";
7
+
8
+ /** Important, Modere, Faible, Insuffisant. */
9
+ export function heartSmrTone(value: string | null | undefined): HeartMitmTone {
10
+ const v = (value || "").toLowerCase();
11
+ const bad = v.includes("insuffisant");
12
+ const good = v.includes("important");
13
+ // Un avis peut etre important sur une indication et insuffisant sur une autre.
14
+ if (bad && good) return "neutral";
15
+ if (bad) return "bad";
16
+ if (good) return "good";
17
+ return "neutral";
18
+ }
19
+
20
+ /** ASMR I a V : plus le niveau est haut, plus le progres est net. */
21
+ export function heartAsmrTone(value: string | null | undefined): HeartMitmTone {
22
+ const level = (value || "").trim().match(/^(I{1,3}|IV|V)\b/)?.[1];
23
+ if (level === "I" || level === "II") return "good";
24
+ if (level === "III") return "post";
25
+ if (level === "IV") return "warn";
26
+ return "neutral";
27
+ }
28
+
29
+ /**
30
+ * Premier niveau renseigne de `last_smr` / `last_asmr` : l'index met des lignes
31
+ * de remplissage nulles en tete, les lire telles quelles affichait un tiret.
32
+ */
33
+ export function heartMitmLast(list: any[] | null | undefined): any | null {
34
+ return (list ?? []).find((entry: any) => entry?.value) ?? null;
35
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tekkare/romulus",
3
- "version": "0.1.335",
3
+ "version": "0.1.337",
4
4
  "description": "Romulus Design System - Nuxt module by Tekkare",
5
5
  "license": "MIT",
6
6
  "type": "module",